Fire damage (#2024)

* Moved the uplink creation code to the PresetSuspicion.Start method to ensure uplink created when we give the traitor role
Moved the starting TC balance to cvars

* Added component to handle interaction with Atmospheric system
Added damage from high and cold temperature

* renamed AtmoExposable to AtmosExposed
moved AtmosExposed updates to its own system
refactored TemperatureComponent
renamed fire to heat
added null check for Air
added self-heating and self-cooling to body system

* small refactoring for checking on airless tile in MetabolismComponent

* Added component to handle interaction with Atmospheric system
Added damage from high and cold temperature

* renamed AtmoExposable to AtmosExposed
moved AtmosExposed updates to its own system
refactored TemperatureComponent
renamed fire to heat
added null check for Air
added self-heating and self-cooling to body system

* small refactoring for checking on airless tile in MetabolismComponent

* Removed Pressure property from BarotraumaComponent
Changed CanShiver method to match style of other CanX method in ActionBlockerSystem

* Merged EntityCoordinates and changed components to reflect the change

* Fix typo

* Wrapped string to Loc.GetString
Added CanSweat
Refactored dead state check
This commit is contained in:
creadth
2020-09-09 18:03:27 +03:00
committed by GitHub
parent 5120627ca2
commit 7baa0a4391
16 changed files with 355 additions and 108 deletions

View File

@@ -19,9 +19,9 @@ namespace Content.Server.Atmos
return gridAtmos?.GetTile(coordinates);
}
public static GasMixture? GetTileAir(this EntityCoordinates coordinates)
public static GasMixture? GetTileAir(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
{
return coordinates.GetTileAtmosphere()?.Air;
return coordinates.GetTileAtmosphere(entityManager)?.Air;
}
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
@@ -30,10 +30,10 @@ namespace Content.Server.Atmos
return !Equals(atmosphere = coordinates.GetTileAtmosphere()!, default);
}
public static bool TryGetTileAir(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air)
public static bool TryGetTileAir(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air, IEntityManager? entityManager = null)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
return !Equals(air = coordinates.GetTileAir()!, default);
return !Equals(air = coordinates.GetTileAir(entityManager)!, default);
}
public static TileAtmosphere? GetTileAtmosphere(this MapIndices indices, GridId gridId)

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Atmos
public int AtmosCooldown { get; set; } = 0;
[ViewVariables]
private float _temperature = Atmospherics.T20C;
public float Temperature {get; private set; } = Atmospherics.T20C;
[ViewVariables]
private float _temperatureArchived = Atmospherics.T20C;
@@ -132,7 +132,7 @@ namespace Content.Server.Atmos
{
Air?.Archive();
_archivedCycle = fireCount;
_temperatureArchived = _temperature;
_temperatureArchived = Temperature;
}
public void HotspotExpose(float exposedTemperature, float exposedVolume, bool soh = false)
@@ -869,10 +869,10 @@ namespace Content.Server.Atmos
// Conduct with air on my tile if I have it
if (!BlocksAir)
{
_temperature = Air.TemperatureShare(ThermalConductivity, _temperature, HeatCapacity);
Temperature = Air.TemperatureShare(ThermalConductivity, Temperature, HeatCapacity);
}
FinishSuperconduction(BlocksAir ? _temperature : Air.Temperature);
FinishSuperconduction(BlocksAir ? Temperature : Air.Temperature);
}
private void FinishSuperconduction(float temperature)
@@ -897,7 +897,7 @@ namespace Content.Server.Atmos
other.TemperatureShareMutualSolid(this, ThermalConductivity);
}
TemperatureExpose(null, _temperature, _gridAtmosphereComponent.GetVolumeForCells(1));
TemperatureExpose(null, Temperature, _gridAtmosphereComponent.GetVolumeForCells(1));
return;
}
@@ -915,8 +915,8 @@ namespace Content.Server.Atmos
private void TemperatureShareOpenToSolid(TileAtmosphere other)
{
other._temperature =
Air.TemperatureShare(other.ThermalConductivity, other._temperature, other.HeatCapacity);
other.Temperature =
Air.TemperatureShare(other.ThermalConductivity, other.Temperature, other.HeatCapacity);
}
private void TemperatureShareMutualSolid(TileAtmosphere other, float conductionCoefficient)
@@ -928,15 +928,15 @@ namespace Content.Server.Atmos
var heat = conductionCoefficient * deltaTemperature *
(HeatCapacity * other.HeatCapacity / (HeatCapacity + other.HeatCapacity));
_temperature -= heat / HeatCapacity;
other._temperature += heat / other.HeatCapacity;
Temperature -= heat / HeatCapacity;
other.Temperature += heat / other.HeatCapacity;
}
}
public void RadiateToSpace()
{
// Considering 0ºC as the break even point for radiation in and out.
if (_temperature > Atmospherics.T0C)
if (Temperature > Atmospherics.T0C)
{
// Hardcoded space temperature.
var deltaTemperature = (_temperatureArchived - Atmospherics.TCMB);
@@ -945,7 +945,7 @@ namespace Content.Server.Atmos
var heat = ThermalConductivity * deltaTemperature * (HeatCapacity *
Atmospherics.HeatCapacityVacuum / (HeatCapacity + Atmospherics.HeatCapacityVacuum));
_temperature -= heat;
Temperature -= heat;
}
}
}