diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 68a22f48fc..8e47c5ea52 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -532,6 +532,10 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I return type.targetable(self(), targeter); } + public boolean killable(){ + return type.killable(self()); + } + public boolean hittable(){ return type.hittable(self()); } @@ -832,7 +836,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I /** Actually destroys the unit, removing it and creating explosions. **/ public void destroy(){ - if(!isAdded() || !type.killable) return; + if(!isAdded() || !killable()) return; float explosiveness = 2f + item().explosiveness * stack().amount * 1.53f; float flammability = item().flammability * stack().amount / 1.9f; @@ -937,7 +941,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I @Override @Replace public void kill(){ - if(dead || net.client() || !type.killable) return; + if(dead || net.client() || !killable()) return; //deaths are synced; this calls killed() Call.unitDeath(id); diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 540bfe33eb..f6a463c41a 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -593,6 +593,10 @@ public class UnitType extends UnlockableContent implements Senseable{ return targetable || (vulnerableWithPayloads && unit instanceof Payloadc p && p.hasPayload()); } + public boolean killable(Unit unit){ + return killable; + } + public boolean hittable(Unit unit){ return hittable || (vulnerableWithPayloads && unit instanceof Payloadc p && p.hasPayload()); }