Fixes not taking pressure damage in space.

Fixes #4415
This commit is contained in:
Vera Aguilera Puerto
2021-08-04 09:48:49 +02:00
parent b7d049a52c
commit 13ceae872b
5 changed files with 16 additions and 15 deletions

View File

@@ -23,23 +23,20 @@ namespace Content.Server.Atmos.Components
[ViewVariables]
[ComponentDependency] private readonly FlammableComponent? _flammableComponent = null;
public void Update(TileAtmosphere tile, float frameDelta, AtmosphereSystem atmosphereSystem)
public void Update(GasMixture air, float frameDelta, AtmosphereSystem atmosphereSystem)
{
if (_temperatureComponent != null)
{
if (tile.Air != null)
{
var temperatureDelta = tile.Air.Temperature - _temperatureComponent.CurrentTemperature;
var tileHeatCapacity = atmosphereSystem.GetHeatCapacity(tile.Air);
var heat = temperatureDelta * (tileHeatCapacity * _temperatureComponent.HeatCapacity / (tileHeatCapacity + _temperatureComponent.HeatCapacity));
_temperatureComponent.ReceiveHeat(heat);
}
var temperatureDelta = air.Temperature - _temperatureComponent.CurrentTemperature;
var tileHeatCapacity = atmosphereSystem.GetHeatCapacity(air);
var heat = temperatureDelta * (tileHeatCapacity * _temperatureComponent.HeatCapacity / (tileHeatCapacity + _temperatureComponent.HeatCapacity));
_temperatureComponent.ReceiveHeat(heat);
_temperatureComponent.Update();
}
_barotraumaComponent?.Update(tile.Air?.Pressure ?? 0);
_barotraumaComponent?.Update(air.Pressure);
_flammableComponent?.Update(tile);
_flammableComponent?.Update(air);
}
}
}

View File

@@ -63,7 +63,7 @@ namespace Content.Server.Atmos.Components
UpdateAppearance();
}
public void Update(TileAtmosphere tile)
public void Update(GasMixture air)
{
// Slowly dry ourselves off if wet.
if (FireStacks < 0)
@@ -104,13 +104,13 @@ namespace Content.Server.Atmos.Components
}
// If we're in an oxygenless environment, put the fire out.
if (tile.Air?.GetMoles(Gas.Oxygen) < 1f)
if (air.GetMoles(Gas.Oxygen) < 1f)
{
Extinguish();
return;
}
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(tile.GridIndex, tile.GridIndices, 700f, 50f, true);
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700f, 50f, true);
var physics = Owner.GetComponent<IPhysBody>();

View File

@@ -670,7 +670,7 @@ namespace Content.Server.Atmos.EntitySystems
public GasMixture? GetTileMixture(EntityCoordinates coordinates, bool invalidate = false)
{
return TryGetGridAndTile(coordinates, out var tuple)
? GetTileMixture(tuple.Value.Grid, tuple.Value.Tile, invalidate) : null;
? GetTileMixture(tuple.Value.Grid, tuple.Value.Tile, invalidate) : GasMixture.SpaceGas;
}
/// <summary>

View File

@@ -71,7 +71,7 @@ namespace Content.Server.Atmos.EntitySystems
foreach (var exposed in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>())
{
// TODO ATMOS: Kill this with fire.
var tile = GetTileAtmosphereOrCreateSpace(exposed.Owner.Transform.Coordinates);
var tile = GetTileMixture(exposed.Owner.Transform.Coordinates);
if (tile == null) continue;
exposed.Update(tile, _exposedTimer, this);
}

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix
message: Fixes mobs not taking pressure damage on space.