Content changes for mapgrid kill (#12567)

This commit is contained in:
metalgearsloth
2022-11-22 13:12:04 +11:00
committed by GitHub
parent 9170e7ac9d
commit 6c76061887
75 changed files with 192 additions and 123 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
@@ -48,17 +49,16 @@ namespace Content.Server.Atmos.EntitySystems
if (!TryComp(uid, out MapGridComponent? mapGridComp))
return true;
var mapGrid = mapGridComp.Grid;
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(mapGridComp.Owner).MapID);
var volume = GetVolumeForTiles(mapGrid, 1);
var volume = GetVolumeForTiles(mapGridComp, 1);
var number = 0;
while (atmosphere.CurrentRunInvalidatedCoordinates.TryDequeue(out var indices))
{
if (!atmosphere.Tiles.TryGetValue(indices, out var tile))
{
tile = new TileAtmosphere(mapGrid.GridEntityId, indices,
tile = new TileAtmosphere(mapGridComp.GridEntityId, indices,
new GasMixture(volume) { Temperature = Atmospherics.T20C });
atmosphere.Tiles[indices] = tile;
}
@@ -78,7 +78,7 @@ namespace Content.Server.Atmos.EntitySystems
}
// Call this instead of the grid method as the map has a say on whether the tile is space or not.
if ((!mapGrid.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
if ((!mapGridComp.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
{
tile.Air = GetTileMixture(null, mapUid, indices);
tile.MolesArchived = tile.Air != null ? new float[Atmospherics.AdjustedNumberOfGases] : null;
@@ -87,7 +87,7 @@ namespace Content.Server.Atmos.EntitySystems
{
var nullAir = false;
var enumerator = GetObstructingComponentsEnumerator(mapGrid, indices);
var enumerator = GetObstructingComponentsEnumerator(mapGridComp, indices);
while (enumerator.MoveNext(out var airtight))
{
@@ -109,7 +109,7 @@ namespace Content.Server.Atmos.EntitySystems
}
else
{
if (tile.Air == null && NeedsVacuumFixing(mapGrid, indices))
if (tile.Air == null && NeedsVacuumFixing(mapGridComp, indices))
{
var vacuumEv = new FixTileVacuumMethodEvent(uid, indices);
GridFixTileVacuum(uid, atmosphere, ref vacuumEv);
@@ -133,12 +133,12 @@ namespace Content.Server.Atmos.EntitySystems
AddActiveTile(atmosphere, tile);
// TODO ATMOS: Query all the contents of this tile (like walls) and calculate the correct thermal conductivity and heat capacity
var tileDef = mapGrid.TryGetTileRef(indices, out var tileRef)
var tileDef = mapGridComp.TryGetTileRef(indices, out var tileRef)
? tileRef.GetContentTileDefinition(_tileDefinitionManager) : null;
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
InvalidateVisuals(mapGrid.GridEntityId, indices);
InvalidateVisuals(mapGridComp.GridEntityId, indices);
for (var i = 0; i < Atmospherics.Directions; i++)
{
@@ -171,12 +171,10 @@ namespace Content.Server.Atmos.EntitySystems
if (!TryComp(uid, out MapGridComponent? mapGridComp))
throw new Exception("Tried to process a grid atmosphere on an entity that isn't a grid!");
var mapGrid = mapGridComp.Grid;
var number = 0;
while (atmosphere.CurrentRunTiles.TryDequeue(out var tile))
{
EqualizePressureInZone(mapGrid, atmosphere, tile, atmosphere.UpdateCounter);
EqualizePressureInZone(mapGridComp, atmosphere, tile, atmosphere.UpdateCounter);
if (number++ < LagCheckIterations) continue;
number = 0;