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{
|
||||
|
||||
@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 int id;
|
||||
@Import @Nullable Tile mineTile;
|
||||
@@ -208,6 +208,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
case itemCapacity -> type.itemCapacity;
|
||||
case rotation -> rotation;
|
||||
case health -> health;
|
||||
case shield -> shield;
|
||||
case maxHealth -> maxHealth;
|
||||
case ammo -> !state.rules.unitAmmo ? type.ammoCapacity : ammo;
|
||||
case ammoCapacity -> type.ammoCapacity;
|
||||
|
||||
@@ -20,6 +20,7 @@ public enum LAccess{
|
||||
health,
|
||||
maxHealth,
|
||||
heat,
|
||||
shield,
|
||||
efficiency,
|
||||
progress,
|
||||
timescale,
|
||||
|
||||
@@ -220,6 +220,7 @@ public class ForceProjector extends Block{
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.heat) return buildup;
|
||||
if(sensor == LAccess.shield) return broken ? 0f : Math.max(shieldHealth + phaseShieldBoost * phaseHeat - buildup, 0);
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user