Node network bug (#9039)

This commit is contained in:
Leon Friedrich
2022-06-24 00:21:44 +12:00
committed by GitHub
parent a63f698544
commit ad60eb770e
4 changed files with 18 additions and 17 deletions

View File

@@ -56,9 +56,6 @@ namespace Content.Server.NodeContainer.NodeGroups
[ViewVariables]
public bool Removed { get; set; } = false;
[ViewVariables]
protected EntityUid GridId { get; private set; }
/// <summary>
/// Network ID of this group for client-side debug visualization of nodes.
/// </summary>
@@ -75,12 +72,6 @@ namespace Content.Server.NodeContainer.NodeGroups
public virtual void Initialize(Node sourceNode, IEntityManager? entMan = null)
{
// TODO: Can we get rid of this GridId?
IoCManager.Resolve(ref entMan);
var xform = entMan.GetComponent<TransformComponent>(sourceNode.Owner);
DebugTools.AssertNotNull(xform.GridUid);
GridId = xform.GridUid!.Value;
}
/// <summary>

View File

@@ -22,13 +22,20 @@ namespace Content.Server.NodeContainer.NodeGroups
[ViewVariables] private AtmosphereSystem? _atmosphereSystem;
public EntityUid Grid => GridId;
public EntityUid? Grid { get; private set; }
public override void Initialize(Node sourceNode, IEntityManager? entMan = null)
{
IoCManager.Resolve(ref entMan);
base.Initialize(sourceNode, entMan);
_atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
Grid = entMan.GetComponent<TransformComponent>(sourceNode.Owner).GridUid;
if (Grid == null)
Logger.Error($"Created a pipe network without an associated grid. Pipe networks currently need to be tied to a grid for amtos to work. Source entity: {entMan.ToPrettyString(sourceNode.Owner)}");
_atmosphereSystem = entMan.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
_atmosphereSystem.AddPipeNet(this);
}