mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-02 03:00:29 +03:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -28,6 +28,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class BulletType extends Content implements Cloneable{
|
||||
static final UnitDamageEvent bulletDamageEvent = new UnitDamageEvent();
|
||||
static final BulletCreateEvent bulletCreateEvent = new BulletCreateEvent();
|
||||
|
||||
/** Lifetime in ticks. */
|
||||
public float lifetime = 40f;
|
||||
@@ -997,6 +998,7 @@ public class BulletType extends Content implements Cloneable{
|
||||
@Remote(called = Loc.server, unreliable = true)
|
||||
public static void createBullet(BulletType type, Team team, float x, float y, float angle, float damage, float velocityScl, float lifetimeScl){
|
||||
if(type == null) return;
|
||||
type.create(null, team, x, y, angle, damage, velocityScl, lifetimeScl, null);
|
||||
var bullet = type.create(null, team, x, y, angle, damage, velocityScl, lifetimeScl, null);
|
||||
Events.fire(bulletCreateEvent.set(bullet));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,6 +410,20 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a bullet has been created.
|
||||
* WARNING! This event is special: its instance is reused! Do not cache or use with a timer.
|
||||
* Do not modify any tiles inside listeners that use this tile.
|
||||
* */
|
||||
public static class BulletCreateEvent{
|
||||
public Bullet bullet;
|
||||
|
||||
public BulletCreateEvent set(Bullet bullet){
|
||||
this.bullet = bullet;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called *before* a tile has changed.
|
||||
* WARNING! This event is special: its instance is reused! Do not cache or use with a timer.
|
||||
|
||||
Reference in New Issue
Block a user