ECS Atmos Part 3: Removes AtmosHelpers, add many methods to AtmosphereSystem. (#4285)
* ECS Atmos Part 3: Removes AtmosHelpers, add many methods to AtmosphereSystem * Adds API for adding/removing active tiles. * Adds API for FixVacuum. * Adds API for UpdateAdjacent. * Adds API for IsTileAirBlocked. * Re-organize hotspot code * Adds API for IsTileSpace. * RemoveGasCommand uses AtmosphereSystem * AddGasCommand uses AtmosphereSystem. * SetTemperatureCommand uses AtmosphereSystem. * Adds API for IsSimulatedGrid. * GasLeak uses AtmosphereSystem. * Makes Spark method in GasLeak ALSO use AtmosphereSystem. * GasPassiveVentSystem uses AtmosphereSystem. * GasMinerSystem uses AtmosphereSystem. * GasOutletInjectorSystem uses AtmosphereSystem. * GasVentPumpSystem uses AtmosphereSystem. * GasDualPortVentPumpSystem uses AtmosphereSystem. * GasVolumePumpSystem uses AtmosphereSystem. * GasAnalyzerComponent uses AtmosphereSystem. * Add API for GetAdjacentTileMixtures. * GasVentScrubberSystem uses AtmosphereSystem. * AirtightComponent uses AtmosphereSystem. * GasLeaks's TryFindRandomTile uses AtmosphereSystem. * Adds API for GetAdjacentTiles. * FirelockComponent's IsHoldingFire uses AtmosphereSystem. * Adds API for GetAllTileMixtures. * DeleteGasCommand uses AtmosphereSystem. * FixGridAtmos uses AtmosphereSystem. * FillGasCommand uses AtmosphereSystem. * SetAtmosTemperatureCommand uses AtmosphereSystem.
This commit is contained in:
committed by
GitHub
parent
10ced26b0d
commit
c8ba345cdc
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Player;
|
||||
@@ -127,55 +128,39 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
if (!mapManager.TryGetGrid(gridId, out _))
|
||||
{
|
||||
shell.WriteLine($"No grid exists with id {gridId}");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
{
|
||||
shell.WriteLine($"Grid {gridId} has no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridEntity.TryGetComponent(out GridAtmosphereComponent? atmosphere))
|
||||
{
|
||||
shell.WriteLine($"Grid {gridId} has no {nameof(GridAtmosphereComponent)}");
|
||||
return;
|
||||
}
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
var tiles = 0;
|
||||
var moles = 0f;
|
||||
|
||||
if (gas == null)
|
||||
{
|
||||
foreach (var tile in atmosphere)
|
||||
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
||||
{
|
||||
if (tile.Air == null || tile.Air.Immutable) continue;
|
||||
if (tile.Immutable) continue;
|
||||
|
||||
tiles++;
|
||||
moles += tile.Air.TotalMoles;
|
||||
moles += tile.TotalMoles;
|
||||
|
||||
tile.Air.Clear();
|
||||
|
||||
tile.Invalidate();
|
||||
tile.Clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var tile in atmosphere)
|
||||
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
||||
{
|
||||
if (tile.Air == null || tile.Air.Immutable) continue;
|
||||
if (tile.Immutable) continue;
|
||||
|
||||
tiles++;
|
||||
moles += tile.Air.TotalMoles;
|
||||
moles += tile.TotalMoles;
|
||||
|
||||
tile.Air.SetMoles(gas.Value, 0);
|
||||
|
||||
tile.Invalidate();
|
||||
tile.SetMoles(gas.Value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user