Added flag for killable units
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 443 B |
@@ -6,12 +6,14 @@ import mindustry.content.*;
|
|||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.type.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
abstract class ShieldComp implements Healthc, Posc{
|
abstract class ShieldComp implements Healthc, Posc{
|
||||||
@Import float health, hitTime, x, y, healthMultiplier;
|
@Import float health, hitTime, x, y, healthMultiplier;
|
||||||
@Import boolean dead;
|
@Import boolean dead;
|
||||||
@Import Team team;
|
@Import Team team;
|
||||||
|
@Import UnitType type;
|
||||||
|
|
||||||
/** Absorbs health damage. */
|
/** Absorbs health damage. */
|
||||||
float shield;
|
float shield;
|
||||||
@@ -51,7 +53,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
|||||||
hitTime = 1f;
|
hitTime = 1f;
|
||||||
amount -= shieldDamage;
|
amount -= shieldDamage;
|
||||||
|
|
||||||
if(amount > 0){
|
if(amount > 0 && type.killable){
|
||||||
health -= amount;
|
health -= amount;
|
||||||
if(health <= 0 && !dead){
|
if(health <= 0 && !dead){
|
||||||
kill();
|
kill();
|
||||||
|
|||||||
@@ -541,7 +541,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
|
|
||||||
/** Actually destroys the unit, removing it and creating explosions. **/
|
/** Actually destroys the unit, removing it and creating explosions. **/
|
||||||
public void destroy(){
|
public void destroy(){
|
||||||
if(!isAdded()) return;
|
if(!isAdded() || !type.killable) return;
|
||||||
|
|
||||||
float explosiveness = 2f + item().explosiveness * stack().amount * 1.53f;
|
float explosiveness = 2f + item().explosiveness * stack().amount * 1.53f;
|
||||||
float flammability = item().flammability * stack().amount / 1.9f;
|
float flammability = item().flammability * stack().amount / 1.9f;
|
||||||
@@ -645,7 +645,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
@Override
|
@Override
|
||||||
@Replace
|
@Replace
|
||||||
public void kill(){
|
public void kill(){
|
||||||
if(dead || net.client()) return;
|
if(dead || net.client() || !type.killable) return;
|
||||||
|
|
||||||
//deaths are synced; this calls killed()
|
//deaths are synced; this calls killed()
|
||||||
Call.unitDeath(id);
|
Call.unitDeath(id);
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ public class UnitType extends UnlockableContent{
|
|||||||
public boolean logicControllable = true;
|
public boolean logicControllable = true;
|
||||||
public boolean playerControllable = true;
|
public boolean playerControllable = true;
|
||||||
public boolean allowedInPayloads = 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 coreUnitDock = false;
|
||||||
public boolean createWreck = true;
|
public boolean createWreck = true;
|
||||||
public boolean createScorch = true;
|
public boolean createScorch = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user