diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 3d1d808685..ab36682972 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -38,6 +38,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I @Import int id; @Import @Nullable Tile mineTile; @Import Vec2 vel; + @Import WeaponMount[] mounts; private UnitController controller; UnitType type; @@ -496,6 +497,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I Events.fire(Trigger.suicideBomb); } + for(WeaponMount mount : mounts){ + if(mount.weapon.shootOnDeath && !(mount.weapon.bullet.killShooter && mount.shoot)){ + mount.reload = 0f; + mount.shoot = true; + mount.weapon.update(self(), mount); + } + } + //if this unit crash landed (was flying), damage stuff in a radius if(type.flying && !spawnedByCore){ Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true); diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 513c8f9c41..db3c924825 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -117,6 +117,8 @@ public class Weapon implements Cloneable{ public Func mountType = WeaponMount::new; /** status effect duration when shot */ public float shootStatusDuration = 60f * 5f; + /** whether this weapon should fire when its owner dies */ + public boolean shootOnDeath = false; public Weapon(String name){ this.name = name;