2021-07-17 02:37:09 +02:00
|
|
|
|
using Content.Server.Atmos.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Server.Temperature.Components;
|
2020-09-09 18:03:27 +03:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-13 21:51:54 +02:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2020-09-09 18:03:27 +03:00
|
|
|
|
|
2021-06-19 13:25:05 +02:00
|
|
|
|
namespace Content.Server.Atmos.Components
|
2020-09-09 18:03:27 +03:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2020-09-22 15:40:04 +02:00
|
|
|
|
/// Represents that entity can be exposed to Atmos
|
2020-09-09 18:03:27 +03:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
|
public class AtmosExposedComponent
|
|
|
|
|
|
: Component
|
|
|
|
|
|
{
|
|
|
|
|
|
public override string Name => "AtmosExposed";
|
|
|
|
|
|
|
2020-10-13 21:51:54 +02:00
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
[ComponentDependency] private readonly TemperatureComponent? _temperatureComponent = null;
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
[ComponentDependency] private readonly BarotraumaComponent? _barotraumaComponent = null;
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
[ComponentDependency] private readonly FlammableComponent? _flammableComponent = null;
|
|
|
|
|
|
|
2021-08-04 09:48:49 +02:00
|
|
|
|
public void Update(GasMixture air, float frameDelta, AtmosphereSystem atmosphereSystem)
|
2020-09-09 18:03:27 +03:00
|
|
|
|
{
|
2020-10-13 21:51:54 +02:00
|
|
|
|
if (_temperatureComponent != null)
|
2020-09-09 18:03:27 +03:00
|
|
|
|
{
|
2021-08-04 09:48:49 +02:00
|
|
|
|
var temperatureDelta = air.Temperature - _temperatureComponent.CurrentTemperature;
|
|
|
|
|
|
var tileHeatCapacity = atmosphereSystem.GetHeatCapacity(air);
|
|
|
|
|
|
var heat = temperatureDelta * (tileHeatCapacity * _temperatureComponent.HeatCapacity / (tileHeatCapacity + _temperatureComponent.HeatCapacity));
|
|
|
|
|
|
_temperatureComponent.ReceiveHeat(heat);
|
2020-10-13 21:51:54 +02:00
|
|
|
|
_temperatureComponent.Update();
|
2020-09-09 18:03:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-08-04 09:48:49 +02:00
|
|
|
|
_barotraumaComponent?.Update(air.Pressure);
|
2020-09-09 18:03:27 +03:00
|
|
|
|
|
2021-08-04 09:48:49 +02:00
|
|
|
|
_flammableComponent?.Update(air);
|
2020-09-09 18:03:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|