Inline UID

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:53:09 +01:00
parent 2654775bf0
commit 5cd42c9ad6
803 changed files with 3613 additions and 3577 deletions

View File

@@ -364,7 +364,7 @@ namespace Content.Server.NodeContainer.EntitySystems
Name = n.Name,
NetId = n.NetId,
Reachable = n.ReachableNodes.Select(r => r.NetId).ToArray(),
Entity = n.Owner.Uid,
Entity = n.Owner,
Type = n.GetType().Name
}).ToArray()
};

View File

@@ -77,7 +77,7 @@ namespace Content.Server.NodeContainer.NodeGroups
public virtual void Initialize(Node sourceNode)
{
// TODO: Can we get rid of this GridId?
GridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sourceNode.Owner.Uid).GridID;
GridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sourceNode.Owner).GridID;
}
/// <summary>

View File

@@ -14,12 +14,12 @@ namespace Content.Server.NodeContainer.Nodes
{
public override IEnumerable<Node> GetReachableNodes()
{
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored)
yield break;
var entMan = IoCManager.Resolve<IEntityManager>();
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);
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
var gridIndex = grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex))
{

View File

@@ -38,7 +38,7 @@ namespace Content.Server.NodeContainer.Nodes
/// </summary>
public bool Connectable => !Deleting && Anchored;
protected bool Anchored => !NeedAnchored || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored;
protected bool Anchored => !NeedAnchored || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("needAnchored")]

View File

@@ -166,11 +166,11 @@ namespace Content.Server.NodeContainer.Nodes
/// </summary>
protected IEnumerable<PipeNode> PipesInDirection(PipeDirection pipeDir)
{
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored)
yield break;
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).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 (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored)
yield break;
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
var grid = IoCManager.Resolve<IMapManager>().GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).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(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).LocalRotation);
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation);
}
else
{
@@ -275,8 +275,8 @@ namespace Content.Server.NodeContainer.Nodes
/// </summary>
private void UpdateAppearance()
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out NodeContainerComponent? container))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance)
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out NodeContainerComponent? container))
return;
var netConnectedDirections = PipeDirection.None;