Files
crystall-punk-14/Content.Server/Electrocution/ElectrocutionNode.cs

32 lines
986 B
C#
Raw Normal View History

2022-02-07 01:10:33 +13:00
using System.Collections.Generic;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.GameObjects;
2022-02-07 01:10:33 +13:00
using Robust.Shared.Map;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Electrocution
{
[DataDefinition]
public sealed class ElectrocutionNode : Node
{
[DataField("cable")]
public EntityUid CableEntity;
[DataField("node")]
public string NodeName = default!;
2022-02-07 01:10:33 +13:00
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
IEntityManager entMan)
{
2022-02-07 01:10:33 +13:00
if (!nodeQuery.TryGetComponent(CableEntity, out var nodeContainer))
yield break;
if (nodeContainer.TryGetNode(NodeName, out Node? node))
yield return node;
}
}
}