Remove Explicit GridId References (#8315)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -99,7 +99,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
// Assume the docking port itself (and its body) is valid
|
||||
|
||||
if (!_mapManager.TryGetGrid(dockingXform.GridID, out var grid) ||
|
||||
if (!_mapManager.TryGetGrid(dockingXform.GridEntityId, out var grid) ||
|
||||
!HasComp<ShuttleComponent>(grid.GridEntityId)) return null;
|
||||
|
||||
var transform = body.GetTransform();
|
||||
@@ -128,7 +128,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
while (enumerator.MoveNext(out var otherGrid))
|
||||
{
|
||||
if (otherGrid.Index == dockingXform.GridID) continue;
|
||||
if (otherGrid.GridEntityId == dockingXform.GridEntityId) continue;
|
||||
|
||||
foreach (var ent in otherGrid.GetAnchoredEntities(enlargedAABB))
|
||||
{
|
||||
@@ -200,8 +200,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
dockA.DockedWith = null;
|
||||
|
||||
// If these grids are ever invalid then need to look at fixing ordering for unanchored events elsewhere.
|
||||
var gridAUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(dockA.Owner).GridID).GridEntityId;
|
||||
var gridBUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(dockB.Owner).GridID).GridEntityId;
|
||||
var gridAUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(dockA.Owner).GridEntityId).GridEntityId;
|
||||
var gridBUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(dockB.Owner).GridEntityId).GridEntityId;
|
||||
|
||||
var msg = new UndockEvent
|
||||
{
|
||||
@@ -338,8 +338,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
var dockAXform = EntityManager.GetComponent<TransformComponent>(dockA.Owner);
|
||||
var dockBXform = EntityManager.GetComponent<TransformComponent>(dockB.Owner);
|
||||
|
||||
var gridA = _mapManager.GetGrid(dockAXform.GridID).GridEntityId;
|
||||
var gridB = _mapManager.GetGrid(dockBXform.GridID).GridEntityId;
|
||||
var gridA = _mapManager.GetGrid(dockAXform.GridEntityId).GridEntityId;
|
||||
var gridB = _mapManager.GetGrid(dockBXform.GridEntityId).GridEntityId;
|
||||
|
||||
SharedJointSystem.LinearStiffness(
|
||||
2f,
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
var xform = EntityManager.GetComponent<TransformComponent>(uid);
|
||||
|
||||
// Maybe move mode onto the console instead?
|
||||
if (!_mapManager.TryGetGrid(xform.GridID, out var grid) ||
|
||||
if (!_mapManager.TryGetGrid(xform.GridEntityId, out var grid) ||
|
||||
!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttle)) return;
|
||||
|
||||
InteractionVerb verb = new()
|
||||
@@ -65,7 +65,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
if (!Resolve(consoleComponent.Owner, ref consoleXform)) return;
|
||||
|
||||
if (!consoleXform.Anchored || consoleXform.GridID != EntityManager.GetComponent<TransformComponent>(shuttleComponent.Owner).GridID) return;
|
||||
if (!consoleXform.Anchored || consoleXform.GridEntityId != EntityManager.GetComponent<TransformComponent>(shuttleComponent.Owner).GridEntityId) return;
|
||||
|
||||
switch (shuttleComponent.Mode)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed class SpaceGarbageSystem : EntitySystem
|
||||
var ourXform = Transform(args.OurFixture.Body.Owner);
|
||||
var otherXform = Transform(args.OtherFixture.Body.Owner);
|
||||
|
||||
if (ourXform.GridID == otherXform.GridID ||
|
||||
if (ourXform.GridEntityId == otherXform.GridEntityId ||
|
||||
args.OtherFixture.Body.BodyType != BodyType.Static) return;
|
||||
|
||||
QueueDel(uid);
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (e.NewTile.IsSpace(_tileDefManager) || !e.OldTile.IsSpace(_tileDefManager)) return;
|
||||
|
||||
var tilePos = e.NewTile.GridIndices;
|
||||
var grid = _mapManager.GetGrid(e.NewTile.GridIndex);
|
||||
var grid = _mapManager.GetGrid(e.NewTile.GridUid);
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var thrusterQuery = GetEntityQuery<ThrusterComponent>();
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
if (new Vector2i((int) direction.X, (int) direction.Y) != new Vector2i(x, y)) continue;
|
||||
|
||||
DisableThruster(ent.Value, thruster, xform.GridID);
|
||||
DisableThruster(ent.Value, thruster, xform.GridEntityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (!component.Enabled ||
|
||||
component.Type != ThrusterType.Linear ||
|
||||
!EntityManager.TryGetComponent(uid, out TransformComponent? xform) ||
|
||||
!_mapManager.TryGetGrid(xform.GridID, out var grid) ||
|
||||
!_mapManager.TryGetGrid(xform.GridEntityId, out var grid) ||
|
||||
!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent))
|
||||
{
|
||||
return;
|
||||
@@ -243,7 +243,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
{
|
||||
if (component.IsOn ||
|
||||
!Resolve(uid, ref xform) ||
|
||||
!_mapManager.TryGetGrid(xform.GridID, out var grid)) return;
|
||||
!_mapManager.TryGetGrid(xform.GridEntityId, out var grid)) return;
|
||||
|
||||
component.IsOn = true;
|
||||
|
||||
@@ -304,13 +304,13 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
public void DisableThruster(EntityUid uid, ThrusterComponent component, TransformComponent? xform = null, Angle? angle = null)
|
||||
{
|
||||
if (!Resolve(uid, ref xform)) return;
|
||||
DisableThruster(uid, component, xform.GridID, xform);
|
||||
DisableThruster(uid, component, xform.GridEntityId, xform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to disable the thruster.
|
||||
/// </summary>
|
||||
public void DisableThruster(EntityUid uid, ThrusterComponent component, GridId gridId, TransformComponent? xform = null, Angle? angle = null)
|
||||
public void DisableThruster(EntityUid uid, ThrusterComponent component, EntityUid gridId, TransformComponent? xform = null, Angle? angle = null)
|
||||
{
|
||||
if (!component.IsOn ||
|
||||
!Resolve(uid, ref xform) ||
|
||||
@@ -383,7 +383,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
private bool NozzleExposed(TransformComponent xform)
|
||||
{
|
||||
var (x, y) = xform.LocalPosition + xform.LocalRotation.Opposite().ToWorldVec();
|
||||
var tile = _mapManager.GetGrid(xform.GridID).GetTileRef(new Vector2i((int) Math.Floor(x), (int) Math.Floor(y)));
|
||||
var tile = _mapManager.GetGrid(xform.GridEntityId).GetTileRef(new Vector2i((int) Math.Floor(x), (int) Math.Floor(y)));
|
||||
|
||||
return tile.Tile.IsSpace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user