2020-10-13 21:51:54 +02:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
using Content.Server.Atmos;
|
2020-09-09 18:03:27 +03:00
|
|
|
|
using Content.Server.GameObjects.Components.Temperature;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-13 21:51:54 +02:00
|
|
|
|
using Robust.Shared.GameObjects.ComponentDependencies;
|
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
2020-09-09 18:03:27 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.Components.Atmos
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <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;
|
|
|
|
|
|
|
2020-09-22 15:40:04 +02:00
|
|
|
|
public void Update(TileAtmosphere tile, float frameDelta)
|
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
|
|
|
|
{
|
|
|
|
|
|
if (tile.Air != null)
|
|
|
|
|
|
{
|
2020-10-13 21:51:54 +02:00
|
|
|
|
var temperatureDelta = tile.Air.Temperature - _temperatureComponent.CurrentTemperature;
|
|
|
|
|
|
var heat = temperatureDelta * (tile.Air.HeatCapacity * _temperatureComponent.HeatCapacity / (tile.Air.HeatCapacity + _temperatureComponent.HeatCapacity));
|
|
|
|
|
|
_temperatureComponent.ReceiveHeat(heat);
|
2020-09-09 18:03:27 +03:00
|
|
|
|
}
|
2020-10-13 21:51:54 +02:00
|
|
|
|
_temperatureComponent.Update();
|
2020-09-09 18:03:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-13 21:51:54 +02:00
|
|
|
|
_barotraumaComponent?.Update(tile.Air?.Pressure ?? 0);
|
2020-09-09 18:03:27 +03:00
|
|
|
|
|
2020-10-13 21:51:54 +02:00
|
|
|
|
_flammableComponent?.Update(tile);
|
2020-09-09 18:03:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|