diff --git a/Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs index 3ef44f1caf..419be50c42 100644 --- a/Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs @@ -48,9 +48,9 @@ namespace Content.Client.Atmos.EntitySystems private void OnGridRemoved(GridRemovalEvent ev) { - if (_tileData.ContainsKey(ev.GridId)) + if (_tileData.ContainsKey(ev.EntityUid)) { - _tileData.Remove(ev.GridId); + _tileData.Remove(ev.EntityUid); } } diff --git a/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs index 0618f0c9e0..b45836a437 100644 --- a/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -123,10 +123,7 @@ namespace Content.Client.Atmos.EntitySystems private void OnGridRemoved(GridRemovalEvent ev) { - if (_tileData.ContainsKey(ev.GridId)) - { - _tileData.Remove(ev.GridId); - } + _tileData.Remove(ev.EntityUid); } public bool HasData(EntityUid gridId) diff --git a/Content.Client/Decals/DecalSystem.cs b/Content.Client/Decals/DecalSystem.cs index 4bf7baee12..94827e3368 100644 --- a/Content.Client/Decals/DecalSystem.cs +++ b/Content.Client/Decals/DecalSystem.cs @@ -40,14 +40,14 @@ namespace Content.Client.Decals private void OnGridRemoval(GridRemovalEvent ev) { - DecalRenderIndex.Remove(ev.GridId); - DecalZIndexIndex.Remove(ev.GridId); + DecalRenderIndex.Remove(ev.EntityUid); + DecalZIndexIndex.Remove(ev.EntityUid); } private void OnGridInitialize(GridInitializeEvent ev) { - DecalRenderIndex[ev.GridId] = new(); - DecalZIndexIndex[ev.GridId] = new(); + DecalRenderIndex[ev.EntityUid] = new(); + DecalZIndexIndex[ev.EntityUid] = new(); } public override void Shutdown() diff --git a/Content.Client/Shuttles/UI/RadarControl.cs b/Content.Client/Shuttles/UI/RadarControl.cs index 23156e20de..db7a79d97f 100644 --- a/Content.Client/Shuttles/UI/RadarControl.cs +++ b/Content.Client/Shuttles/UI/RadarControl.cs @@ -187,7 +187,7 @@ public sealed class RadarControl : Control foreach (var grid in _mapManager.FindGridsIntersecting(mapPosition.MapId, new Box2(mapPosition.Position - RadarRange, mapPosition.Position + RadarRange))) { - if (grid.Index == ourGridId) continue; + if (grid.GridEntityId == ourGridId) continue; var gridBody = bodyQuery.GetComponent(grid.GridEntityId); if (gridBody.Mass < 10f) diff --git a/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs b/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs index 7a282dcd4e..256a41e902 100644 --- a/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs @@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests { // TODO: Properly find the "main" station grid. var grid0 = mapManager.GetAllGrids().First(); - mapLoader.SaveBlueprint(grid0.Index, "save load save 1.yml"); + mapLoader.SaveBlueprint(grid0.GridEntityId, "save load save 1.yml"); var mapId = mapManager.CreateMap(); var grid = mapLoader.LoadBlueprint(mapId, "save load save 1.yml").gridId; mapLoader.SaveBlueprint(grid!.Value, "save load save 2.yml"); diff --git a/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs index 823c2f0d94..86a08855d6 100644 --- a/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -97,7 +97,7 @@ namespace Content.Server.AI.Pathfinding.Accessible private void GridRemoved(GridRemovalEvent ev) { - _regions.Remove(ev.GridId); + _regions.Remove(ev.EntityUid); } public override void Update(float frameTime) diff --git a/Content.Server/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs b/Content.Server/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs index 6107c0c4ec..67f72414ea 100644 --- a/Content.Server/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs +++ b/Content.Server/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs @@ -47,7 +47,7 @@ namespace Content.Server.AI.Pathfinding.Pathfinders return null; } - if (_entityManager.Deleted(_pathfindingArgs.Start.GridIndex)) + if (_entityManager.Deleted(_pathfindingArgs.Start.GridUid)) return null; var frontier = new PriorityQueue>(new PathfindingComparer()); diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index ce91b47c29..8ae2049cc0 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -71,7 +71,7 @@ namespace Content.Server.Atmos.EntitySystems private void OnAirtightReAnchor(EntityUid uid, AirtightComponent airtight, ref ReAnchorEvent args) { - foreach (var gridId in new[] { args.OldGrid, args.GridId }) + foreach (var gridId in new[] { args.OldGrid, args.Grid }) { // Update and invalidate new position. airtight.LastPosition = (gridId, args.TilePos); diff --git a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs index 58a30c2417..ea647ef698 100644 --- a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -109,10 +109,7 @@ namespace Content.Server.Atmos.EntitySystems private void OnGridRemoved(GridRemovalEvent ev) { - if (_overlay.ContainsKey(ev.GridId)) - { - _overlay.Remove(ev.GridId); - } + _overlay.Remove(ev.EntityUid); } private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e) diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs index dd53c1bd23..48e19acd13 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs @@ -21,7 +21,7 @@ public sealed partial class ExplosionSystem : EntitySystem var grid = _mapManager.GetGrid(ev.GridId); Dictionary edges = new(); - _gridEdges[ev.GridId] = edges; + _gridEdges[ev.EntityUid] = edges; foreach (var tileRef in grid.GetAllTiles()) { @@ -32,8 +32,8 @@ public sealed partial class ExplosionSystem : EntitySystem private void OnGridRemoved(GridRemovalEvent ev) { - _airtightMap.Remove(ev.GridId); - _gridEdges.Remove(ev.GridId); + _airtightMap.Remove(ev.EntityUid); + _gridEdges.Remove(ev.EntityUid); } /// diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index 77e1fdabe9..3c3cbb7002 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Server.CharacterAppearance.Components; using Content.Server.Chat.Managers; using Content.Server.GameTicking.Rules.Configurations; @@ -209,12 +209,12 @@ public sealed class NukeopsRuleSystem : GameRuleSystem minRadius = MathF.Max(aabb.Value.Width, aabb.Value.Height); } - var (_, gridId) = _mapLoader.LoadBlueprint(GameTicker.DefaultMap, map, new MapLoadOptions + var (_, gridUid) = _mapLoader.LoadBlueprint(GameTicker.DefaultMap, map, new MapLoadOptions { Offset = center + MathF.Max(minRadius, minRadius) + 1000f, }); - if (!gridId.HasValue) + if (!gridUid.HasValue) { Logger.ErrorS("NUKEOPS", $"Gridid was null when loading \"{map}\", aborting."); foreach (var session in operatives) @@ -224,7 +224,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem return; } - var gridUid = _mapManager.GetGridEuid(gridId.Value); // TODO: Loot table or something var commanderGear = _prototypeManager.Index("SyndicateCommanderGearFull"); var starterGear = _prototypeManager.Index("SyndicateOperativeGearFull"); @@ -244,7 +243,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem if (spawns.Count == 0) { - spawns.Add(EntityManager.GetComponent(gridUid).Coordinates); + spawns.Add(EntityManager.GetComponent(gridUid.Value).Coordinates); Logger.WarningS("nukies", $"Fell back to default spawn for nukies!"); } diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index 930cef8943..b6021674a1 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Server.Cargo.Systems; using Content.Server.Chat.Managers; using Content.Server.GameTicking.Rules.Configurations; @@ -171,7 +171,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem return; } - _pirateShip = _mapManager.GetGridEuid(gridId.Value); + _pirateShip = gridId.Value; // TODO: Loot table or something var pirateGear = _prototypeManager.Index("PirateGear"); // YARRR diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index 992bf5990b..34932543ae 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -190,8 +190,14 @@ namespace Content.Server.Salvage return; } + if (salvageTransform.GridUid == null) + { + Logger.ErrorS("salvage", "Salvage entity has no associated grid?"); + return; + } + var parentTransform = salvageTransform.Parent!; - foreach (var player in Filter.Empty().AddInGrid(salvageTransform.GridID, EntityManager).Recipients) + foreach (var player in Filter.Empty().AddInGrid(salvageTransform.GridUid.Value, EntityManager).Recipients) { if (player.AttachedEntity.HasValue) { @@ -277,18 +283,17 @@ namespace Content.Server.Salvage Offset = spl.Position }; - var (_, gridId) = _mapLoader.LoadBlueprint(spl.MapId, map.MapPath.ToString(), opts); - if (gridId == null) + var (_, salvageEntityId) = _mapLoader.LoadBlueprint(spl.MapId, map.MapPath.ToString(), opts); + if (salvageEntityId == null) { Report(component.Owner, "salvage-system-announcement-spawn-debris-disintegrated"); return false; } - var salvageEntityId = _mapManager.GetGridEuid(gridId.Value); component.AttachedEntity = salvageEntityId; - var gridcomp = EntityManager.EnsureComponent(salvageEntityId); + var gridcomp = EntityManager.EnsureComponent(salvageEntityId.Value); gridcomp.SpawnerMagnet = component; - var pulledTransform = EntityManager.GetComponent(salvageEntityId); + var pulledTransform = EntityManager.GetComponent(salvageEntityId.Value); pulledTransform.WorldRotation = spAngle; Report(component.Owner, "salvage-system-announcement-arrived", ("timeLeft", HoldTime.TotalSeconds));