2021-10-25 16:21:56 +02:00
|
|
|
using Content.Server.NodeContainer;
|
2023-06-28 14:28:38 +03:00
|
|
|
using Content.Server.NodeContainer.EntitySystems;
|
2021-10-25 16:21:56 +02:00
|
|
|
using Content.Server.NodeContainer.Nodes;
|
2022-11-22 13:12:04 +11:00
|
|
|
using Robust.Shared.Map.Components;
|
2021-10-25 16:21:56 +02:00
|
|
|
|
|
|
|
|
namespace Content.Server.Electrocution
|
|
|
|
|
{
|
|
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ElectrocutionNode : Node
|
2021-10-25 16:21:56 +02:00
|
|
|
{
|
|
|
|
|
[DataField("cable")]
|
2024-03-30 17:17:53 +13:00
|
|
|
public EntityUid? CableEntity;
|
2021-10-25 16:21:56 +02:00
|
|
|
[DataField("node")]
|
2022-11-27 19:25:55 +01:00
|
|
|
public string? NodeName;
|
2021-10-25 16:21:56 +02:00
|
|
|
|
2022-02-07 01:10:33 +13:00
|
|
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
|
|
|
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
|
|
|
|
EntityQuery<TransformComponent> xformQuery,
|
2022-11-22 13:12:04 +11:00
|
|
|
MapGridComponent? grid,
|
2022-02-07 01:10:33 +13:00
|
|
|
IEntityManager entMan)
|
2021-10-25 16:21:56 +02:00
|
|
|
{
|
2024-03-30 17:17:53 +13:00
|
|
|
if (CableEntity == null || NodeName == null)
|
2021-10-25 16:21:56 +02:00
|
|
|
yield break;
|
|
|
|
|
|
2024-03-30 17:17:53 +13:00
|
|
|
var _nodeContainer = entMan.System<NodeContainerSystem>();
|
|
|
|
|
if (_nodeContainer.TryGetNode(CableEntity.Value, NodeName, out Node? node))
|
2021-10-25 16:21:56 +02:00
|
|
|
yield return node;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|