Reduce node resolves (#6435)

This commit is contained in:
Leon Friedrich
2022-02-07 01:10:33 +13:00
committed by GitHub
parent b82926e324
commit 1e10314900
12 changed files with 195 additions and 147 deletions

View File

@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Nodes;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Electrocution
@@ -16,10 +15,13 @@ namespace Content.Server.Electrocution
[DataField("node")]
public string NodeName = default!;
public override IEnumerable<Node> GetReachableNodes()
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
IEntityManager entMan)
{
var ent = IoCManager.Resolve<IEntityManager>();
if (!ent.TryGetComponent(CableEntity, out NodeContainerComponent? nodeContainer))
if (!nodeQuery.TryGetComponent(CableEntity, out var nodeContainer))
yield break;
if (nodeContainer.TryGetNode(NodeName, out Node? node))