Remove Explicit GridId References (#8315)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -44,7 +44,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var xform = Transform(uid);
|
||||
|
||||
// If the grid is deleting no point updating atmos.
|
||||
if (_mapManager.TryGetGrid(xform.GridID, out var grid))
|
||||
if (_mapManager.TryGetGrid(xform.GridEntityId, out var grid))
|
||||
{
|
||||
if (MetaData(grid.GridEntityId).EntityLifeStage > EntityLifeStage.MapInitialized) return;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
|
||||
var gridId = xform.GridID;
|
||||
var gridId = xform.GridEntityId;
|
||||
var coords = xform.Coordinates;
|
||||
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
@@ -100,15 +100,15 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
if (!Resolve(airtight.Owner, ref xform)) return;
|
||||
|
||||
if (!xform.Anchored || !xform.GridID.IsValid())
|
||||
if (!xform.Anchored || !xform.GridEntityId.IsValid())
|
||||
return;
|
||||
|
||||
var grid = _mapManager.GetGrid(xform.GridID);
|
||||
airtight.LastPosition = (xform.GridID, grid.TileIndicesFor(xform.Coordinates));
|
||||
var grid = _mapManager.GetGrid(xform.GridEntityId);
|
||||
airtight.LastPosition = (xform.GridEntityId, grid.TileIndicesFor(xform.Coordinates));
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
|
||||
}
|
||||
|
||||
public void InvalidatePosition(GridId gridId, Vector2i pos, bool fixVacuum = false)
|
||||
public void InvalidatePosition(EntityUid gridId, Vector2i pos, bool fixVacuum = false)
|
||||
{
|
||||
if (!gridId.IsValid())
|
||||
return;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.Index, baseTile, debugOverlayContent), session.ConnectedClient);
|
||||
RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.GridEntityId, baseTile, debugOverlayContent), session.ConnectedClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,26 +57,25 @@ public sealed partial class AtmosphereSystem
|
||||
mixtures[5].AdjustMoles(Gas.Plasma, Atmospherics.MolesCellGasMiner);
|
||||
mixtures[5].Temperature = 5000f;
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
foreach (var gid in args)
|
||||
{
|
||||
// I like offering detailed error messages, that's why I don't use one of the extension methods.
|
||||
if (!int.TryParse(gid, out var i) || i <= 0)
|
||||
if(EntityUid.TryParse(gid, out var euid))
|
||||
{
|
||||
shell.WriteError($"Invalid grid ID \"{gid}\".");
|
||||
continue;
|
||||
shell.WriteError($"Failed to parse euid '{gid}'.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(i);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out var mapGrid))
|
||||
if (!TryComp(euid, out IMapGridComponent? gridComp))
|
||||
{
|
||||
shell.WriteError($"Grid \"{i}\" doesn't exist.");
|
||||
continue;
|
||||
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
||||
if (!TryComp(euid, out GridAtmosphereComponent? gridAtmosphere))
|
||||
{
|
||||
shell.WriteError($"Grid \"{i}\" has no atmosphere component, try addatmos.");
|
||||
shell.WriteError($"Grid \"{euid}\" has no atmosphere component, try addatmos.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ public sealed partial class AtmosphereSystem
|
||||
|
||||
tile.Clear();
|
||||
var mixtureId = 0;
|
||||
foreach (var entUid in mapGrid.GetAnchoredEntities(indices))
|
||||
foreach (var entUid in gridComp.Grid.GetAnchoredEntities(indices))
|
||||
{
|
||||
if (!TryComp(entUid, out AtmosFixMarkerComponent? afm))
|
||||
continue;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
try
|
||||
{
|
||||
gridAtmosphere.Tiles.Add(indices, new TileAtmosphere(mapGrid.GridIndex, indices, (GasMixture) gridAtmosphere.UniqueMixes![mix].Clone()));
|
||||
gridAtmosphere.Tiles.Add(indices, new TileAtmosphere(mapGrid.Owner, indices, (GasMixture) gridAtmosphere.UniqueMixes![mix].Clone()));
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid to be checked.</param>
|
||||
/// <returns>Whether the grid has a simulated atmosphere.</returns>
|
||||
public bool IsSimulatedGrid(GridId grid)
|
||||
public bool IsSimulatedGrid(EntityUid grid)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get all tile mixtures from.</param>
|
||||
/// <param name="invalidate">Whether to invalidate all tiles.</param>
|
||||
/// <returns>All tile mixtures in a grid.</returns>
|
||||
public IEnumerable<GasMixture> GetAllTileMixtures(GridId grid, bool invalidate = false)
|
||||
public IEnumerable<GasMixture> GetAllTileMixtures(EntityUid grid, bool invalidate = false)
|
||||
{
|
||||
// Return an array with a single space gas mixture for invalid grids.
|
||||
if (!grid.IsValid())
|
||||
@@ -207,7 +207,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">The grid in question.</param>
|
||||
/// <param name="tiles">The amount of tiles.</param>
|
||||
/// <returns>The volume in liters that the tiles occupy.</returns>
|
||||
public float GetVolumeForTiles(GridId grid, int tiles = 1)
|
||||
public float GetVolumeForTiles(EntityUid grid, int tiles = 1)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return Atmospherics.CellVolume * tiles;
|
||||
@@ -289,7 +289,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
foreach (var tile in mapGrid.GetAllTiles())
|
||||
{
|
||||
if(!gridAtmosphere.Tiles.ContainsKey(tile.GridIndices))
|
||||
gridAtmosphere.Tiles[tile.GridIndices] = new TileAtmosphere(tile.GridIndex, tile.GridIndices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
gridAtmosphere.Tiles[tile.GridIndices] = new TileAtmosphere(tile.GridUid, tile.GridIndices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
|
||||
InvalidateTile(gridAtmosphere, tile.GridIndices);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
foreach (var (position, tile) in gridAtmosphere.Tiles.ToArray())
|
||||
{
|
||||
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
|
||||
InvalidateVisuals(mapGrid.Index, position);
|
||||
InvalidateVisuals(mapGrid.GridEntityId, position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to invalidate the tile.</param>
|
||||
/// <param name="tile">The indices of the tile.</param>
|
||||
public void InvalidateTile(GridId grid, Vector2i tile)
|
||||
public void InvalidateTile(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -371,7 +371,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void InvalidateVisuals(GridId grid, Vector2i tile)
|
||||
public void InvalidateVisuals(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
_gasTileOverlaySystem.Invalidate(grid, tile);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <remarks>Do NOT use this outside of atmos internals.</remarks>
|
||||
/// <returns>The Tile Atmosphere in the position, or null.</returns>
|
||||
public TileAtmosphere? GetTileAtmosphere(GridId grid, Vector2i tile)
|
||||
public TileAtmosphere? GetTileAtmosphere(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return null;
|
||||
@@ -450,7 +450,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <remarks>Do NOT use this outside of atmos internals.</remarks>
|
||||
/// <returns>The tile atmosphere of a specific position in a grid, a space tile atmosphere if the tile is space or null if the grid doesn't exist.</returns>
|
||||
public TileAtmosphere? GetTileAtmosphereOrCreateSpace(GridId grid, Vector2i tile)
|
||||
public TileAtmosphere? GetTileAtmosphereOrCreateSpace(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return null;
|
||||
@@ -480,7 +480,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// attempts to get the tile atmosphere for it before it has been revalidated by atmos.
|
||||
// The tile atmosphere will get revalidated on the next atmos tick, however.
|
||||
|
||||
return tileAtmosphere ?? new TileAtmosphere(mapGrid.Index, tile, new GasMixture(Atmospherics.CellVolume) {Temperature = Atmospherics.TCMB}, true);
|
||||
return tileAtmosphere ?? new TileAtmosphere(mapGrid.GridEntityId, tile, new GasMixture(Atmospherics.CellVolume) {Temperature = Atmospherics.TCMB}, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -502,7 +502,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile to be activated.</param>
|
||||
public void AddActiveTile(GridId grid, Vector2i tile)
|
||||
public void AddActiveTile(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -563,7 +563,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile to be deactivated.</param>
|
||||
/// <param name="disposeExcitedGroup">Whether to dispose of the tile's <see cref="ExcitedGroup"/></param>
|
||||
public void RemoveActiveTile(GridId grid, Vector2i tile, bool disposeExcitedGroup = true)
|
||||
public void RemoveActiveTile(EntityUid grid, Vector2i tile, bool disposeExcitedGroup = true)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -632,7 +632,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="invalidate">Whether to invalidate the tile.</param>
|
||||
/// <returns>The tile mixture, or null</returns>
|
||||
public GasMixture? GetTileMixture(GridId grid, Vector2i tile, bool invalidate = false)
|
||||
public GasMixture? GetTileMixture(EntityUid grid, Vector2i tile, bool invalidate = false)
|
||||
{
|
||||
// Always return space gas mixtures for invalid grids (grid 0)
|
||||
if (!grid.IsValid())
|
||||
@@ -699,7 +699,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <returns>Reaction results.</returns>
|
||||
public ReactionResult React(GridId grid, Vector2i tile)
|
||||
public ReactionResult React(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return ReactionResult.NoReaction;
|
||||
@@ -755,7 +755,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="direction">Directions to check.</param>
|
||||
/// <returns>Whether the tile is blocked in the directions specified.</returns>
|
||||
public bool IsTileAirBlocked(GridId grid, Vector2i tile, AtmosDirection direction = AtmosDirection.All)
|
||||
public bool IsTileAirBlocked(EntityUid grid, Vector2i tile, AtmosDirection direction = AtmosDirection.All)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -816,7 +816,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to check the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <returns>Whether the tile is space or not.</returns>
|
||||
public bool IsTileSpace(GridId grid, Vector2i tile)
|
||||
public bool IsTileSpace(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
return !_mapManager.TryGetGrid(grid, out var mapGrid) || IsTileSpace(mapGrid, tile);
|
||||
}
|
||||
@@ -847,7 +847,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <summary>
|
||||
/// Get a tile's heat capacity, based on the tile type, tile contents and tile gas mixture.
|
||||
/// </summary>
|
||||
public float GetTileHeatCapacity(GridId grid, Vector2i tile)
|
||||
public float GetTileHeatCapacity(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
// Always return space gas mixtures for invalid grids (grid 0)
|
||||
if (!grid.IsValid())
|
||||
@@ -913,7 +913,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="includeBlocked">Whether to include tiles in directions the tile is air-blocked in.</param>
|
||||
/// <returns>The positions adjacent to the tile.</returns>
|
||||
public IEnumerable<Vector2i> GetAdjacentTiles(GridId grid, Vector2i tile, bool includeBlocked = false)
|
||||
public IEnumerable<Vector2i> GetAdjacentTiles(EntityUid grid, Vector2i tile, bool includeBlocked = false)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return Enumerable.Empty<Vector2i>();
|
||||
@@ -986,7 +986,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="includeBlocked">Whether to include tiles in directions the tile is air-blocked in.</param>
|
||||
/// <param name="invalidate">Whether to invalidate all adjacent tiles.</param>
|
||||
/// <returns>All adjacent tile gas mixtures to the tile in question</returns>
|
||||
public IEnumerable<GasMixture> GetAdjacentTileMixtures(GridId grid, Vector2i tile, bool includeBlocked = false, bool invalidate = false)
|
||||
public IEnumerable<GasMixture> GetAdjacentTileMixtures(EntityUid grid, Vector2i tile, bool includeBlocked = false, bool invalidate = false)
|
||||
{
|
||||
// For invalid grids, return an array with a single space gas mixture in it.
|
||||
if (!grid.IsValid())
|
||||
@@ -1073,7 +1073,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
public void UpdateAdjacent(GridId grid, Vector2i tile)
|
||||
public void UpdateAdjacent(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1149,7 +1149,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="direction">Direction to be updated.</param>
|
||||
public void UpdateAdjacent(GridId grid, Vector2i tile, AtmosDirection direction)
|
||||
public void UpdateAdjacent(EntityUid grid, Vector2i tile, AtmosDirection direction)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1227,7 +1227,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="exposedTemperature">Temperature to expose to the tile.</param>
|
||||
/// <param name="exposedVolume">Volume of the exposed temperature.</param>
|
||||
/// <param name="soh">If true, the existing hotspot values will be set to the exposed values, but only if they're smaller.</param>
|
||||
public void HotspotExpose(GridId grid, Vector2i tile, float exposedTemperature, float exposedVolume, bool soh = false)
|
||||
public void HotspotExpose(EntityUid grid, Vector2i tile, float exposedTemperature, float exposedVolume, bool soh = false)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1264,7 +1264,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
public void HotspotExtinguish(GridId grid, Vector2i tile)
|
||||
public void HotspotExtinguish(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1313,7 +1313,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile</param>
|
||||
/// <param name="tile">Indices for the tile</param>
|
||||
/// <returns>Whether the hotspot is active or not.</returns>
|
||||
public bool IsHotspotActive(GridId grid, Vector2i tile)
|
||||
public bool IsHotspotActive(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -1376,7 +1376,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice)
|
||||
{
|
||||
var grid = Comp<TransformComponent>(atmosDevice.Owner).GridID;
|
||||
var grid = Comp<TransformComponent>(atmosDevice.Owner).GridEntityId;
|
||||
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -1438,7 +1438,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <returns>Whether the tile's gas mixture is probably safe.</returns>
|
||||
public bool IsTileMixtureProbablySafe(GridId grid, Vector2i tile)
|
||||
public bool IsTileMixtureProbablySafe(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
return IsMixtureProbablySafe(GetTileMixture(grid, tile));
|
||||
}
|
||||
@@ -1491,7 +1491,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
public void FixVacuum(GridId grid, Vector2i tile)
|
||||
public void FixVacuum(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1558,7 +1558,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return tile.GridIndices.GetTileRef(tile.GridIndex, _mapManager);
|
||||
}
|
||||
|
||||
public bool TryGetGridAndTile(MapCoordinates coordinates, [NotNullWhen(true)] out (GridId Grid, Vector2i Tile)? tuple)
|
||||
public bool TryGetGridAndTile(MapCoordinates coordinates, [NotNullWhen(true)] out (EntityUid Grid, Vector2i Tile)? tuple)
|
||||
{
|
||||
if (!_mapManager.TryFindGridAt(coordinates, out var grid))
|
||||
{
|
||||
@@ -1566,11 +1566,11 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
tuple = (grid.Index, grid.TileIndicesFor(coordinates));
|
||||
tuple = (grid.GridEntityId, grid.TileIndicesFor(coordinates));
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetGridAndTile(EntityCoordinates coordinates, [NotNullWhen(true)] out (GridId Grid, Vector2i Tile)? tuple)
|
||||
public bool TryGetGridAndTile(EntityCoordinates coordinates, [NotNullWhen(true)] out (EntityUid Grid, Vector2i Tile)? tuple)
|
||||
{
|
||||
if (!coordinates.IsValid(EntityManager))
|
||||
{
|
||||
@@ -1578,7 +1578,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
var gridId = coordinates.GetGridId(EntityManager);
|
||||
var gridId = coordinates.GetGridEntityId(EntityManager);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
tile = new TileAtmosphere(mapGrid.Index, indices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
tile = new TileAtmosphere(mapGrid.GridEntityId, indices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
atmosphere.Tiles[indices] = tile;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var tileDef = GetTile(tile)?.Tile.GetContentTileDefinition(_tileDefinitionManager);
|
||||
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
|
||||
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
|
||||
InvalidateVisuals(mapGrid.Index, indices);
|
||||
InvalidateVisuals(mapGrid.GridEntityId, indices);
|
||||
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
InvalidateTile(ev.NewTile.GridIndex, ev.NewTile.GridIndices);
|
||||
InvalidateTile(ev.NewTile.GridUid, ev.NewTile.GridIndices);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <summary>
|
||||
/// The tiles that have had their atmos data updated since last tick
|
||||
/// </summary>
|
||||
private readonly Dictionary<GridId, HashSet<Vector2i>> _invalidTiles = new();
|
||||
private readonly Dictionary<EntityUid, HashSet<Vector2i>> _invalidTiles = new();
|
||||
|
||||
private readonly Dictionary<IPlayerSession, PlayerGasOverlay> _knownPlayerChunks =
|
||||
new();
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <summary>
|
||||
/// Gas data stored in chunks to make PVS / bubbling easier.
|
||||
/// </summary>
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _overlay =
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, GasOverlayChunk>> _overlay =
|
||||
new();
|
||||
|
||||
/// <summary>
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Invalidate(GridId gridIndex, Vector2i indices)
|
||||
public void Invalidate(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_invalidTiles.TryGetValue(gridIndex, out var existing))
|
||||
{
|
||||
@@ -88,7 +88,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
existing.Add(indices);
|
||||
}
|
||||
|
||||
private GasOverlayChunk GetOrCreateChunk(GridId gridIndex, Vector2i indices)
|
||||
private GasOverlayChunk GetOrCreateChunk(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_overlay.TryGetValue(gridIndex, out var chunks))
|
||||
{
|
||||
@@ -204,7 +204,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID, worldBounds))
|
||||
{
|
||||
if (!_overlay.TryGetValue(grid.Index, out var chunks))
|
||||
if (!_overlay.TryGetValue(grid.GridEntityId, out var chunks))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
AccumulatedFrameTime -= _updateCooldown;
|
||||
|
||||
var gridAtmosComponents = new Dictionary<GridId, GridAtmosphereComponent>();
|
||||
var gridAtmosComponents = new Dictionary<EntityUid, GridAtmosphereComponent>();
|
||||
var updatedTiles = new Dictionary<GasOverlayChunk, HashSet<Vector2i>>();
|
||||
|
||||
// So up to this point we've been caching the updated tiles for multiple ticks.
|
||||
@@ -351,7 +351,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
overlay.RemoveChunk(chunk);
|
||||
}
|
||||
|
||||
var clientInvalids = new Dictionary<GridId, List<(Vector2i, GasOverlayData)>>();
|
||||
var clientInvalids = new Dictionary<EntityUid, List<(Vector2i, GasOverlayData)>>();
|
||||
|
||||
// Check for any dirty chunks in range and bundle the data to send to the client.
|
||||
foreach (var chunk in chunksInRange)
|
||||
@@ -378,13 +378,13 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
private sealed class PlayerGasOverlay
|
||||
{
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _data =
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, GasOverlayChunk>> _data =
|
||||
new();
|
||||
|
||||
private readonly Dictionary<GasOverlayChunk, GameTick> _lastSent =
|
||||
new();
|
||||
|
||||
public GasOverlayMessage UpdateClient(GridId grid, List<(Vector2i, GasOverlayData)> data)
|
||||
public GasOverlayMessage UpdateClient(EntityUid grid, List<(Vector2i, GasOverlayData)> data)
|
||||
{
|
||||
return new(grid, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user