Improve airlock power ui (#5858)

This commit is contained in:
wrexbe
2021-12-22 20:02:26 -08:00
committed by GitHub
parent ebdd6e817c
commit 6f84064755

View File

@@ -153,27 +153,29 @@ namespace Content.Server.Doors.Components
public void UpdateWiresStatus() public void UpdateWiresStatus()
{ {
if (DoorComponent == null) if (WiresComponent == null) return;
{
return;
}
var powerLight = new StatusLightData(Color.Yellow, StatusLightState.On, "POWR"); var mainPowerCut = WiresComponent.IsWireCut(Wires.MainPower);
if (PowerWiresPulsed) var backupPowerCut = WiresComponent.IsWireCut(Wires.BackupPower);
var statusLightState = PowerWiresPulsed ? StatusLightState.BlinkingFast : StatusLightState.On;
StatusLightData powerLight;
if (mainPowerCut && backupPowerCut)
{ {
powerLight = new StatusLightData(Color.Yellow, StatusLightState.BlinkingFast, "POWR"); powerLight = new StatusLightData(Color.DarkGoldenrod, StatusLightState.Off, "POWER");
} }
else if (WiresComponent != null && else if (mainPowerCut != backupPowerCut)
WiresComponent.IsWireCut(Wires.MainPower) &&
WiresComponent.IsWireCut(Wires.BackupPower))
{ {
powerLight = new StatusLightData(Color.Red, StatusLightState.On, "POWR"); powerLight = new StatusLightData(Color.Gold, statusLightState, "POWER");
}
else
{
powerLight = new StatusLightData(Color.Yellow, statusLightState, "POWER");
} }
var boltStatus = var boltStatus =
new StatusLightData(Color.Red, BoltsDown ? StatusLightState.On : StatusLightState.Off, "BOLT"); new StatusLightData(Color.Red, BoltsDown ? StatusLightState.On : StatusLightState.Off, "BOLT");
var boltLightsStatus = new StatusLightData(Color.Lime, var boltLightsStatus = new StatusLightData(Color.Lime,
_boltLightsWirePulsed ? StatusLightState.On : StatusLightState.Off, "BLTL"); _boltLightsWirePulsed ? StatusLightState.On : StatusLightState.Off, "BOLT LED");
var ev = new DoorGetCloseTimeModifierEvent(); var ev = new DoorGetCloseTimeModifierEvent();
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false); IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
@@ -185,17 +187,13 @@ namespace Content.Server.Doors.Components
"TIME"); "TIME");
var safetyStatus = var safetyStatus =
new StatusLightData(Color.Red, Safety ? StatusLightState.On : StatusLightState.Off, "SAFE"); new StatusLightData(Color.Red, Safety ? StatusLightState.On : StatusLightState.Off, "SAFETY");
if (WiresComponent == null)
{
return;
}
WiresComponent.SetStatus(AirlockWireStatus.PowerIndicator, powerLight); WiresComponent.SetStatus(AirlockWireStatus.PowerIndicator, powerLight);
WiresComponent.SetStatus(AirlockWireStatus.BoltIndicator, boltStatus); WiresComponent.SetStatus(AirlockWireStatus.BoltIndicator, boltStatus);
WiresComponent.SetStatus(AirlockWireStatus.BoltLightIndicator, boltLightsStatus); WiresComponent.SetStatus(AirlockWireStatus.BoltLightIndicator, boltLightsStatus);
WiresComponent.SetStatus(AirlockWireStatus.AIControlIndicator, new StatusLightData(Color.Purple, StatusLightState.BlinkingSlow, "AICT")); WiresComponent.SetStatus(AirlockWireStatus.AIControlIndicator, new StatusLightData(Color.Purple, StatusLightState.BlinkingSlow, "AI CTRL"));
WiresComponent.SetStatus(AirlockWireStatus.TimingIndicator, timingStatus); WiresComponent.SetStatus(AirlockWireStatus.TimingIndicator, timingStatus);
WiresComponent.SetStatus(AirlockWireStatus.SafetyIndicator, safetyStatus); WiresComponent.SetStatus(AirlockWireStatus.SafetyIndicator, safetyStatus);
} }
@@ -219,7 +217,7 @@ namespace Content.Server.Doors.Components
} }
ReceiverComponent.PowerDisabled = ReceiverComponent.PowerDisabled =
WiresComponent.IsWireCut(Wires.MainPower) || WiresComponent.IsWireCut(Wires.MainPower) &&
WiresComponent.IsWireCut(Wires.BackupPower); WiresComponent.IsWireCut(Wires.BackupPower);
} }