Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2026-08-30 16:13:23 -04:00
2 changed files with 17 additions and 1 deletions
@@ -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));
}
}
+14
View File
@@ -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.