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
|
|
|
|
{
|
2021-09-22 11:05:33 +02:00
|
|
|
|
// TODO: Kill this. With fire.
|
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]
|
2021-09-22 11:05:33 +02:00
|
|
|
|
public class AtmosExposedComponent : Component
|
2020-09-09 18:03:27 +03:00
|
|
|
|
{
|
|
|
|
|
|
public override string Name => "AtmosExposed";
|
|
|
|
|
|
|
2020-10-13 21:51:54 +02:00
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
[ComponentDependency] private readonly TemperatureComponent? _temperatureComponent = 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
|
|
|
|
{
|
2021-09-22 13:02:25 +02:00
|
|
|
|
// TODO: I'm coming for you next, TemperatureComponent... Fear me for I am death, destroyer of shitcode.
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|