Added sensor for shields
This commit is contained in:
@@ -34,7 +34,7 @@ import static mindustry.logic.GlobalVars.*;
|
|||||||
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc, Displayable, Ranged, Minerc, Builderc, Senseable, Settable{
|
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc, Displayable, Ranged, Minerc, Builderc, Senseable, Settable{
|
||||||
|
|
||||||
@Import boolean hovering, dead, disarmed;
|
@Import boolean hovering, dead, disarmed;
|
||||||
@Import float x, y, rotation, elevation, maxHealth, drag, armor, hitSize, health, ammo, dragMultiplier;
|
@Import float x, y, rotation, elevation, maxHealth, drag, armor, hitSize, health, shield, ammo, dragMultiplier;
|
||||||
@Import Team team;
|
@Import Team team;
|
||||||
@Import int id;
|
@Import int id;
|
||||||
@Import @Nullable Tile mineTile;
|
@Import @Nullable Tile mineTile;
|
||||||
@@ -208,6 +208,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
case itemCapacity -> type.itemCapacity;
|
case itemCapacity -> type.itemCapacity;
|
||||||
case rotation -> rotation;
|
case rotation -> rotation;
|
||||||
case health -> health;
|
case health -> health;
|
||||||
|
case shield -> shield;
|
||||||
case maxHealth -> maxHealth;
|
case maxHealth -> maxHealth;
|
||||||
case ammo -> !state.rules.unitAmmo ? type.ammoCapacity : ammo;
|
case ammo -> !state.rules.unitAmmo ? type.ammoCapacity : ammo;
|
||||||
case ammoCapacity -> type.ammoCapacity;
|
case ammoCapacity -> type.ammoCapacity;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public enum LAccess{
|
|||||||
health,
|
health,
|
||||||
maxHealth,
|
maxHealth,
|
||||||
heat,
|
heat,
|
||||||
|
shield,
|
||||||
efficiency,
|
efficiency,
|
||||||
progress,
|
progress,
|
||||||
timescale,
|
timescale,
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ public class ForceProjector extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public double sense(LAccess sensor){
|
public double sense(LAccess sensor){
|
||||||
if(sensor == LAccess.heat) return buildup;
|
if(sensor == LAccess.heat) return buildup;
|
||||||
|
if(sensor == LAccess.shield) return broken ? 0f : Math.max(shieldHealth + phaseShieldBoost * phaseHeat - buildup, 0);
|
||||||
return super.sense(sensor);
|
return super.sense(sensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user