Little NodeContainer ECS (#17702)
This commit is contained in:
@@ -48,6 +48,7 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||
|
||||
private const string StatusEffectKey = "Electrocution";
|
||||
private const string DamageType = "Shock";
|
||||
@@ -265,7 +266,7 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
|
||||
Node? TryNode(string? id)
|
||||
{
|
||||
if (id != null &&
|
||||
nodeContainer.TryGetNode<Node>(id, out var tryNode) &&
|
||||
_nodeContainer.TryGetNode<Node>(nodeContainer, id, out var tryNode) &&
|
||||
tryNode.NodeGroup is IBasePowerNet { NetworkNode: { LastCombinedSupply: > 0 } })
|
||||
{
|
||||
return tryNode;
|
||||
@@ -320,7 +321,12 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
|
||||
return true;
|
||||
|
||||
var electrocutionEntity = Spawn($"VirtualElectrocutionLoad{node.NodeGroupID}", sourceTransform.Coordinates);
|
||||
var electrocutionNode = Comp<NodeContainerComponent>(electrocutionEntity).GetNode<ElectrocutionNode>("electrocution");
|
||||
|
||||
var nodeContainer = Comp<NodeContainerComponent>(electrocutionEntity);
|
||||
|
||||
if (!_nodeContainer.TryGetNode<ElectrocutionNode>(nodeContainer, "electrocution", out var electrocutionNode))
|
||||
return false;
|
||||
|
||||
var electrocutionComponent = Comp<ElectrocutionComponent>(electrocutionEntity);
|
||||
|
||||
// This shows up in the power monitor.
|
||||
|
||||
Reference in New Issue
Block a user