Added flag for killable units
This commit is contained in:
@@ -6,12 +6,14 @@ import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
@Component
|
||||
abstract class ShieldComp implements Healthc, Posc{
|
||||
@Import float health, hitTime, x, y, healthMultiplier;
|
||||
@Import boolean dead;
|
||||
@Import Team team;
|
||||
@Import UnitType type;
|
||||
|
||||
/** Absorbs health damage. */
|
||||
float shield;
|
||||
@@ -51,7 +53,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
||||
hitTime = 1f;
|
||||
amount -= shieldDamage;
|
||||
|
||||
if(amount > 0){
|
||||
if(amount > 0 && type.killable){
|
||||
health -= amount;
|
||||
if(health <= 0 && !dead){
|
||||
kill();
|
||||
|
||||
@@ -541,7 +541,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()) return;
|
||||
if(!isAdded() || !type.killable) return;
|
||||
|
||||
float explosiveness = 2f + item().explosiveness * stack().amount * 1.53f;
|
||||
float flammability = item().flammability * stack().amount / 1.9f;
|
||||
@@ -645,7 +645,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
@Override
|
||||
@Replace
|
||||
public void kill(){
|
||||
if(dead || net.client()) return;
|
||||
if(dead || net.client() || !type.killable) return;
|
||||
|
||||
//deaths are synced; this calls killed()
|
||||
Call.unitDeath(id);
|
||||
|
||||
@@ -68,7 +68,9 @@ public class UnitType extends UnlockableContent{
|
||||
public boolean logicControllable = true;
|
||||
public boolean playerControllable = true;
|
||||
public boolean allowedInPayloads = true;
|
||||
/** TODO If true, core units will re-appear on this unit when respawning. */
|
||||
/** If false, this unit does not take damage and cannot be kill() / destroy()-ed. */
|
||||
public boolean killable = true;
|
||||
/** If true, this core unit will "dock" to other units, making it re-appear when "undocking". */
|
||||
public boolean coreUnitDock = false;
|
||||
public boolean createWreck = true;
|
||||
public boolean createScorch = true;
|
||||
|
||||
Reference in New Issue
Block a user