Nullable grid Uid (#8798)

This commit is contained in:
Leon Friedrich
2022-06-20 12:14:35 +12:00
committed by GitHub
parent ef41cd5aa8
commit fa4c6f63f8
82 changed files with 318 additions and 242 deletions

View File

@@ -1,6 +1,7 @@
using System.Linq;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Utility;
namespace Content.Server.NodeContainer.NodeGroups
{
@@ -19,7 +20,7 @@ namespace Content.Server.NodeContainer.NodeGroups
void Create(NodeGroupID groupId);
void Initialize(Node sourceNode);
void Initialize(Node sourceNode, IEntityManager? entMan = null);
void RemoveNode(Node node);
@@ -72,10 +73,14 @@ namespace Content.Server.NodeContainer.NodeGroups
GroupId = groupId;
}
public virtual void Initialize(Node sourceNode)
public virtual void Initialize(Node sourceNode, IEntityManager? entMan = null)
{
// TODO: Can we get rid of this GridId?
GridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sourceNode.Owner).GridEntityId;
IoCManager.Resolve(ref entMan);
var xform = entMan.GetComponent<TransformComponent>(sourceNode.Owner);
DebugTools.AssertNotNull(xform.GridUid);
GridId = xform.GridUid!.Value;
}
/// <summary>