Added sensor for shields

This commit is contained in:
Anuken
2023-07-29 11:17:55 -04:00
parent 09d00b30e9
commit 6678729401
3 changed files with 4 additions and 1 deletions

View File

@@ -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;

View File

@@ -20,6 +20,7 @@ public enum LAccess{
health,
maxHealth,
heat,
shield,
efficiency,
progress,
timescale,

View File

@@ -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);
}