Files
tbd-station-14/Content.Server/Atmos/Components/AtmosExposedComponent.cs
Vera Aguilera Puerto 6cea9cb973 Refactor Flammable to be ECS. (#4671)
- Refactor IHotItem into IsHotEvent.
- Refactor IFireAct into TileFireEvent.
2021-09-22 11:05:33 +02:00

38 lines
1.4 KiB
C#

using Content.Server.Atmos.EntitySystems;
using Content.Server.Temperature.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.Components
{
// TODO: Kill this. With fire.
/// <summary>
/// Represents that entity can be exposed to Atmos
/// </summary>
[RegisterComponent]
public class AtmosExposedComponent : Component
{
public override string Name => "AtmosExposed";
[ViewVariables]
[ComponentDependency] private readonly TemperatureComponent? _temperatureComponent = null;
[ViewVariables]
[ComponentDependency] private readonly BarotraumaComponent? _barotraumaComponent = null;
public void Update(GasMixture air, float frameDelta, AtmosphereSystem atmosphereSystem)
{
if (_temperatureComponent != null)
{
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(air.Pressure);
}
}
}