Adds the ability for electrification to check if the entity is powered by an APC (#7533)
This commit is contained in:
@@ -30,6 +30,9 @@ namespace Content.Server.Electrocution
|
|||||||
[DataField("requirePower")]
|
[DataField("requirePower")]
|
||||||
public bool RequirePower { get; } = true;
|
public bool RequirePower { get; } = true;
|
||||||
|
|
||||||
|
[DataField("usesApcPower")]
|
||||||
|
public bool UsesApcPower { get; } = false;
|
||||||
|
|
||||||
[DataField("highVoltageNode")]
|
[DataField("highVoltageNode")]
|
||||||
public string? HighVoltageNode { get; }
|
public string? HighVoltageNode { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -183,8 +183,18 @@ namespace Content.Server.Electrocution
|
|||||||
|
|
||||||
var targets = new List<(EntityUid entity, int depth)>();
|
var targets = new List<(EntityUid entity, int depth)>();
|
||||||
GetChainedElectrocutionTargets(targetUid, targets);
|
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;
|
var lastRet = true;
|
||||||
for (var i = targets.Count - 1; i >= 0; i--)
|
for (var i = targets.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user