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,61 +0,0 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using Content.Server.Atmos.EntitySystems;
|
|
||||||
using Content.Shared.Atmos;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Map;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos
|
|
||||||
{
|
|
||||||
public static class AtmosHelpers
|
|
||||||
{
|
|
||||||
public static TileAtmosphere? GetTileAtmosphere(this EntityCoordinates coordinates)
|
|
||||||
{
|
|
||||||
return EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates).GetTile(coordinates);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GasMixture? GetTileAir(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
|
|
||||||
{
|
|
||||||
return coordinates.GetTileAtmosphere()?.Air;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [NotNullWhen(true)] out TileAtmosphere? atmosphere)
|
|
||||||
{
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
||||||
return !Equals(atmosphere = coordinates.GetTileAtmosphere(), default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool TryGetTileAir(this EntityCoordinates coordinates, [NotNullWhen(true)] out GasMixture? air, IEntityManager? entityManager = null)
|
|
||||||
{
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
||||||
return !Equals(air = coordinates.GetTileAir(entityManager), default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsTileAirProbablySafe(this EntityCoordinates coordinates)
|
|
||||||
{
|
|
||||||
// Note that oxygen mix isn't checked, but survival boxes make that not necessary.
|
|
||||||
var air = coordinates.GetTileAir();
|
|
||||||
if (air == null)
|
|
||||||
return false;
|
|
||||||
if (air.Pressure <= Atmospherics.WarningLowPressure)
|
|
||||||
return false;
|
|
||||||
if (air.Pressure >= Atmospherics.WarningHighPressure)
|
|
||||||
return false;
|
|
||||||
if (air.Temperature <= 260)
|
|
||||||
return false;
|
|
||||||
if (air.Temperature >= 360)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool InvalidateTileAir(this EntityCoordinates coordinates)
|
|
||||||
{
|
|
||||||
if (!coordinates.TryGetTileAtmosphere(out var tileAtmos))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
tileAtmos.Invalidate();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,6 @@ namespace Content.Server.Atmos.Components
|
|||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
|
||||||
private (GridId, Vector2i) _lastPosition;
|
private (GridId, Vector2i) _lastPosition;
|
||||||
private AtmosphereSystem _atmosphereSystem = default!;
|
|
||||||
|
|
||||||
public override string Name => "Airtight";
|
public override string Name => "Airtight";
|
||||||
|
|
||||||
@@ -76,8 +75,6 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
|
||||||
|
|
||||||
if (_fixAirBlockedDirectionInitialize)
|
if (_fixAirBlockedDirectionInitialize)
|
||||||
RotateEvent(new RotateEvent(Owner, Angle.Zero, Owner.Transform.WorldRotation));
|
RotateEvent(new RotateEvent(Owner, Angle.Zero, Owner.Transform.WorldRotation));
|
||||||
|
|
||||||
@@ -132,7 +129,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
if (_fixVacuum)
|
if (_fixVacuum)
|
||||||
{
|
{
|
||||||
_atmosphereSystem.GetGridAtmosphere(_lastPosition.Item1)?.FixVacuum(_lastPosition.Item2);
|
EntitySystem.Get<AtmosphereSystem>().FixVacuum(_lastPosition.Item1, _lastPosition.Item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,10 +161,9 @@ namespace Content.Server.Atmos.Components
|
|||||||
if (!gridId.IsValid())
|
if (!gridId.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var gridAtmos = _atmosphereSystem.GetGridAtmosphere(gridId);
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
atmosphereSystem.UpdateAdjacent(gridId, pos);
|
||||||
gridAtmos?.UpdateAdjacentBits(pos);
|
atmosphereSystem.InvalidateTile(gridId, pos);
|
||||||
gridAtmos?.Invalidate(pos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,15 +74,12 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
var gridAtmosphere = atmosphereSystem.GetGridAtmosphere(Owner.Transform.Coordinates);
|
|
||||||
|
|
||||||
var minMoles = float.MaxValue;
|
var minMoles = float.MaxValue;
|
||||||
var maxMoles = 0f;
|
var maxMoles = 0f;
|
||||||
|
|
||||||
foreach (var (_, adjacent) in gridAtmosphere.GetAdjacentTiles(Owner.Transform.Coordinates))
|
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(Owner.Transform.Coordinates))
|
||||||
{
|
{
|
||||||
// includeAirBlocked remains false, and therefore Air must be present
|
var moles = adjacent.TotalMoles;
|
||||||
var moles = adjacent.Air!.TotalMoles;
|
|
||||||
if (moles < minMoles)
|
if (moles < minMoles)
|
||||||
minMoles = moles;
|
minMoles = moles;
|
||||||
if (moles > maxMoles)
|
if (moles > maxMoles)
|
||||||
@@ -96,17 +93,18 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!Owner.Transform.Coordinates.TryGetTileAtmosphere(out var tileAtmos))
|
if (!atmosphereSystem.TryGetGridAndTile(Owner.Transform.Coordinates, out var tuple))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (tileAtmos.Hotspot.Valid)
|
if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var gridAtmosphere = atmosphereSystem.GetGridAtmosphere(Owner.Transform.Coordinates);
|
foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(Owner.Transform.Coordinates))
|
||||||
|
|
||||||
foreach (var (_, adjacent) in gridAtmosphere.GetAdjacentTiles(tileAtmos.GridIndices))
|
|
||||||
{
|
{
|
||||||
if (adjacent.Hotspot.Valid)
|
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,8 +123,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
|
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
|
||||||
var pressure = 0f;
|
var pressure = 0f;
|
||||||
var gam = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.Coordinates);
|
var tile = EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates);
|
||||||
var tile = gam?.GetTile(Owner.Transform.Coordinates)?.Air;
|
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
pressure = tile.Pressure;
|
pressure = tile.Pressure;
|
||||||
@@ -182,9 +181,8 @@ namespace Content.Server.Atmos.Components
|
|||||||
pos = _position.Value;
|
pos = _position.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
var gam = atmosSystem.GetGridAtmosphere(pos);
|
var tile = atmosphereSystem.GetTileMixture(pos);
|
||||||
var tile = gam.GetTile(pos)?.Air;
|
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
error = "No Atmosphere!";
|
error = "No Atmosphere!";
|
||||||
@@ -201,7 +199,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
|
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
|
||||||
{
|
{
|
||||||
var gas = atmosSystem.GetGas(i);
|
var gas = atmosphereSystem.GetGas(i);
|
||||||
|
|
||||||
if (tile.Moles[i] <= Atmospherics.GasMinMoles) continue;
|
if (tile.Moles[i] <= Atmospherics.GasMinMoles) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -278,8 +278,9 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
if (_integrity <= 0)
|
if (_integrity <= 0)
|
||||||
{
|
{
|
||||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere();
|
var environment = atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true);
|
||||||
tileAtmos?.AssumeAir(Air);
|
if(environment != null)
|
||||||
|
atmosphereSystem.Merge(environment, Air);
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), "Audio/Effects/spray.ogg", Owner.Transform.Coordinates,
|
SoundSystem.Play(Filter.Pvs(Owner), "Audio/Effects/spray.ogg", Owner.Transform.Coordinates,
|
||||||
AudioHelpers.WithVariation(0.125f));
|
AudioHelpers.WithVariation(0.125f));
|
||||||
@@ -296,12 +297,12 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
if (_integrity <= 0)
|
if (_integrity <= 0)
|
||||||
{
|
{
|
||||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere();
|
var environment = atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true);
|
||||||
if (tileAtmos == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var leakedGas = Air.RemoveRatio(0.25f);
|
var leakedGas = Air.RemoveRatio(0.25f);
|
||||||
tileAtmos.AssumeAir(leakedGas);
|
atmosphereSystem.Merge(environment, leakedGas);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
1000
Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs
Normal file
1000
Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,12 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
using Content.Server.NodeContainer.EntitySystems;
|
using Content.Server.NodeContainer.EntitySystems;
|
||||||
using Content.Shared.Atmos.EntitySystems;
|
using Content.Shared.Atmos.EntitySystems;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems
|
namespace Content.Server.Atmos.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -20,16 +15,11 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
private GridTileLookupSystem? _gridTileLookup = null;
|
|
||||||
|
|
||||||
private const float ExposedUpdateDelay = 1f;
|
private const float ExposedUpdateDelay = 1f;
|
||||||
private float _exposedTimer = 0f;
|
private float _exposedTimer = 0f;
|
||||||
|
|
||||||
public GridTileLookupSystem GridTileLookupSystem => _gridTileLookup ??= Get<GridTileLookupSystem>();
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -81,73 +71,6 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
map.AddComponent<SpaceGridAtmosphereComponent>();
|
map.AddComponent<SpaceGridAtmosphereComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Helper Methods
|
|
||||||
public IGridAtmosphereComponent? GetGridAtmosphere(GridId gridId)
|
|
||||||
{
|
|
||||||
if (!gridId.IsValid())
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return ComponentManager.TryGetComponent(grid.GridEntityId, out IGridAtmosphereComponent? gridAtmosphere)
|
|
||||||
? gridAtmosphere : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IGridAtmosphereComponent GetGridAtmosphere(EntityCoordinates coordinates)
|
|
||||||
{
|
|
||||||
return GetGridAtmosphere(coordinates.ToMap(EntityManager));
|
|
||||||
}
|
|
||||||
|
|
||||||
public IGridAtmosphereComponent GetGridAtmosphere(MapCoordinates coordinates)
|
|
||||||
{
|
|
||||||
if (coordinates.MapId == MapId.Nullspace)
|
|
||||||
{
|
|
||||||
throw new ArgumentException($"Coordinates cannot be in nullspace!", nameof(coordinates));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_mapManager.TryFindGridAt(coordinates, out var grid))
|
|
||||||
{
|
|
||||||
if (ComponentManager.TryGetComponent(grid.GridEntityId, out IGridAtmosphereComponent? atmos))
|
|
||||||
{
|
|
||||||
return atmos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _mapManager.GetMapEntity(coordinates.MapId).GetComponent<IGridAtmosphereComponent>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unlike <see cref="GetGridAtmosphere"/>, this doesn't return space grid when not found.
|
|
||||||
/// </summary>
|
|
||||||
public bool TryGetSimulatedGridAtmosphere(MapCoordinates coordinates, [NotNullWhen(true)] out IGridAtmosphereComponent? atmosphere)
|
|
||||||
{
|
|
||||||
if (coordinates.MapId == MapId.Nullspace)
|
|
||||||
{
|
|
||||||
atmosphere = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_mapManager.TryFindGridAt(coordinates, out var mapGrid)
|
|
||||||
&& ComponentManager.TryGetComponent(mapGrid.GridEntityId, out IGridAtmosphereComponent? atmosGrid)
|
|
||||||
&& atmosGrid.Simulated)
|
|
||||||
{
|
|
||||||
atmosphere = atmosGrid;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_mapManager.GetMapEntity(coordinates.MapId).TryGetComponent(out IGridAtmosphereComponent? atmosMap)
|
|
||||||
&& atmosMap.Simulated)
|
|
||||||
{
|
|
||||||
atmosphere = atmosMap;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
atmosphere = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
@@ -158,9 +81,11 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
if (_exposedTimer >= ExposedUpdateDelay)
|
if (_exposedTimer >= ExposedUpdateDelay)
|
||||||
{
|
{
|
||||||
foreach (var exposed in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>(true))
|
foreach (var exposed in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>())
|
||||||
{
|
{
|
||||||
var tile = exposed.Owner.Transform.Coordinates.GetTileAtmosphere();
|
// TODO ATMOS: Kill this with fire.
|
||||||
|
var atmos = GetGridAtmosphere(exposed.Owner.Transform.Coordinates);
|
||||||
|
var tile = atmos.GetTile(exposed.Owner.Transform.Coordinates);
|
||||||
if (tile == null) continue;
|
if (tile == null) continue;
|
||||||
exposed.Update(tile, _exposedTimer, this);
|
exposed.Update(tile, _exposedTimer, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,11 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|| !nodeContainer.TryGetNode(vent.OutletName, out PipeNode? outlet))
|
|| !nodeContainer.TryGetNode(vent.OutletName, out PipeNode? outlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var environment = args.Atmosphere.GetTile(vent.Owner.Transform.Coordinates)!;
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
var environment = atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
// We're in an air-blocked tile... Do nothing.
|
// We're in an air-blocked tile... Do nothing.
|
||||||
if (environment.Air == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (vent.PumpDirection == VentPumpDirection.Releasing)
|
if (vent.PumpDirection == VentPumpDirection.Releasing)
|
||||||
@@ -58,38 +59,37 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
var pressureDelta = 10000f;
|
var pressureDelta = 10000f;
|
||||||
|
|
||||||
if ((vent.PressureChecks & DualPortVentPressureBound.ExternalBound) != 0)
|
if ((vent.PressureChecks & DualPortVentPressureBound.ExternalBound) != 0)
|
||||||
pressureDelta = MathF.Min(pressureDelta, (vent.ExternalPressureBound - environment.Air.Pressure));
|
pressureDelta = MathF.Min(pressureDelta, (vent.ExternalPressureBound - environment.Pressure));
|
||||||
|
|
||||||
if ((vent.PressureChecks & DualPortVentPressureBound.InputMinimum) != 0)
|
if ((vent.PressureChecks & DualPortVentPressureBound.InputMinimum) != 0)
|
||||||
pressureDelta = MathF.Min(pressureDelta, (inlet.Air.Pressure - vent.InputPressureMin));
|
pressureDelta = MathF.Min(pressureDelta, (inlet.Air.Pressure - vent.InputPressureMin));
|
||||||
|
|
||||||
if (pressureDelta > 0 && inlet.Air.Temperature > 0)
|
if (pressureDelta > 0 && inlet.Air.Temperature > 0)
|
||||||
{
|
{
|
||||||
var transferMoles = pressureDelta * environment.Air.Volume / inlet.Air.Temperature * Atmospherics.R;
|
var transferMoles = pressureDelta * environment.Volume / inlet.Air.Temperature * Atmospherics.R;
|
||||||
var removed = inlet.Air.Remove(transferMoles);
|
var removed = inlet.Air.Remove(transferMoles);
|
||||||
environment.AssumeAir(removed);
|
atmosphereSystem.Merge(environment, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Air.Pressure > 0f)
|
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Pressure > 0f)
|
||||||
{
|
{
|
||||||
appearance?.SetData(VentPumpVisuals.State, VentPumpState.In);
|
appearance?.SetData(VentPumpVisuals.State, VentPumpState.In);
|
||||||
var ourMultiplier = outlet.Air.Volume / environment.Air.Temperature * Atmospherics.R;
|
var ourMultiplier = outlet.Air.Volume / environment.Temperature * Atmospherics.R;
|
||||||
var molesDelta = 10000 * ourMultiplier;
|
var molesDelta = 10000 * ourMultiplier;
|
||||||
|
|
||||||
if ((vent.PressureChecks & DualPortVentPressureBound.ExternalBound) != 0)
|
if ((vent.PressureChecks & DualPortVentPressureBound.ExternalBound) != 0)
|
||||||
molesDelta =
|
molesDelta =
|
||||||
MathF.Min(molesDelta,
|
MathF.Min(molesDelta,
|
||||||
(environment.Air.Pressure - vent.OutputPressureMax) * environment.Air.Volume / (environment.Air.Temperature * Atmospherics.R));
|
(environment.Pressure - vent.OutputPressureMax) * environment.Volume / (environment.Temperature * Atmospherics.R));
|
||||||
|
|
||||||
if ((vent.PressureChecks &DualPortVentPressureBound.InputMinimum) != 0)
|
if ((vent.PressureChecks &DualPortVentPressureBound.InputMinimum) != 0)
|
||||||
molesDelta = MathF.Min(molesDelta, (vent.InputPressureMin - outlet.Air.Pressure) * ourMultiplier);
|
molesDelta = MathF.Min(molesDelta, (vent.InputPressureMin - outlet.Air.Pressure) * ourMultiplier);
|
||||||
|
|
||||||
if (molesDelta > 0)
|
if (molesDelta > 0)
|
||||||
{
|
{
|
||||||
var removed = environment.Air.Remove(molesDelta);
|
var removed = environment.Remove(molesDelta);
|
||||||
|
|
||||||
Get<AtmosphereSystem>().Merge(outlet.Air, removed);
|
Get<AtmosphereSystem>().Merge(outlet.Air, removed);
|
||||||
environment.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Binary.Components;
|
using Content.Server.Atmos.Piping.Binary.Components;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
@@ -55,12 +56,13 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
// Some of the gas from the mixture leaks when overclocked.
|
// Some of the gas from the mixture leaks when overclocked.
|
||||||
if (pump.Overclocked)
|
if (pump.Overclocked)
|
||||||
{
|
{
|
||||||
var tile = args.Atmosphere.GetTile(pump.Owner.Transform.Coordinates);
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
var tile = atmosphereSystem.GetTileMixture(pump.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
var leaked = removed.RemoveRatio(pump.LeakRatio);
|
var leaked = removed.RemoveRatio(pump.LeakRatio);
|
||||||
tile.AssumeAir(leaked);
|
atmosphereSystem.Merge(tile, leaked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Buffers;
|
||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Construction.Components;
|
using Content.Server.Construction.Components;
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.Owner.Transform.Coordinates.TryGetTileAir(out var environment, EntityManager))
|
if (Get<AtmosphereSystem>().GetTileMixture(component.Owner.Transform.Coordinates) is not {} environment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var node in nodes.Nodes.Values)
|
foreach (var node in nodes.Nodes.Values)
|
||||||
@@ -46,12 +47,10 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.Owner.Transform.Coordinates.TryGetTileAtmosphere(out var environment))
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
environment = null;
|
|
||||||
|
|
||||||
var environmentPressure = environment?.Air?.Pressure ?? 0f;
|
if (atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is not {} environment)
|
||||||
var environmentVolume = environment?.Air?.Volume ?? Atmospherics.CellVolume;
|
environment = GasMixture.SpaceGas;
|
||||||
var environmentTemperature = environment?.Air?.Volume ?? Atmospherics.TCMB;
|
|
||||||
|
|
||||||
var lost = 0f;
|
var lost = 0f;
|
||||||
var timesLost = 0;
|
var timesLost = 0;
|
||||||
@@ -60,16 +59,14 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
{
|
{
|
||||||
if (node is not PipeNode pipe) continue;
|
if (node is not PipeNode pipe) continue;
|
||||||
|
|
||||||
var difference = pipe.Air.Pressure - environmentPressure;
|
var difference = pipe.Air.Pressure - environment.Pressure;
|
||||||
lost += difference * environmentVolume / (environmentTemperature * Atmospherics.R);
|
lost += difference * environment.Volume / (environment.Temperature * Atmospherics.R);
|
||||||
timesLost++;
|
timesLost++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sharedLoss = lost / timesLost;
|
var sharedLoss = lost / timesLost;
|
||||||
var buffer = new GasMixture();
|
var buffer = new GasMixture();
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
|
||||||
|
|
||||||
foreach (var node in nodes.Nodes.Values)
|
foreach (var node in nodes.Nodes.Values)
|
||||||
{
|
{
|
||||||
if (node is not PipeNode pipe) continue;
|
if (node is not PipeNode pipe) continue;
|
||||||
@@ -77,7 +74,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
atmosphereSystem.Merge(buffer, pipe.Air.Remove(sharedLoss));
|
atmosphereSystem.Merge(buffer, pipe.Air.Remove(sharedLoss));
|
||||||
}
|
}
|
||||||
|
|
||||||
environment?.AssumeAir(buffer);
|
atmosphereSystem.Merge(environment, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Atmos.Piping.Other.Components;
|
using Content.Server.Atmos.Piping.Other.Components;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
@@ -20,7 +21,9 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
|||||||
|
|
||||||
private void OnMinerUpdated(EntityUid uid, GasMinerComponent miner, AtmosDeviceUpdateEvent args)
|
private void OnMinerUpdated(EntityUid uid, GasMinerComponent miner, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!CheckMinerOperation(args.Atmosphere, miner, out var tile) || !miner.Enabled || !miner.SpawnGas.HasValue || miner.SpawnAmount <= 0f)
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
|
||||||
|
if (!CheckMinerOperation(atmosphereSystem, miner, out var environment) || !miner.Enabled || !miner.SpawnGas.HasValue || miner.SpawnAmount <= 0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Time to mine some gas.
|
// Time to mine some gas.
|
||||||
@@ -28,22 +31,22 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
|||||||
var merger = new GasMixture(1) { Temperature = miner.SpawnTemperature };
|
var merger = new GasMixture(1) { Temperature = miner.SpawnTemperature };
|
||||||
merger.SetMoles(miner.SpawnGas.Value, miner.SpawnAmount);
|
merger.SetMoles(miner.SpawnGas.Value, miner.SpawnAmount);
|
||||||
|
|
||||||
tile.AssumeAir(merger);
|
atmosphereSystem.Merge(environment, merger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckMinerOperation(IGridAtmosphereComponent atmosphere, GasMinerComponent miner, [NotNullWhen(true)] out TileAtmosphere? tile)
|
private bool CheckMinerOperation(AtmosphereSystem atmosphereSystem, GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment)
|
||||||
{
|
{
|
||||||
tile = atmosphere.GetTile(miner.Owner.Transform.Coordinates)!;
|
environment = atmosphereSystem.GetTileMixture(miner.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
// Space.
|
// Space.
|
||||||
if (atmosphere.IsSpace(tile.GridIndices))
|
if (atmosphereSystem.IsTileSpace(miner.Owner.Transform.Coordinates))
|
||||||
{
|
{
|
||||||
miner.Broken = true;
|
miner.Broken = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Airblocked location.
|
// Air-blocked location.
|
||||||
if (tile.Air == null)
|
if (environment == null)
|
||||||
{
|
{
|
||||||
miner.Broken = true;
|
miner.Broken = true;
|
||||||
return false;
|
return false;
|
||||||
@@ -51,14 +54,14 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
|||||||
|
|
||||||
// External pressure above threshold.
|
// External pressure above threshold.
|
||||||
if (!float.IsInfinity(miner.MaxExternalPressure) &&
|
if (!float.IsInfinity(miner.MaxExternalPressure) &&
|
||||||
tile.Air.Pressure > miner.MaxExternalPressure - miner.SpawnAmount * miner.SpawnTemperature * Atmospherics.R / tile.Air.Volume)
|
environment.Pressure > miner.MaxExternalPressure - miner.SpawnAmount * miner.SpawnTemperature * Atmospherics.R / environment.Volume)
|
||||||
{
|
{
|
||||||
miner.Broken = true;
|
miner.Broken = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// External gas amount above threshold.
|
// External gas amount above threshold.
|
||||||
if (!float.IsInfinity(miner.MaxExternalAmount) && tile.Air.TotalMoles > miner.MaxExternalAmount)
|
if (!float.IsInfinity(miner.MaxExternalAmount) && environment.TotalMoles > miner.MaxExternalAmount)
|
||||||
{
|
{
|
||||||
miner.Broken = true;
|
miner.Broken = true;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -165,9 +165,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var tileAtmosphere = canister.Owner.Transform.Coordinates.GetTileAtmosphere();
|
var environment = atmosphereSystem.GetTileMixture(canister.Owner.Transform.Coordinates, true);
|
||||||
atmosphereSystem.ReleaseGasTo(canister.Air, tileAtmosphere?.Air, canister.ReleasePressure);
|
atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure);
|
||||||
tileAtmosphere?.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Atmos.Piping.Unary.Components;
|
using Content.Server.Atmos.Piping.Unary.Components;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
@@ -31,9 +32,10 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet))
|
if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var environment = args.Atmosphere.GetTile(injector.Owner.Transform.Coordinates)!;
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
var environment = atmosphereSystem.GetTileMixture(injector.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
if (environment.Air == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (inlet.Air.Temperature > 0)
|
if (inlet.Air.Temperature > 0)
|
||||||
@@ -42,8 +44,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
var removed = inlet.Air.Remove(transferMoles);
|
var removed = inlet.Air.Remove(transferMoles);
|
||||||
|
|
||||||
environment.AssumeAir(removed);
|
atmosphereSystem.Merge(environment, removed);
|
||||||
environment.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Atmos.Piping.Unary.Components;
|
using Content.Server.Atmos.Piping.Unary.Components;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
@@ -21,9 +22,10 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args)
|
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var environment = args.Atmosphere.GetTile(vent.Owner.Transform.Coordinates)!;
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
var environment = atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
if (environment.Air == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
if (!ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
||||||
@@ -32,27 +34,26 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? inlet))
|
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? inlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var environmentPressure = environment.Air.Pressure;
|
var environmentPressure = environment.Pressure;
|
||||||
var pressureDelta = MathF.Abs(environmentPressure - inlet.Air.Pressure);
|
var pressureDelta = MathF.Abs(environmentPressure - inlet.Air.Pressure);
|
||||||
|
|
||||||
if ((environment.Air.Temperature > 0 || inlet.Air.Temperature > 0) && pressureDelta > 0.5f)
|
if ((environment.Temperature > 0 || inlet.Air.Temperature > 0) && pressureDelta > 0.5f)
|
||||||
{
|
{
|
||||||
if (environmentPressure < inlet.Air.Pressure)
|
if (environmentPressure < inlet.Air.Pressure)
|
||||||
{
|
{
|
||||||
var airTemperature = environment.Temperature > 0 ? environment.Temperature : inlet.Air.Temperature;
|
var airTemperature = environment.Temperature > 0 ? environment.Temperature : inlet.Air.Temperature;
|
||||||
var transferMoles = pressureDelta * environment.Air.Volume / (airTemperature * Atmospherics.R);
|
var transferMoles = pressureDelta * environment.Volume / (airTemperature * Atmospherics.R);
|
||||||
var removed = inlet.Air.Remove(transferMoles);
|
var removed = inlet.Air.Remove(transferMoles);
|
||||||
environment.AssumeAir(removed);
|
atmosphereSystem.Merge(environment, removed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var airTemperature = inlet.Air.Temperature > 0 ? inlet.Air.Temperature : environment.Temperature;
|
var airTemperature = inlet.Air.Temperature > 0 ? inlet.Air.Temperature : environment.Temperature;
|
||||||
var outputVolume = inlet.Air.Volume;
|
var outputVolume = inlet.Air.Volume;
|
||||||
var transferMoles = (pressureDelta * outputVolume) / (airTemperature * Atmospherics.R);
|
var transferMoles = (pressureDelta * outputVolume) / (airTemperature * Atmospherics.R);
|
||||||
transferMoles = MathF.Min(transferMoles, environment.Air.TotalMoles * inlet.Air.Volume / environment.Air.Volume);
|
transferMoles = MathF.Min(transferMoles, environment.TotalMoles * inlet.Air.Volume / environment.Volume);
|
||||||
var removed = environment.Air.Remove(transferMoles);
|
var removed = environment.Remove(transferMoles);
|
||||||
inlet.AssumeAir(removed);
|
inlet.AssumeAir(removed);
|
||||||
environment.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Atmos.Piping.Unary.Components;
|
using Content.Server.Atmos.Piping.Unary.Components;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
@@ -43,10 +44,11 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe))
|
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var environment = args.Atmosphere.GetTile(vent.Owner.Transform.Coordinates)!;
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
var environment = atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
// We're in an air-blocked tile... Do nothing.
|
// We're in an air-blocked tile... Do nothing.
|
||||||
if (environment.Air == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (vent.PumpDirection == VentPumpDirection.Releasing)
|
if (vent.PumpDirection == VentPumpDirection.Releasing)
|
||||||
@@ -55,37 +57,36 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
var pressureDelta = 10000f;
|
var pressureDelta = 10000f;
|
||||||
|
|
||||||
if ((vent.PressureChecks & VentPressureBound.ExternalBound) != 0)
|
if ((vent.PressureChecks & VentPressureBound.ExternalBound) != 0)
|
||||||
pressureDelta = MathF.Min(pressureDelta, vent.ExternalPressureBound - environment.Air.Pressure);
|
pressureDelta = MathF.Min(pressureDelta, vent.ExternalPressureBound - environment.Pressure);
|
||||||
|
|
||||||
if ((vent.PressureChecks & VentPressureBound.InternalBound) != 0)
|
if ((vent.PressureChecks & VentPressureBound.InternalBound) != 0)
|
||||||
pressureDelta = MathF.Min(pressureDelta, pipe.Air.Pressure - vent.InternalPressureBound);
|
pressureDelta = MathF.Min(pressureDelta, pipe.Air.Pressure - vent.InternalPressureBound);
|
||||||
|
|
||||||
if (pressureDelta > 0 && pipe.Air.Temperature > 0)
|
if (pressureDelta > 0 && pipe.Air.Temperature > 0)
|
||||||
{
|
{
|
||||||
var transferMoles = pressureDelta * environment.Air.Volume / (pipe.Air.Temperature * Atmospherics.R);
|
var transferMoles = pressureDelta * environment.Volume / (pipe.Air.Temperature * Atmospherics.R);
|
||||||
|
|
||||||
environment.AssumeAir(pipe.Air.Remove(transferMoles));
|
atmosphereSystem.Merge(environment, pipe.Air.Remove(transferMoles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Air.Pressure > 0)
|
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Pressure > 0)
|
||||||
{
|
{
|
||||||
appearance?.SetData(VentPumpVisuals.State, VentPumpState.In);
|
appearance?.SetData(VentPumpVisuals.State, VentPumpState.In);
|
||||||
var ourMultiplier = pipe.Air.Volume / (environment.Air.Temperature * Atmospherics.R);
|
var ourMultiplier = pipe.Air.Volume / (environment.Temperature * Atmospherics.R);
|
||||||
var molesDelta = 10000f * ourMultiplier;
|
var molesDelta = 10000f * ourMultiplier;
|
||||||
|
|
||||||
if ((vent.PressureChecks & VentPressureBound.ExternalBound) != 0)
|
if ((vent.PressureChecks & VentPressureBound.ExternalBound) != 0)
|
||||||
molesDelta = MathF.Min(molesDelta,
|
molesDelta = MathF.Min(molesDelta,
|
||||||
(environment.Air.Pressure - vent.ExternalPressureBound) * environment.Air.Volume /
|
(environment.Pressure - vent.ExternalPressureBound) * environment.Volume /
|
||||||
(environment.Air.Temperature * Atmospherics.R));
|
(environment.Temperature * Atmospherics.R));
|
||||||
|
|
||||||
if ((vent.PressureChecks & VentPressureBound.InternalBound) != 0)
|
if ((vent.PressureChecks & VentPressureBound.InternalBound) != 0)
|
||||||
molesDelta = MathF.Min(molesDelta, (vent.InternalPressureBound - pipe.Air.Pressure) * ourMultiplier);
|
molesDelta = MathF.Min(molesDelta, (vent.InternalPressureBound - pipe.Air.Pressure) * ourMultiplier);
|
||||||
|
|
||||||
if (molesDelta > 0)
|
if (molesDelta > 0)
|
||||||
{
|
{
|
||||||
var removed = environment.Air.Remove(molesDelta);
|
var removed = environment.Remove(molesDelta);
|
||||||
pipe.AssumeAir(removed);
|
pipe.AssumeAir(removed);
|
||||||
environment.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,17 +45,17 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet))
|
if (!nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var environment = args.Atmosphere.GetTile(scrubber.Owner.Transform.Coordinates)!;
|
var atmosphereSystem = Get<AtmosphereSystem>();
|
||||||
|
var environment = atmosphereSystem.GetTileMixture(scrubber.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
Scrub(scrubber, appearance, environment, outlet);
|
Scrub(atmosphereSystem, scrubber, appearance, environment, outlet);
|
||||||
|
|
||||||
if (!scrubber.WideNet) return;
|
if (!scrubber.WideNet) return;
|
||||||
|
|
||||||
// Scrub adjacent tiles too.
|
// Scrub adjacent tiles too.
|
||||||
foreach (var adjacent in environment.AdjacentTiles)
|
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(scrubber.Owner.Transform.Coordinates, false, true))
|
||||||
{
|
{
|
||||||
// Pass null appearance, we don't need to set it there.
|
Scrub(atmosphereSystem, scrubber, null, adjacent, outlet);
|
||||||
Scrub(scrubber, null, adjacent, outlet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,10 +67,10 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Scrub(GasVentScrubberComponent scrubber, AppearanceComponent? appearance, TileAtmosphere? tile, PipeNode outlet)
|
private void Scrub(AtmosphereSystem atmosphereSystem, GasVentScrubberComponent scrubber, AppearanceComponent? appearance, GasMixture? tile, PipeNode outlet)
|
||||||
{
|
{
|
||||||
// Cannot scrub if tile is null or air-blocked.
|
// Cannot scrub if tile is null or air-blocked.
|
||||||
if (tile?.Air == null)
|
if (tile == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Cannot scrub if pressure too high.
|
// Cannot scrub if pressure too high.
|
||||||
@@ -80,30 +80,28 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (scrubber.PumpDirection == ScrubberPumpDirection.Scrubbing)
|
if (scrubber.PumpDirection == ScrubberPumpDirection.Scrubbing)
|
||||||
{
|
{
|
||||||
appearance?.SetData(ScrubberVisuals.State, scrubber.WideNet ? ScrubberState.WideScrub : ScrubberState.Scrub);
|
appearance?.SetData(ScrubberVisuals.State, scrubber.WideNet ? ScrubberState.WideScrub : ScrubberState.Scrub);
|
||||||
var transferMoles = MathF.Min(1f, (scrubber.VolumeRate / tile.Air.Volume) * tile.Air.TotalMoles);
|
var transferMoles = MathF.Min(1f, (scrubber.VolumeRate / tile.Volume) * tile.TotalMoles);
|
||||||
|
|
||||||
// Take a gas sample.
|
// Take a gas sample.
|
||||||
var removed = tile.Air.Remove(transferMoles);
|
var removed = tile.Remove(transferMoles);
|
||||||
|
|
||||||
// Nothing left to remove from the tile.
|
// Nothing left to remove from the tile.
|
||||||
if (MathHelper.CloseTo(removed.TotalMoles, 0f))
|
if (MathHelper.CloseTo(removed.TotalMoles, 0f))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: Entity system dependency
|
atmosphereSystem.ScrubInto(removed, outlet.Air, scrubber.FilterGases);
|
||||||
Get<AtmosphereSystem>().ScrubInto(removed, outlet.Air, scrubber.FilterGases);
|
|
||||||
|
|
||||||
// Remix the gases.
|
// Remix the gases.
|
||||||
tile.AssumeAir(removed);
|
atmosphereSystem.Merge(tile, removed);
|
||||||
}
|
}
|
||||||
else if (scrubber.PumpDirection == ScrubberPumpDirection.Siphoning)
|
else if (scrubber.PumpDirection == ScrubberPumpDirection.Siphoning)
|
||||||
{
|
{
|
||||||
appearance?.SetData(ScrubberVisuals.State, ScrubberState.Siphon);
|
appearance?.SetData(ScrubberVisuals.State, ScrubberState.Siphon);
|
||||||
var transferMoles = tile.Air.TotalMoles * (scrubber.VolumeRate / tile.Air.Volume);
|
var transferMoles = tile.TotalMoles * (scrubber.VolumeRate / tile.Volume);
|
||||||
|
|
||||||
var removed = tile.Air.Remove(transferMoles);
|
var removed = tile.Remove(transferMoles);
|
||||||
|
|
||||||
outlet.AssumeAir(removed);
|
outlet.AssumeAir(removed);
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace Content.Server.Body.Behavior
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Owner.Transform.Coordinates.TryGetTileAir(out var tileAir))
|
if (EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates, true) is not {} tileAir)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ namespace Content.Server.Body.Behavior
|
|||||||
|
|
||||||
public void Exhale(float frameTime)
|
public void Exhale(float frameTime)
|
||||||
{
|
{
|
||||||
if (!Owner.Transform.Coordinates.TryGetTileAir(out var tileAir))
|
if (EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates, true) is not {} tileAir)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using Content.Server.Fluids.Components;
|
using Content.Server.Fluids.Components;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
@@ -247,8 +248,7 @@ namespace Content.Server.Botany.Components
|
|||||||
_updateSpriteAfterUpdate = true;
|
_updateSpriteAfterUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere();
|
var environment = EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates, true)?? GasMixture.SpaceGas;
|
||||||
var environment = tileAtmos?.Air ?? GasMixture.SpaceGas;
|
|
||||||
|
|
||||||
if (Seed.ConsumeGasses.Count > 0)
|
if (Seed.ConsumeGasses.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,16 +21,23 @@ namespace Content.Server.Chemistry.TileReactions
|
|||||||
|
|
||||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||||
{
|
{
|
||||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
|
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
|
||||||
var tileAtmos = tile.GridPosition().GetTileAtmosphere();
|
return ReagentUnit.Zero;
|
||||||
if (tileAtmos == null || !tileAtmos.Hotspot.Valid || tileAtmos.Air == null) return ReagentUnit.Zero;
|
|
||||||
tileAtmos.Air.Temperature =
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
MathF.Max(MathF.Min(tileAtmos.Air.Temperature - (_coolingTemperature * 1000f),
|
|
||||||
tileAtmos.Air.Temperature / _coolingTemperature),
|
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
|
||||||
Atmospherics.TCMB);
|
|
||||||
EntitySystem.Get<AtmosphereSystem>().React(tileAtmos.Air, tileAtmos);
|
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
|
||||||
tileAtmos.Hotspot = new Hotspot();
|
return ReagentUnit.Zero;
|
||||||
tileAtmos.UpdateVisuals();
|
|
||||||
|
environment.Temperature =
|
||||||
|
MathF.Max(MathF.Min(environment.Temperature - (_coolingTemperature * 1000f),
|
||||||
|
environment.Temperature / _coolingTemperature), Atmospherics.TCMB);
|
||||||
|
|
||||||
|
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||||
|
atmosphereSystem.HotspotExtinguish(tile.GridIndex, tile.GridIndices);
|
||||||
|
|
||||||
return ReagentUnit.Zero;
|
return ReagentUnit.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,18 @@ namespace Content.Server.Chemistry.TileReactions
|
|||||||
|
|
||||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||||
{
|
{
|
||||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
|
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
|
||||||
var tileAtmos = tile.GridPosition().GetTileAtmosphere();
|
return ReagentUnit.Zero;
|
||||||
if (tileAtmos?.Air == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
|
|
||||||
tileAtmos.Air.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
EntitySystem.Get<AtmosphereSystem>().React(tileAtmos.Air, tileAtmos);
|
|
||||||
|
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
|
||||||
|
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
|
||||||
|
return ReagentUnit.Zero;
|
||||||
|
|
||||||
|
environment.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
||||||
|
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||||
|
|
||||||
return reactVolume;
|
return reactVolume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
@@ -28,46 +29,17 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
var gridId = new GridId(id);
|
var gridId = new GridId(id);
|
||||||
|
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
|
||||||
{
|
|
||||||
shell.WriteLine("Invalid grid ID.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
||||||
|
|
||||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
|
||||||
{
|
|
||||||
shell.WriteLine("Failed to get grid entity.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
|
||||||
{
|
|
||||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var gam = grid.GetComponent<GridAtmosphereComponent>();
|
|
||||||
var indices = new Vector2i(x, y);
|
var indices = new Vector2i(x, y);
|
||||||
var tile = gam.GetTile(indices);
|
var tile = atmosphereSystem.GetTileMixture(gridId, indices, true);
|
||||||
|
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Invalid coordinates.");
|
shell.WriteLine("Invalid coordinates or tile.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tile.Air == null)
|
tile.AdjustMoles(gasId, moles);
|
||||||
{
|
|
||||||
shell.WriteLine("Can't add gas to that tile.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tile.Air.AdjustMoles(gasId, moles);
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -127,55 +128,39 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
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}");
|
shell.WriteLine($"No grid exists with id {gridId}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
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 tiles = 0;
|
var tiles = 0;
|
||||||
var moles = 0f;
|
var moles = 0f;
|
||||||
|
|
||||||
if (gas == null)
|
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++;
|
tiles++;
|
||||||
moles += tile.Air.TotalMoles;
|
moles += tile.TotalMoles;
|
||||||
|
|
||||||
tile.Air.Clear();
|
tile.Clear();
|
||||||
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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++;
|
tiles++;
|
||||||
moles += tile.Air.TotalMoles;
|
moles += tile.TotalMoles;
|
||||||
|
|
||||||
tile.Air.SetMoles(gas.Value, 0);
|
tile.SetMoles(gas.Value, 0);
|
||||||
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
@@ -27,32 +28,17 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out _))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Invalid grid ID.");
|
shell.WriteLine("Invalid grid ID.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Failed to get grid entity.");
|
tile.AdjustMoles(gasId, moles);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!grid.HasComponent<IGridAtmosphereComponent>())
|
|
||||||
{
|
|
||||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var gam = grid.GetComponent<IGridAtmosphereComponent>();
|
|
||||||
|
|
||||||
foreach (var tile in gam)
|
|
||||||
{
|
|
||||||
tile.Air?.AdjustMoles(gasId, moles);
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
var mixture = new GasMixture(Atmospherics.CellVolume) { Temperature = Atmospherics.T20C };
|
var mixture = new GasMixture(Atmospherics.CellVolume) { Temperature = Atmospherics.T20C };
|
||||||
mixture.AdjustMoles(Gas.Oxygen, Atmospherics.OxygenMolesStandard);
|
mixture.AdjustMoles(Gas.Oxygen, Atmospherics.OxygenMolesStandard);
|
||||||
@@ -40,32 +41,19 @@ namespace Content.Server.Commands.Atmos
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mapManager.TryGetGrid(new GridId(i), out var grid))
|
var gridId = new GridId(i);
|
||||||
|
|
||||||
|
if (!mapManager.TryGetGrid(gridId, out _))
|
||||||
{
|
{
|
||||||
shell.WriteError($"Grid \"{i}\" doesn't exist.");
|
shell.WriteError($"Grid \"{i}\" doesn't exist.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var entity))
|
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
||||||
{
|
{
|
||||||
shell.WriteError($"Grid entity for grid \"{i}\" doesn't exist.");
|
tile.Clear();
|
||||||
continue;
|
atmosphereSystem.Merge(tile, mixture);
|
||||||
}
|
tile.Temperature = mixture.Temperature;
|
||||||
|
|
||||||
var gridAtmosphere = new GridAtmosphereComponent() {Owner = entity};
|
|
||||||
|
|
||||||
// Inject dependencies manually or a NRE will eat your face.
|
|
||||||
IoCManager.InjectDependencies(gridAtmosphere);
|
|
||||||
|
|
||||||
entityManager.ComponentManager.AddComponent(entity, gridAtmosphere, true);
|
|
||||||
|
|
||||||
gridAtmosphere.RepopulateTiles();
|
|
||||||
|
|
||||||
foreach (var tile in gridAtmosphere)
|
|
||||||
{
|
|
||||||
tile.Air = (GasMixture) mixture.Clone();
|
|
||||||
tile.Air.Volume = gridAtmosphere.GetVolumeForCells(1);
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -27,50 +28,20 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
var gridId = new GridId(id);
|
var gridId = new GridId(id);
|
||||||
|
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
|
||||||
{
|
|
||||||
shell.WriteLine("Invalid grid ID.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
||||||
|
|
||||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
|
||||||
{
|
|
||||||
shell.WriteLine("Failed to get grid entity.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
|
||||||
{
|
|
||||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var gam = grid.GetComponent<GridAtmosphereComponent>();
|
|
||||||
var indices = new Vector2i(x, y);
|
var indices = new Vector2i(x, y);
|
||||||
var tile = gam.GetTile(indices);
|
var tile = atmosphereSystem.GetTileMixture(gridId, indices, true);
|
||||||
|
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Invalid coordinates.");
|
shell.WriteLine("Invalid coordinates or tile.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tile.Air == null)
|
|
||||||
{
|
|
||||||
shell.WriteLine("Can't remove gas from that tile.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ratio)
|
if (ratio)
|
||||||
tile.Air.RemoveRatio(amount);
|
tile.RemoveRatio(amount);
|
||||||
else
|
else
|
||||||
tile.Air.Remove(amount);
|
tile.Remove(amount);
|
||||||
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
@@ -38,32 +39,13 @@ namespace Content.Server.Commands.Atmos
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
|
||||||
{
|
|
||||||
shell.WriteLine("Failed to get grid entity.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
|
||||||
{
|
|
||||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var gam = grid.GetComponent<GridAtmosphereComponent>();
|
|
||||||
|
|
||||||
var tiles = 0;
|
var tiles = 0;
|
||||||
foreach (var tile in gam)
|
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
||||||
{
|
{
|
||||||
if (tile.Air == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tiles++;
|
tiles++;
|
||||||
|
tile.Temperature = temperature;
|
||||||
tile.Air.Temperature = temperature;
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.WriteLine($"Changed the temperature of {tiles} tiles.");
|
shell.WriteLine($"Changed the temperature of {tiles} tiles.");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
@@ -27,52 +28,23 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
var gridId = new GridId(id);
|
var gridId = new GridId(id);
|
||||||
|
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
|
||||||
|
|
||||||
if (temperature < Atmospherics.TCMB)
|
if (temperature < Atmospherics.TCMB)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Invalid temperature.");
|
shell.WriteLine("Invalid temperature.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
{
|
|
||||||
shell.WriteLine("Invalid grid ID.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
||||||
|
|
||||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
|
||||||
{
|
|
||||||
shell.WriteLine("Failed to get grid entity.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
|
||||||
{
|
|
||||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var gam = grid.GetComponent<GridAtmosphereComponent>();
|
|
||||||
var indices = new Vector2i(x, y);
|
var indices = new Vector2i(x, y);
|
||||||
var tile = gam.GetTile(indices);
|
var tile = atmosphereSystem.GetTileMixture(gridId, indices, true);
|
||||||
|
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Invalid coordinates.");
|
shell.WriteLine("Invalid coordinates or tile.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tile.Air == null)
|
tile.Temperature = temperature;
|
||||||
{
|
|
||||||
shell.WriteLine("Can't change that tile's temperature.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tile.Air.Temperature = temperature;
|
|
||||||
tile.Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Disposal.Tube.Components;
|
using Content.Server.Disposal.Tube.Components;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
@@ -135,10 +136,11 @@ namespace Content.Server.Disposal.Unit.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.Transform.Coordinates.TryGetTileAtmosphere(out var tileAtmos) &&
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
tileAtmos.Air != null)
|
|
||||||
|
if (atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true) is {} environment)
|
||||||
{
|
{
|
||||||
tileAtmos.AssumeAir(Air);
|
atmosphereSystem.Merge(environment, Air);
|
||||||
Air.Clear();
|
Air.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,19 +274,13 @@ namespace Content.Server.Disposal.Unit.Components
|
|||||||
|
|
||||||
var entryComponent = Owner.EntityManager.ComponentManager.GetComponent<DisposalEntryComponent>(entry);
|
var entryComponent = Owner.EntityManager.ComponentManager.GetComponent<DisposalEntryComponent>(entry);
|
||||||
|
|
||||||
if (Owner.Transform.Coordinates.TryGetTileAtmosphere(out var tileAtmos) &&
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
tileAtmos.Air != null &&
|
|
||||||
tileAtmos.Air.Temperature > 0)
|
if (atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true) is {Temperature: > 0} environment)
|
||||||
{
|
{
|
||||||
var tileAir = tileAtmos.Air;
|
var transferMoles = 0.1f * (0.05f * Atmospherics.OneAtmosphere * 1.01f - Air.Pressure) * Air.Volume / (environment.Temperature * Atmospherics.R);
|
||||||
var transferMoles = 0.1f * (0.05f * Atmospherics.OneAtmosphere * 1.01f - Air.Pressure) * Air.Volume / (tileAir.Temperature * Atmospherics.R);
|
|
||||||
|
|
||||||
Air = tileAir.Remove(transferMoles);
|
Air = environment.Remove(transferMoles);
|
||||||
|
|
||||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
|
||||||
atmosSystem
|
|
||||||
.GetGridAtmosphere(Owner.Transform.Coordinates)?
|
|
||||||
.Invalidate(tileAtmos.GridIndices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entryComponent.TryInsert(this);
|
entryComponent.TryInsert(this);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking.Rules;
|
using Content.Server.GameTicking.Rules;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
@@ -162,10 +163,12 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
_robustRandom.Shuffle(ents);
|
_robustRandom.Shuffle(ents);
|
||||||
var foundATarget = false;
|
var foundATarget = false;
|
||||||
bestTarget = EntityCoordinates.Invalid;
|
bestTarget = EntityCoordinates.Invalid;
|
||||||
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
foreach (var entity in ents)
|
foreach (var entity in ents)
|
||||||
{
|
{
|
||||||
if (!entity.Transform.Coordinates.IsTileAirProbablySafe())
|
if (!atmosphereSystem.IsTileMixtureProbablySafe(entity.Transform.Coordinates))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var distanceFromNearest = float.PositiveInfinity;
|
var distanceFromNearest = float.PositiveInfinity;
|
||||||
foreach (var existing in existingPlayerPoints)
|
foreach (var existing in existingPlayerPoints)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Body.Behavior;
|
using Content.Server.Body.Behavior;
|
||||||
using Content.Server.Body.Circulatory;
|
using Content.Server.Body.Circulatory;
|
||||||
using Content.Server.Temperature.Components;
|
using Content.Server.Temperature.Components;
|
||||||
@@ -282,7 +283,7 @@ namespace Content.Server.Metabolism
|
|||||||
}
|
}
|
||||||
|
|
||||||
// creadth: sweating does not help in airless environment
|
// creadth: sweating does not help in airless environment
|
||||||
if (Owner.Transform.Coordinates.TryGetTileAir(out _, Owner.EntityManager))
|
if (EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates) is not {})
|
||||||
{
|
{
|
||||||
temperatureComponent.RemoveHeat(Math.Min(targetHeat, SweatHeatRegulation));
|
temperatureComponent.RemoveHeat(Math.Min(targetHeat, SweatHeatRegulation));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
@@ -113,19 +114,20 @@ namespace Content.Server.StationEvents.Events
|
|||||||
if (_timeUntilLeak > 0f) return;
|
if (_timeUntilLeak > 0f) return;
|
||||||
_timeUntilLeak += LeakCooldown;
|
_timeUntilLeak += LeakCooldown;
|
||||||
|
|
||||||
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!_foundTile ||
|
if (!_foundTile ||
|
||||||
_targetGrid == null ||
|
_targetGrid == null ||
|
||||||
_targetGrid.Deleted ||
|
_targetGrid.Deleted ||
|
||||||
!_targetGrid.TryGetComponent(out GridAtmosphereComponent? gridAtmos))
|
!atmosphereSystem.IsSimulatedGrid(_targetGrid.Transform.GridID))
|
||||||
{
|
{
|
||||||
Running = false;
|
Running = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var atmos = gridAtmos.GetTile(_targetTile);
|
var environment = atmosphereSystem.GetTileMixture(_targetGrid.Transform.GridID, _targetTile, true);
|
||||||
|
|
||||||
atmos?.Air?.AdjustMoles(_leakGas, LeakCooldown * _molesPerSecond);
|
environment?.AdjustMoles(_leakGas, LeakCooldown * _molesPerSecond);
|
||||||
atmos?.Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Shutdown()
|
public override void Shutdown()
|
||||||
@@ -144,21 +146,21 @@ namespace Content.Server.StationEvents.Events
|
|||||||
|
|
||||||
private void Spark()
|
private void Spark()
|
||||||
{
|
{
|
||||||
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
||||||
if (robustRandom.NextFloat() <= SparkChance)
|
if (robustRandom.NextFloat() <= SparkChance)
|
||||||
{
|
{
|
||||||
if (!_foundTile ||
|
if (!_foundTile ||
|
||||||
_targetGrid == null ||
|
_targetGrid == null ||
|
||||||
_targetGrid.Deleted ||
|
_targetGrid.Deleted ||
|
||||||
!_targetGrid.TryGetComponent(out GridAtmosphereComponent? gridAtmos))
|
!atmosphereSystem.IsSimulatedGrid(_targetGrid.Transform.GridID))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var atmos = gridAtmos.GetTile(_targetTile);
|
|
||||||
// Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that
|
// Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that
|
||||||
// it COULD start potentially start a bigger fire.
|
// it COULD start potentially start a bigger fire.
|
||||||
atmos?.HotspotExpose(700f, 50f, true);
|
atmosphereSystem.HotspotExpose(_targetGrid.Transform.GridID, _targetTile, 700f, 50f, true);
|
||||||
SoundSystem.Play(Filter.Pvs(_targetCoords), "/Audio/Effects/sparks4.ogg", _targetCoords);
|
SoundSystem.Play(Filter.Pvs(_targetCoords), "/Audio/Effects/sparks4.ogg", _targetCoords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +173,7 @@ namespace Content.Server.StationEvents.Events
|
|||||||
if (!IoCManager.Resolve<IMapManager>().TryGetGrid(defaultGridId, out var grid) ||
|
if (!IoCManager.Resolve<IMapManager>().TryGetGrid(defaultGridId, out var grid) ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetEntity(grid.GridEntityId, out _targetGrid)) return false;
|
!IoCManager.Resolve<IEntityManager>().TryGetEntity(grid.GridEntityId, out _targetGrid)) return false;
|
||||||
|
|
||||||
_targetGrid.EnsureComponent(out GridAtmosphereComponent gridAtmos);
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
robustRandom ??= IoCManager.Resolve<IRobustRandom>();
|
robustRandom ??= IoCManager.Resolve<IRobustRandom>();
|
||||||
var found = false;
|
var found = false;
|
||||||
var gridBounds = grid.WorldBounds;
|
var gridBounds = grid.WorldBounds;
|
||||||
@@ -183,7 +185,7 @@ namespace Content.Server.StationEvents.Events
|
|||||||
var randomY = robustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
var randomY = robustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
||||||
|
|
||||||
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
||||||
if (gridAtmos.IsSpace(tile) || gridAtmos.IsAirBlocked(tile)) continue;
|
if (atmosphereSystem.IsTileSpace(defaultGridId, tile) || atmosphereSystem.IsTileAirBlocked(defaultGridId, tile)) continue;
|
||||||
found = true;
|
found = true;
|
||||||
_targetCoords = grid.GridTileToLocal(tile);
|
_targetCoords = grid.GridTileToLocal(tile);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Act;
|
using Content.Server.Act;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using Content.Server.Explosion;
|
using Content.Server.Explosion;
|
||||||
@@ -212,8 +213,7 @@ namespace Content.Server.Tools.Components
|
|||||||
PlaySoundCollection("WelderOn", -5);
|
PlaySoundCollection("WelderOn", -5);
|
||||||
_welderSystem.Subscribe(this);
|
_welderSystem.Subscribe(this);
|
||||||
|
|
||||||
Owner.Transform.Coordinates
|
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700, 50, true);
|
||||||
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -256,8 +256,7 @@ namespace Content.Server.Tools.Components
|
|||||||
|
|
||||||
_solutionComponent?.TryRemoveReagent("WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
_solutionComponent?.TryRemoveReagent("WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
||||||
|
|
||||||
Owner.Transform.Coordinates
|
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700, 50, true);
|
||||||
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
|
|
||||||
|
|
||||||
if (Fuel == 0)
|
if (Fuel == 0)
|
||||||
ToggleWelderStatus();
|
ToggleWelderStatus();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.CombatMode;
|
using Content.Server.CombatMode;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
using Content.Server.Interaction.Components;
|
using Content.Server.Interaction.Components;
|
||||||
@@ -182,9 +183,9 @@ namespace Content.Server.Weapon.Ranged
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_canHotspot && user.Transform.Coordinates.TryGetTileAtmosphere(out var tile))
|
if (_canHotspot)
|
||||||
{
|
{
|
||||||
tile.HotspotExpose(700, 50);
|
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(user.Transform.Coordinates, 700, 50);
|
||||||
}
|
}
|
||||||
FireHandler?.Invoke(user, targetPos);
|
FireHandler?.Invoke(user, targetPos);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user