Turn killable from variable to method (#11146)
* Turn killable from variable to method * Update UnitType.java * Update UnitComp.java
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user