Make Airlock hacking shut power to the entire PowerDevice.

This makes the power device report as "not powered" in the examine tooltip.
This commit is contained in:
Pieter-Jan Briers
2019-10-13 18:29:57 +02:00
parent bd3fe8f86b
commit d113a738de
2 changed files with 24 additions and 12 deletions

View File

@@ -48,13 +48,14 @@ namespace Content.Server.GameObjects.Components.Doors
{
_powerWiresPulsed = value;
UpdateWiresStatus();
UpdatePowerCutStatus();
}
}
private void UpdateWiresStatus()
{
var powerMessage = "A yellow light is on.";
if (_powerWiresPulsed)
if (PowerWiresPulsed)
{
powerMessage = "A yellow light is blinking rapidly.";
} else if (_wires.IsWireCut(Wires.MainPower) &&
@@ -65,6 +66,13 @@ namespace Content.Server.GameObjects.Components.Doors
_wires.SetStatus(WiresStatus.PowerIndicator, _localizationMgr.GetString(powerMessage));
}
private void UpdatePowerCutStatus()
{
_powerDevice.IsPowerCut = PowerWiresPulsed ||
_wires.IsWireCut(Wires.MainPower) ||
_wires.IsWireCut(Wires.BackupPower);
}
protected override DoorState State
{
set
@@ -163,6 +171,7 @@ namespace Content.Server.GameObjects.Components.Doors
}
UpdateWiresStatus();
UpdatePowerCutStatus();
}
public override bool CanOpen()
@@ -186,15 +195,6 @@ namespace Content.Server.GameObjects.Components.Doors
private bool IsPowered()
{
if (PowerWiresPulsed)
{
return false;
}
if (_wires.IsWireCut(Wires.MainPower) &&
_wires.IsWireCut(Wires.BackupPower))
{
return false;
}
return _powerDevice.Powered;
}