Inline Transform
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -76,7 +77,7 @@ namespace Content.Server.NodeContainer.NodeGroups
|
||||
public virtual void Initialize(Node sourceNode)
|
||||
{
|
||||
// TODO: Can we get rid of this GridId?
|
||||
GridId = sourceNode.Owner.Transform.GridID;
|
||||
GridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sourceNode.Owner.Uid).GridID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes()
|
||||
{
|
||||
if (!Owner.Transform.Anchored)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||
yield break;
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var grid = IoCManager.Resolve<IMapManager>().GetGrid(Owner.Transform.GridID);
|
||||
var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates);
|
||||
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
|
||||
var gridIndex = grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||
|
||||
foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex))
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
/// </summary>
|
||||
public bool Connectable => !Deleting && Anchored;
|
||||
|
||||
protected bool Anchored => !NeedAnchored || Owner.Transform.Anchored;
|
||||
protected bool Anchored => !NeedAnchored || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("needAnchored")]
|
||||
|
||||
@@ -166,11 +166,11 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
/// </summary>
|
||||
protected IEnumerable<PipeNode> PipesInDirection(PipeDirection pipeDir)
|
||||
{
|
||||
if (!Owner.Transform.Anchored)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||
yield break;
|
||||
|
||||
var grid = IoCManager.Resolve<IMapManager>().GetGrid(Owner.Transform.GridID);
|
||||
var position = Owner.Transform.Coordinates;
|
||||
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
|
||||
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||
foreach (var entity in grid.GetInDir(position, pipeDir.ToDirection()))
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<NodeContainerComponent>(entity, out var container))
|
||||
@@ -189,11 +189,11 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
/// </summary>
|
||||
protected IEnumerable<PipeNode> PipesInTile()
|
||||
{
|
||||
if (!Owner.Transform.Anchored)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||
yield break;
|
||||
|
||||
var grid = IoCManager.Resolve<IMapManager>().GetGrid(Owner.Transform.GridID);
|
||||
var position = Owner.Transform.Coordinates;
|
||||
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
|
||||
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||
foreach (var entity in grid.GetLocal(position))
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<NodeContainerComponent>(entity, out var container))
|
||||
@@ -215,7 +215,7 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
{
|
||||
if (RotationsEnabled)
|
||||
{
|
||||
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(Owner.Transform.LocalRotation);
|
||||
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).LocalRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user