Content side for removing IMap / IMapGrid comps (#12357)

This commit is contained in:
metalgearsloth
2022-11-04 10:12:25 +11:00
committed by GitHub
parent 6d297fbb62
commit c0abea8047
30 changed files with 58 additions and 58 deletions

View File

@@ -42,8 +42,8 @@ public sealed partial class ObjectsTab : Control
var entities = selection switch var entities = selection switch
{ {
ObjectsTabSelection.Stations => _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations.ToList(), ObjectsTabSelection.Stations => _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations.ToList(),
ObjectsTabSelection.Grids => _entityManager.EntityQuery<IMapGridComponent>(true).Select(x => x.Owner).ToList(), ObjectsTabSelection.Grids => _entityManager.EntityQuery<MapGridComponent>(true).Select(x => x.Owner).ToList(),
ObjectsTabSelection.Maps => _entityManager.EntityQuery<IMapComponent>(true).Select(x => x.Owner).ToList(), ObjectsTabSelection.Maps => _entityManager.EntityQuery<MapComponent>(true).Select(x => x.Owner).ToList(),
_ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null) _ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null)
}; };

View File

@@ -32,7 +32,7 @@ public sealed class VariantizeCommand : IConsoleCommand
return; return;
} }
if (!entMan.TryGetComponent(euid, out IMapGridComponent? gridComp)) if (!entMan.TryGetComponent(euid, out MapGridComponent? gridComp))
{ {
shell.WriteError($"Euid '{euid}' does not exist or is not a grid."); shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return; return;

View File

@@ -87,7 +87,7 @@ public sealed partial class AdminVerbSystem
return; return;
// 1984. // 1984.
if (HasComp<IMapComponent>(args.Target) || HasComp<IMapGridComponent>(args.Target)) if (HasComp<MapComponent>(args.Target) || HasComp<MapGridComponent>(args.Target))
return; return;
Verb explode = new() Verb explode = new()

View File

@@ -687,7 +687,7 @@ public sealed partial class AdminVerbSystem
args.Verbs.Add(haltMovement); args.Verbs.Add(haltMovement);
} }
if (TryComp<IMapComponent>(args.Target, out var map)) if (TryComp<MapComponent>(args.Target, out var map))
{ {
if (_adminManager.HasAdminFlag(player, AdminFlags.Mapping)) if (_adminManager.HasAdminFlag(player, AdminFlags.Mapping))
{ {
@@ -800,7 +800,7 @@ public sealed partial class AdminVerbSystem
private bool TryGetGridChildren(EntityUid target, [NotNullWhen(true)] out IEnumerable<EntityUid>? enumerator) private bool TryGetGridChildren(EntityUid target, [NotNullWhen(true)] out IEnumerable<EntityUid>? enumerator)
{ {
if (!HasComp<IMapComponent>(target) && !HasComp<IMapGridComponent>(target) && if (!HasComp<MapComponent>(target) && !HasComp<MapGridComponent>(target) &&
!HasComp<StationDataComponent>(target)) !HasComp<StationDataComponent>(target))
{ {
enumerator = null; enumerator = null;
@@ -827,7 +827,7 @@ public sealed partial class AdminVerbSystem
yield break; yield break;
} }
else if (HasComp<IMapComponent>(target)) else if (HasComp<MapComponent>(target))
{ {
foreach (var possibleGrid in Transform(target).ChildEntities) foreach (var possibleGrid in Transform(target).ChildEntities)
{ {

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Commands
return; return;
} }
if (!entMan.HasComponent<IMapGridComponent>(euid)) if (!entMan.HasComponent<MapGridComponent>(euid))
{ {
shell.WriteError($"Euid '{euid}' does not exist or is not a grid."); shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return; return;

View File

@@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Commands
|| !float.TryParse(args[4], out var moles)) return; || !float.TryParse(args[4], out var moles)) return;
var entMan = IoCManager.Resolve<IEntityManager>(); var entMan = IoCManager.Resolve<IEntityManager>();
if (!entMan.HasComponent<IMapGridComponent>(euid)) if (!entMan.HasComponent<MapGridComponent>(euid))
{ {
shell.WriteError($"Euid '{euid}' does not exist or is not a grid."); shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return; return;

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Atmos.EntitySystems
{ {
var xform = Transform(uid); var xform = Transform(uid);
if (!TryComp(xform.GridUid, out IMapGridComponent? grid)) if (!TryComp(xform.GridUid, out MapGridComponent? grid))
return; return;
var gridId = xform.GridUid; var gridId = xform.GridUid;

View File

@@ -121,7 +121,7 @@ public partial class AtmosphereSystem
return ev.Result; return ev.Result;
} }
public bool IsTileAirBlocked(EntityUid gridUid, Vector2i tile, AtmosDirection directions = AtmosDirection.All, IMapGridComponent? mapGridComp = null) public bool IsTileAirBlocked(EntityUid gridUid, Vector2i tile, AtmosDirection directions = AtmosDirection.All, MapGridComponent? mapGridComp = null)
{ {
var ev = new IsTileAirBlockedMethodEvent(gridUid, tile, directions, mapGridComp); var ev = new IsTileAirBlockedMethodEvent(gridUid, tile, directions, mapGridComp);
RaiseLocalEvent(gridUid, ref ev); RaiseLocalEvent(gridUid, ref ev);
@@ -130,7 +130,7 @@ public partial class AtmosphereSystem
return ev.Result; return ev.Result;
} }
public bool IsTileSpace(EntityUid? gridUid, EntityUid? mapUid, Vector2i tile, IMapGridComponent? mapGridComp = null) public bool IsTileSpace(EntityUid? gridUid, EntityUid? mapUid, Vector2i tile, MapGridComponent? mapGridComp = null)
{ {
var ev = new IsTileSpaceMethodEvent(gridUid, mapUid, tile, mapGridComp); var ev = new IsTileSpaceMethodEvent(gridUid, mapUid, tile, mapGridComp);
@@ -178,7 +178,7 @@ public partial class AtmosphereSystem
return ev.Result ?? Enumerable.Empty<GasMixture>(); return ev.Result ?? Enumerable.Empty<GasMixture>();
} }
public void UpdateAdjacent(EntityUid gridUid, Vector2i tile, IMapGridComponent? mapGridComp = null) public void UpdateAdjacent(EntityUid gridUid, Vector2i tile, MapGridComponent? mapGridComp = null)
{ {
var ev = new UpdateAdjacentMethodEvent(gridUid, tile, mapGridComp); var ev = new UpdateAdjacentMethodEvent(gridUid, tile, mapGridComp);
RaiseLocalEvent(gridUid, ref ev); RaiseLocalEvent(gridUid, ref ev);
@@ -263,10 +263,10 @@ public partial class AtmosphereSystem
(EntityUid GridId, Vector2i Tile, ReactionResult Result = default, bool Handled = false); (EntityUid GridId, Vector2i Tile, ReactionResult Result = default, bool Handled = false);
[ByRefEvent] private record struct IsTileAirBlockedMethodEvent [ByRefEvent] private record struct IsTileAirBlockedMethodEvent
(EntityUid Grid, Vector2i Tile, AtmosDirection Direction = AtmosDirection.All, IMapGridComponent? MapGridComponent = null, bool Result = false, bool Handled = false); (EntityUid Grid, Vector2i Tile, AtmosDirection Direction = AtmosDirection.All, MapGridComponent? MapGridComponent = null, bool Result = false, bool Handled = false);
[ByRefEvent] private record struct IsTileSpaceMethodEvent [ByRefEvent] private record struct IsTileSpaceMethodEvent
(EntityUid? Grid, EntityUid? Map, Vector2i Tile, IMapGridComponent? MapGridComponent = null, bool Result = true, bool Handled = false); (EntityUid? Grid, EntityUid? Map, Vector2i Tile, MapGridComponent? MapGridComponent = null, bool Result = true, bool Handled = false);
[ByRefEvent] private record struct GetAdjacentTilesMethodEvent [ByRefEvent] private record struct GetAdjacentTilesMethodEvent
(EntityUid Grid, Vector2i Tile, IEnumerable<Vector2i>? Result = null, bool Handled = false); (EntityUid Grid, Vector2i Tile, IEnumerable<Vector2i>? Result = null, bool Handled = false);
@@ -276,7 +276,7 @@ public partial class AtmosphereSystem
IEnumerable<GasMixture>? Result = null, bool Handled = false); IEnumerable<GasMixture>? Result = null, bool Handled = false);
[ByRefEvent] private record struct UpdateAdjacentMethodEvent [ByRefEvent] private record struct UpdateAdjacentMethodEvent
(EntityUid Grid, Vector2i Tile, IMapGridComponent? MapGridComponent = null, bool Handled = false); (EntityUid Grid, Vector2i Tile, MapGridComponent? MapGridComponent = null, bool Handled = false);
[ByRefEvent] private record struct HotspotExposeMethodEvent [ByRefEvent] private record struct HotspotExposeMethodEvent
(EntityUid Grid, Vector2i Tile, float ExposedTemperature, float ExposedVolume, bool soh, bool Handled = false); (EntityUid Grid, Vector2i Tile, float ExposedTemperature, float ExposedVolume, bool soh, bool Handled = false);

View File

@@ -72,7 +72,7 @@ public sealed partial class AtmosphereSystem
return; return;
} }
if (!TryComp(euid, out IMapGridComponent? gridComp)) if (!TryComp(euid, out MapGridComponent? gridComp))
{ {
shell.WriteError($"Euid '{euid}' does not exist or is not a grid."); shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return; return;

View File

@@ -43,7 +43,7 @@ public sealed partial class AtmosphereSystem
{ {
base.Initialize(); base.Initialize();
if (!TryComp(uid, out IMapGridComponent? mapGrid)) if (!TryComp(uid, out MapGridComponent? mapGrid))
return; return;
foreach (var (indices, tile) in gridAtmosphere.Tiles) foreach (var (indices, tile) in gridAtmosphere.Tiles)
@@ -324,7 +324,7 @@ public sealed partial class AtmosphereSystem
adjacent.BlockedAirflow = GetBlockedDirections(mapGridComp.Grid, adjacent.GridIndices); adjacent.BlockedAirflow = GetBlockedDirections(mapGridComp.Grid, adjacent.GridIndices);
// Pass in IMapGridComponent so we don't have to resolve it for every adjacent direction. // Pass in MapGridComponent so we don't have to resolve it for every adjacent direction.
var tileBlockedEv = new IsTileAirBlockedMethodEvent(uid, tile.GridIndices, direction, mapGridComp); var tileBlockedEv = new IsTileAirBlockedMethodEvent(uid, tile.GridIndices, direction, mapGridComp);
GridIsTileAirBlocked(uid, component, ref tileBlockedEv); GridIsTileAirBlocked(uid, component, ref tileBlockedEv);
@@ -418,7 +418,7 @@ public sealed partial class AtmosphereSystem
if (!adjEv.Handled || !component.Tiles.TryGetValue(args.Tile, out var tile)) if (!adjEv.Handled || !component.Tiles.TryGetValue(args.Tile, out var tile))
return; return;
if (!TryComp<IMapGridComponent>(uid, out var mapGridComp)) if (!TryComp<MapGridComponent>(uid, out var mapGridComp))
return; return;
var adjacent = adjEv.Result!.ToArray(); var adjacent = adjEv.Result!.ToArray();

View File

@@ -45,7 +45,7 @@ namespace Content.Server.Atmos.EntitySystems
var uid = atmosphere.Owner; var uid = atmosphere.Owner;
if (!TryComp(uid, out IMapGridComponent? mapGridComp)) if (!TryComp(uid, out MapGridComponent? mapGridComp))
return true; return true;
var mapGrid = mapGridComp.Grid; var mapGrid = mapGridComp.Grid;
@@ -161,7 +161,7 @@ namespace Content.Server.Atmos.EntitySystems
var uid = atmosphere.Owner; var uid = atmosphere.Owner;
if (!TryComp(uid, out IMapGridComponent? mapGridComp)) if (!TryComp(uid, out MapGridComponent? mapGridComp))
throw new Exception("Tried to process a grid atmosphere on an entity that isn't a grid!"); throw new Exception("Tried to process a grid atmosphere on an entity that isn't a grid!");
var mapGrid = mapGridComp.Grid; var mapGrid = mapGridComp.Grid;

View File

@@ -402,7 +402,7 @@ public sealed partial class CargoSystem
} }
var offset = 0f; var offset = 0f;
if (TryComp<IMapGridComponent>(orderDatabase.Shuttle, out var shuttleGrid)) if (TryComp<MapGridComponent>(orderDatabase.Shuttle, out var shuttleGrid))
{ {
var bounds = shuttleGrid.Grid.LocalAABB; var bounds = shuttleGrid.Grid.LocalAABB;
offset = MathF.Max(bounds.Width, bounds.Height) / 2f; offset = MathF.Max(bounds.Width, bounds.Height) / 2f;

View File

@@ -70,7 +70,7 @@ namespace Content.Server.Chemistry.Components
var xform = _entities.GetComponent<TransformComponent>(Owner); var xform = _entities.GetComponent<TransformComponent>(Owner);
var solSys = _systems.GetEntitySystem<SolutionContainerSystem>(); var solSys = _systems.GetEntitySystem<SolutionContainerSystem>();
if (!_entities.TryGetComponent(xform.GridUid, out IMapGridComponent? gridComp)) if (!_entities.TryGetComponent(xform.GridUid, out MapGridComponent? gridComp))
return; return;
var grid = gridComp.Grid; var grid = gridComp.Grid;

View File

@@ -105,7 +105,7 @@ namespace Content.Server.Chemistry.EntitySystems
vapor.ReactTimer += frameTime; vapor.ReactTimer += frameTime;
if (vapor.ReactTimer >= ReactTime && TryComp(xform.GridUid, out IMapGridComponent? gridComp)) if (vapor.ReactTimer >= ReactTime && TryComp(xform.GridUid, out MapGridComponent? gridComp))
{ {
vapor.ReactTimer = 0; vapor.ReactTimer = 0;

View File

@@ -511,7 +511,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
} }
var xform = Transform(component.Owner); var xform = Transform(component.Owner);
if (!TryComp(xform.GridUid, out IMapGridComponent? grid)) if (!TryComp(xform.GridUid, out MapGridComponent? grid))
return false; return false;
var coords = xform.Coordinates; var coords = xform.Coordinates;

View File

@@ -29,7 +29,7 @@ public sealed partial class DragonSystem
public override void Started() public override void Started()
{ {
var spawnLocations = EntityManager.EntityQuery<IMapGridComponent, TransformComponent>().ToList(); var spawnLocations = EntityManager.EntityQuery<MapGridComponent, TransformComponent>().ToList();
if (spawnLocations.Count == 0) if (spawnLocations.Count == 0)
return; return;

View File

@@ -212,7 +212,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
var susLoot = _prototypeManager.Index<EntityLootTablePrototype>(SuspicionLootTable); var susLoot = _prototypeManager.Index<EntityLootTablePrototype>(SuspicionLootTable);
foreach (var (_, mapGrid) in EntityManager.EntityQuery<StationMemberComponent, IMapGridComponent>(true)) foreach (var (_, mapGrid) in EntityManager.EntityQuery<StationMemberComponent, MapGridComponent>(true))
{ {
// I'm so sorry. // I'm so sorry.
var tiles = mapGrid.Grid.GetAllTiles().ToArray(); var tiles = mapGrid.Grid.GetAllTiles().ToArray();

View File

@@ -78,7 +78,7 @@ public sealed partial class PathfindingSystem
{ {
if (comp.DirtyChunks.Count == 0 || if (comp.DirtyChunks.Count == 0 ||
comp.NextUpdate < curTime || comp.NextUpdate < curTime ||
!TryComp<IMapGridComponent>(comp.Owner, out var mapGridComp)) !TryComp<MapGridComponent>(comp.Owner, out var mapGridComp))
{ {
continue; continue;
} }
@@ -237,7 +237,7 @@ public sealed partial class PathfindingSystem
{ {
if (!TryComp<PhysicsComponent>(ev.Sender, out var body) || if (!TryComp<PhysicsComponent>(ev.Sender, out var body) ||
body.BodyType != BodyType.Static || body.BodyType != BodyType.Static ||
HasComp<IMapGridComponent>(ev.Sender) || HasComp<MapGridComponent>(ev.Sender) ||
ev.OldPosition.Equals(ev.NewPosition)) ev.OldPosition.Equals(ev.NewPosition))
{ {
return; return;

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Objectives.Conditions
var entMan = IoCManager.Resolve<IEntityManager>(); var entMan = IoCManager.Resolve<IEntityManager>();
if (!entMan.TryGetComponent<IMapGridComponent>(shuttle, out var shuttleGrid) || if (!entMan.TryGetComponent<MapGridComponent>(shuttle, out var shuttleGrid) ||
!entMan.TryGetComponent<TransformComponent>(shuttle, out var shuttleXform)) !entMan.TryGetComponent<TransformComponent>(shuttle, out var shuttleXform))
{ {
return false; return false;

View File

@@ -342,7 +342,7 @@ namespace Content.Server.ParticleAccelerator.Components
var xform = _entMan.GetComponent<TransformComponent>(Owner); var xform = _entMan.GetComponent<TransformComponent>(Owner);
// Find fuel chamber first by scanning cardinals. // Find fuel chamber first by scanning cardinals.
if (xform.Anchored && _entMan.TryGetComponent(xform.GridUid, out IMapGridComponent? grid)) if (xform.Anchored && _entMan.TryGetComponent(xform.GridUid, out MapGridComponent? grid))
{ {
foreach (var maybeFuel in grid.Grid.GetCardinalNeighborCells(xform.Coordinates)) foreach (var maybeFuel in grid.Grid.GetCardinalNeighborCells(xform.Coordinates))
{ {

View File

@@ -102,7 +102,7 @@ public partial class RadiationSystem
// check if it's on a grid // check if it's on a grid
var trs = Transform(uid); var trs = Transform(uid);
if (!trs.Anchored || !TryComp(trs.GridUid, out IMapGridComponent? grid)) if (!trs.Anchored || !TryComp(trs.GridUid, out MapGridComponent? grid))
return; return;
// save resistance into rad protection grid // save resistance into rad protection grid

View File

@@ -24,6 +24,7 @@ public partial class RadiationSystem
var destinations = EntityQuery<RadiationReceiverComponent, TransformComponent>(); var destinations = EntityQuery<RadiationReceiverComponent, TransformComponent>();
var resistanceQuery = GetEntityQuery<RadiationGridResistanceComponent>(); var resistanceQuery = GetEntityQuery<RadiationGridResistanceComponent>();
var transformQuery = GetEntityQuery<TransformComponent>(); var transformQuery = GetEntityQuery<TransformComponent>();
var gridQuery = GetEntityQuery<MapGridComponent>();
// precalculate world positions for each source // precalculate world positions for each source
// so we won't need to calc this in cycle over and over again // so we won't need to calc this in cycle over and over again
@@ -48,7 +49,7 @@ public partial class RadiationSystem
// send ray towards destination entity // send ray towards destination entity
var ray = Irradiate(sourceTrs.Owner, sourceTrs, sourceWorld, var ray = Irradiate(sourceTrs.Owner, sourceTrs, sourceWorld,
destTrs.Owner, destTrs, destWorld, destTrs.Owner, destTrs, destWorld,
source.Intensity, source.Slope, saveVisitedTiles, resistanceQuery, transformQuery); source.Intensity, source.Slope, saveVisitedTiles, resistanceQuery, transformQuery, gridQuery);
if (ray == null) if (ray == null)
continue; continue;
@@ -86,7 +87,7 @@ public partial class RadiationSystem
EntityUid destUid, TransformComponent destTrs, Vector2 destWorld, EntityUid destUid, TransformComponent destTrs, Vector2 destWorld,
float incomingRads, float slope, bool saveVisitedTiles, float incomingRads, float slope, bool saveVisitedTiles,
EntityQuery<RadiationGridResistanceComponent> resistanceQuery, EntityQuery<RadiationGridResistanceComponent> resistanceQuery,
EntityQuery<TransformComponent> transformQuery) EntityQuery<TransformComponent> transformQuery, EntityQuery<MapGridComponent> gridQuery)
{ {
// lets first check that source and destination on the same map // lets first check that source and destination on the same map
if (sourceTrs.MapID != destTrs.MapID) if (sourceTrs.MapID != destTrs.MapID)
@@ -115,8 +116,7 @@ public partial class RadiationSystem
// however we can do simplification and ignore that case // however we can do simplification and ignore that case
if (GridcastSimplifiedSameGrid && sourceTrs.GridUid != null && sourceTrs.GridUid == destTrs.GridUid) if (GridcastSimplifiedSameGrid && sourceTrs.GridUid != null && sourceTrs.GridUid == destTrs.GridUid)
{ {
// todo: entity queries doesn't support interface - use it when IMapGridComponent will be removed if (!gridQuery.TryGetComponent(sourceTrs.GridUid.Value, out var gridComponent))
if (!TryComp(sourceTrs.GridUid.Value, out IMapGridComponent? gridComponent))
return ray; return ray;
return Gridcast(gridComponent.Grid, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(sourceTrs.GridUid.Value)); return Gridcast(gridComponent.Grid, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(sourceTrs.GridUid.Value));
} }

View File

@@ -112,7 +112,7 @@ public sealed partial class ShuttleSystem
/// <summary> /// <summary>
/// Checks whether the emergency shuttle can warp to the specified position. /// Checks whether the emergency shuttle can warp to the specified position.
/// </summary> /// </summary>
private bool ValidSpawn(IMapGridComponent grid, Box2 area) private bool ValidSpawn(MapGridComponent grid, Box2 area)
{ {
return !grid.Grid.GetLocalTilesIntersecting(area).Any(); return !grid.Grid.GetLocalTilesIntersecting(area).Any();
} }
@@ -124,13 +124,13 @@ public sealed partial class ShuttleSystem
if (gridDocks.Count <= 0) return null; if (gridDocks.Count <= 0) return null;
var xformQuery = GetEntityQuery<TransformComponent>(); var xformQuery = GetEntityQuery<TransformComponent>();
var targetGridGrid = Comp<IMapGridComponent>(targetGrid); var targetGridGrid = Comp<MapGridComponent>(targetGrid);
var targetGridXform = xformQuery.GetComponent(targetGrid); var targetGridXform = xformQuery.GetComponent(targetGrid);
var targetGridAngle = targetGridXform.WorldRotation.Reduced(); var targetGridAngle = targetGridXform.WorldRotation.Reduced();
var targetGridRotation = targetGridAngle.ToVec(); var targetGridRotation = targetGridAngle.ToVec();
var shuttleDocks = GetDocks(component.Owner); var shuttleDocks = GetDocks(component.Owner);
var shuttleAABB = Comp<IMapGridComponent>(component.Owner).Grid.LocalAABB; var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
var validDockConfigs = new List<DockingConfig>(); var validDockConfigs = new List<DockingConfig>();
@@ -310,7 +310,7 @@ public sealed partial class ShuttleSystem
TransformComponent gridXform, TransformComponent gridXform,
Vector2 targetGridRotation, Vector2 targetGridRotation,
Box2 shuttleAABB, Box2 shuttleAABB,
IMapGridComponent grid, MapGridComponent grid,
[NotNullWhen(true)] out Box2? shuttleDockedAABB, [NotNullWhen(true)] out Box2? shuttleDockedAABB,
out Matrix3 matty, out Matrix3 matty,
out Vector2 gridRotation) out Vector2 gridRotation)

View File

@@ -89,7 +89,7 @@ public sealed partial class ShuttleSystem
{ {
reason = null; reason = null;
if (!TryComp<IMapGridComponent>(uid, out var grid) || if (!TryComp<MapGridComponent>(uid, out var grid) ||
!Resolve(uid.Value, ref xform)) !Resolve(uid.Value, ref xform))
{ {
return true; return true;
@@ -226,7 +226,7 @@ public sealed partial class ShuttleSystem
comp.State = FTLState.Travelling; comp.State = FTLState.Travelling;
var width = Comp<IMapGridComponent>(comp.Owner).Grid.LocalAABB.Width; var width = Comp<MapGridComponent>(comp.Owner).Grid.LocalAABB.Width;
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f)); xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
xform.LocalRotation = Angle.Zero; xform.LocalRotation = Angle.Zero;
_index += width + Buffer; _index += width + Buffer;
@@ -458,13 +458,13 @@ public sealed partial class ShuttleSystem
} }
var xformQuery = GetEntityQuery<TransformComponent>(); var xformQuery = GetEntityQuery<TransformComponent>();
var shuttleAABB = Comp<IMapGridComponent>(component.Owner).Grid.LocalAABB; var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
// Spawn nearby. // Spawn nearby.
// We essentially expand the Box2 of the target area until nothing else is added then we know it's valid. // We essentially expand the Box2 of the target area until nothing else is added then we know it's valid.
// Can't just get an AABB of every grid as we may spawn very far away. // Can't just get an AABB of every grid as we may spawn very far away.
var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery) var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery)
.TransformBox(Comp<IMapGridComponent>(targetUid).Grid.LocalAABB).Enlarged(shuttleAABB.Size.Length); .TransformBox(Comp<MapGridComponent>(targetUid).Grid.LocalAABB).Enlarged(shuttleAABB.Size.Length);
var nearbyGrids = new HashSet<EntityUid>(1) { targetUid }; var nearbyGrids = new HashSet<EntityUid>(1) { targetUid };
var iteration = 0; var iteration = 0;
@@ -478,7 +478,7 @@ public sealed partial class ShuttleSystem
if (!nearbyGrids.Add(grid.GridEntityId)) continue; if (!nearbyGrids.Add(grid.GridEntityId)) continue;
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery) targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
.TransformBox(Comp<IMapGridComponent>(grid.GridEntityId).Grid.LocalAABB)); .TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
} }
// Can do proximity // Can do proximity
@@ -501,7 +501,7 @@ public sealed partial class ShuttleSystem
if (nearbyGrids.Contains(grid.GridEntityId)) continue; if (nearbyGrids.Contains(grid.GridEntityId)) continue;
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery) targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
.TransformBox(Comp<IMapGridComponent>(grid.GridEntityId).Grid.LocalAABB)); .TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
} }
break; break;

View File

@@ -102,7 +102,7 @@ namespace Content.Server.Shuttles.Systems
private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args) private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args)
{ {
if (!EntityManager.HasComponent<IMapGridComponent>(component.Owner)) if (!EntityManager.HasComponent<MapGridComponent>(component.Owner))
{ {
return; return;
} }

View File

@@ -130,7 +130,7 @@ namespace Content.Server.Singularity.EntitySystems
private bool CanDestroy(SharedSingularityComponent component, EntityUid entity) private bool CanDestroy(SharedSingularityComponent component, EntityUid entity)
{ {
return entity != component.Owner && return entity != component.Owner &&
!EntityManager.HasComponent<IMapGridComponent>(entity) && !EntityManager.HasComponent<MapGridComponent>(entity) &&
!EntityManager.HasComponent<GhostComponent>(entity) && !EntityManager.HasComponent<GhostComponent>(entity) &&
!EntityManager.HasComponent<StationDataComponent>(entity) && // these SHOULD be in null-space... but just in case. Also, maybe someone moves a singularity there.. !EntityManager.HasComponent<StationDataComponent>(entity) && // these SHOULD be in null-space... but just in case. Also, maybe someone moves a singularity there..
(component.Level > 4 || (component.Level > 4 ||
@@ -180,7 +180,7 @@ namespace Content.Server.Singularity.EntitySystems
private bool CanPull(EntityUid entity) private bool CanPull(EntityUid entity)
{ {
return !(EntityManager.HasComponent<GhostComponent>(entity) || return !(EntityManager.HasComponent<GhostComponent>(entity) ||
EntityManager.HasComponent<IMapGridComponent>(entity) || EntityManager.HasComponent<MapGridComponent>(entity) ||
EntityManager.HasComponent<MapComponent>(entity) || EntityManager.HasComponent<MapComponent>(entity) ||
EntityManager.HasComponent<ServerSingularityComponent>(entity) || EntityManager.HasComponent<ServerSingularityComponent>(entity) ||
_container.IsEntityInContainer(entity)); _container.IsEntityInContainer(entity));

View File

@@ -242,7 +242,7 @@ public sealed class StationSystem : EntitySystem
foreach (var gridUid in component.Grids) foreach (var gridUid in component.Grids)
{ {
if (!TryComp<IMapGridComponent>(gridUid, out var grid) || if (!TryComp<MapGridComponent>(gridUid, out var grid) ||
grid.Grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared) grid.Grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared)
continue; continue;
@@ -385,7 +385,7 @@ public sealed class StationSystem : EntitySystem
/// <param name="stationData">Resolve pattern, station data component of station.</param> /// <param name="stationData">Resolve pattern, station data component of station.</param>
/// <param name="name">The name to assign to the grid if any.</param> /// <param name="name">The name to assign to the grid if any.</param>
/// <exception cref="ArgumentException">Thrown when mapGrid or station are not a grid or station, respectively.</exception> /// <exception cref="ArgumentException">Thrown when mapGrid or station are not a grid or station, respectively.</exception>
public void AddGridToStation(EntityUid station, EntityUid mapGrid, IMapGridComponent? gridComponent = null, StationDataComponent? stationData = null, string? name = null) public void AddGridToStation(EntityUid station, EntityUid mapGrid, MapGridComponent? gridComponent = null, StationDataComponent? stationData = null, string? name = null)
{ {
if (!Resolve(mapGrid, ref gridComponent)) if (!Resolve(mapGrid, ref gridComponent))
throw new ArgumentException("Tried to initialize a station on a non-grid entity!", nameof(mapGrid)); throw new ArgumentException("Tried to initialize a station on a non-grid entity!", nameof(mapGrid));
@@ -412,7 +412,7 @@ public sealed class StationSystem : EntitySystem
/// <param name="gridComponent">Resolve pattern, grid component of mapGrid.</param> /// <param name="gridComponent">Resolve pattern, grid component of mapGrid.</param>
/// <param name="stationData">Resolve pattern, station data component of station.</param> /// <param name="stationData">Resolve pattern, station data component of station.</param>
/// <exception cref="ArgumentException">Thrown when mapGrid or station are not a grid or station, respectively.</exception> /// <exception cref="ArgumentException">Thrown when mapGrid or station are not a grid or station, respectively.</exception>
public void RemoveGridFromStation(EntityUid station, EntityUid mapGrid, IMapGridComponent? gridComponent = null, StationDataComponent? stationData = null) public void RemoveGridFromStation(EntityUid station, EntityUid mapGrid, MapGridComponent? gridComponent = null, StationDataComponent? stationData = null)
{ {
if (!Resolve(mapGrid, ref gridComponent)) if (!Resolve(mapGrid, ref gridComponent))
throw new ArgumentException("Tried to initialize a station on a non-grid entity!", nameof(mapGrid)); throw new ArgumentException("Tried to initialize a station on a non-grid entity!", nameof(mapGrid));
@@ -487,7 +487,7 @@ public sealed class StationSystem : EntitySystem
return entity; return entity;
} }
if (TryComp<IMapGridComponent>(entity, out _)) if (TryComp<MapGridComponent>(entity, out _))
{ {
// We are the station, just check ourselves. // We are the station, just check ourselves.
return CompOrNull<StationMemberComponent>(entity)?.Station; return CompOrNull<StationMemberComponent>(entity)?.Station;

View File

@@ -145,7 +145,7 @@ namespace Content.Server.StationEvents.Events
targetGrid = RobustRandom.Pick(possibleTargets); targetGrid = RobustRandom.Pick(possibleTargets);
if (!TryComp<IMapGridComponent>(targetGrid, out var gridComp)) if (!TryComp<MapGridComponent>(targetGrid, out var gridComp))
return false; return false;
var grid = gridComp.Grid; var grid = gridComp.Grid;

View File

@@ -49,7 +49,7 @@ namespace Content.Server.Tabletop
TabletopMap = _mapManager.CreateMap(); TabletopMap = _mapManager.CreateMap();
_tabletops = 0; _tabletops = 0;
var mapComp = EntityManager.GetComponent<IMapComponent>(_mapManager.GetMapEntityId(TabletopMap)); var mapComp = EntityManager.GetComponent<MapComponent>(_mapManager.GetMapEntityId(TabletopMap));
// Lighting is always disabled in tabletop world. // Lighting is always disabled in tabletop world.
mapComp.LightingEnabled = false; mapComp.LightingEnabled = false;

View File

@@ -65,7 +65,7 @@ namespace Content.Shared.Singularity
var otherUid = args.BodyB.Owner; var otherUid = args.BodyB.Owner;
// For prediction reasons always want the client to ignore these. // For prediction reasons always want the client to ignore these.
if (EntityManager.HasComponent<IMapGridComponent>(otherUid) || if (EntityManager.HasComponent<MapGridComponent>(otherUid) ||
EntityManager.HasComponent<SharedGhostComponent>(otherUid)) EntityManager.HasComponent<SharedGhostComponent>(otherUid))
{ {
args.Cancelled = true; args.Cancelled = true;