|
|
|
|
@@ -36,7 +36,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
|
|
|
|
|
gridAtmosphere.Tiles.Clear();
|
|
|
|
|
|
|
|
|
|
if (!EntityManager.TryGetComponent(uid, out IMapGridComponent? mapGrid))
|
|
|
|
|
if (!TryComp(uid, out IMapGridComponent? mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (gridAtmosphere.TilesUniqueMixes != null)
|
|
|
|
|
@@ -85,7 +85,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.HasComponent<GridAtmosphereComponent>(mapGrid.GridEntityId))
|
|
|
|
|
if (HasComp<GridAtmosphereComponent>(mapGrid.GridEntityId))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
@@ -124,7 +124,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return Enumerable.Empty<GasMixture>();
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetAllTileMixtures(gridAtmosphere, invalidate);
|
|
|
|
|
}
|
|
|
|
|
@@ -197,7 +197,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
{
|
|
|
|
|
foreach (var uid in mapGrid.GetAnchoredEntities(tile))
|
|
|
|
|
{
|
|
|
|
|
if (EntityManager.TryGetComponent<AirtightComponent>(uid, out var ac))
|
|
|
|
|
if (TryComp<AirtightComponent>(uid, out var ac))
|
|
|
|
|
yield return ac;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -284,7 +284,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
InvalidateTile(gridAtmosphere, tile);
|
|
|
|
|
return;
|
|
|
|
|
@@ -312,6 +312,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
InvalidateVisuals(tuple.Value.Grid, tuple.Value.Tile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
public void InvalidateVisuals(GridId grid, Vector2i tile)
|
|
|
|
|
{
|
|
|
|
|
_gasTileOverlaySystem.Invalidate(grid, tile);
|
|
|
|
|
@@ -347,7 +348,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if(EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if(TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetTileAtmosphere(gridAtmosphere, tile);
|
|
|
|
|
}
|
|
|
|
|
@@ -396,7 +397,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, tile);
|
|
|
|
|
}
|
|
|
|
|
@@ -448,7 +449,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
AddActiveTile(gridAtmosphere, tile);
|
|
|
|
|
return;
|
|
|
|
|
@@ -509,7 +510,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
RemoveActiveTile(gridAtmosphere, tile);
|
|
|
|
|
return;
|
|
|
|
|
@@ -582,12 +583,12 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetTileMixture(gridAtmosphere, tile, invalidate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out SpaceAtmosphereComponent? _))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out SpaceAtmosphereComponent? _))
|
|
|
|
|
{
|
|
|
|
|
// Always return a new space gas mixture in this case.
|
|
|
|
|
return GasMixture.SpaceGas;
|
|
|
|
|
@@ -645,7 +646,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return ReactionResult.NoReaction;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return React(gridAtmosphere, tile);
|
|
|
|
|
}
|
|
|
|
|
@@ -795,12 +796,12 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return Atmospherics.MinimumHeatCapacity;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetTileHeatCapacity(gridAtmosphere, tile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out SpaceAtmosphereComponent? _))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out SpaceAtmosphereComponent? _))
|
|
|
|
|
{
|
|
|
|
|
return Atmospherics.SpaceHeatCapacity;
|
|
|
|
|
}
|
|
|
|
|
@@ -857,7 +858,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return Enumerable.Empty<Vector2i>();
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetAdjacentTiles(gridAtmosphere, tile, includeBlocked);
|
|
|
|
|
}
|
|
|
|
|
@@ -934,7 +935,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return Enumerable.Empty<GasMixture>();
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return GetAdjacentTileMixtures(gridAtmosphere, tile, includeBlocked, invalidate);
|
|
|
|
|
}
|
|
|
|
|
@@ -1017,7 +1018,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
|
|
|
|
|
return;
|
|
|
|
|
@@ -1093,7 +1094,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
UpdateAdjacent(mapGrid, gridAtmosphere, tile, direction);
|
|
|
|
|
return;
|
|
|
|
|
@@ -1171,7 +1172,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
var tileAtmosphere = GetTileAtmosphere(gridAtmosphere, tile);
|
|
|
|
|
|
|
|
|
|
@@ -1208,7 +1209,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
HotspotExtinguish(gridAtmosphere, tile);
|
|
|
|
|
return;
|
|
|
|
|
@@ -1257,7 +1258,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
return IsHotspotActive(gridAtmosphere, tile);
|
|
|
|
|
}
|
|
|
|
|
@@ -1288,7 +1289,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(pipeNet.Grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
gridAtmosphere.PipeNets.Add(pipeNet);
|
|
|
|
|
}
|
|
|
|
|
@@ -1303,7 +1304,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(pipeNet.Grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
gridAtmosphere.PipeNets.Remove(pipeNet);
|
|
|
|
|
}
|
|
|
|
|
@@ -1315,12 +1316,12 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
|
|
|
|
|
public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice)
|
|
|
|
|
{
|
|
|
|
|
var grid = EntityManager.GetComponent<TransformComponent>(atmosDevice.Owner).GridID;
|
|
|
|
|
var grid = Comp<TransformComponent>(atmosDevice.Owner).GridID;
|
|
|
|
|
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
atmosDevice.JoinedGrid = grid;
|
|
|
|
|
gridAtmosphere.AtmosDevices.Add(atmosDevice);
|
|
|
|
|
@@ -1344,7 +1345,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere)
|
|
|
|
|
&& gridAtmosphere.AtmosDevices.Contains(atmosDevice))
|
|
|
|
|
{
|
|
|
|
|
atmosDevice.JoinedGrid = null;
|
|
|
|
|
@@ -1435,7 +1436,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (EntityManager.TryGetComponent(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
if (TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
|
|
|
|
{
|
|
|
|
|
FixVacuum(gridAtmosphere, tile);
|
|
|
|
|
return;
|
|
|
|
|
@@ -1526,7 +1527,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|
|
|
|
|
|
|
|
|
public bool TryGetMapGrid(GridAtmosphereComponent gridAtmosphere, [NotNullWhen(true)] out IMapGrid? mapGrid)
|
|
|
|
|
{
|
|
|
|
|
if (EntityManager.TryGetComponent(gridAtmosphere.Owner, out IMapGridComponent? mapGridComponent))
|
|
|
|
|
if (TryComp(gridAtmosphere.Owner, out IMapGridComponent? mapGridComponent))
|
|
|
|
|
{
|
|
|
|
|
mapGrid = mapGridComponent.Grid;
|
|
|
|
|
return true;
|
|
|
|
|
|