Adds the ability for electrification to check if the entity is powered by an APC (#7533)

This commit is contained in:
Flipp Syder
2022-04-15 14:21:11 -07:00
committed by GitHub
parent 70a26bf0c2
commit 4700e5bc80
2 changed files with 14 additions and 1 deletions

View File

@@ -30,6 +30,9 @@ namespace Content.Server.Electrocution
[DataField("requirePower")]
public bool RequirePower { get; } = true;
[DataField("usesApcPower")]
public bool UsesApcPower { get; } = false;
[DataField("highVoltageNode")]
public string? HighVoltageNode { get; }

View File

@@ -183,8 +183,18 @@ namespace Content.Server.Electrocution
var targets = new List<(EntityUid entity, int depth)>();
GetChainedElectrocutionTargets(targetUid, targets);
if (!electrified.RequirePower)
if (!electrified.RequirePower || electrified.UsesApcPower)
{
// Does it use APC power for its electrification check? Check if it's powered, and then
// attempt an electrocution if all the checks succeed.
if (electrified.UsesApcPower &&
(!TryComp(uid, out ApcPowerReceiverComponent? power)
|| !power.Powered))
{
return false;
}
var lastRet = true;
for (var i = targets.Count - 1; i >= 0; i--)
{