Refactors TemperatureComponent and AtmosExposed to ECS (#4927)

Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
Flipp Syder
2021-10-29 01:18:43 -07:00
committed by GitHub
parent 68e5a204e3
commit c7c651e3de
7 changed files with 185 additions and 117 deletions

View File

@@ -1,11 +1,8 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Temperature.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
using Robust.Shared.GameObjects;
namespace Content.Server.Atmos.Components
{
// TODO: Kill this. With fire.
// not if i get there first - Flipp
/// <summary>
/// Represents that entity can be exposed to Atmos
/// </summary>
@@ -13,21 +10,5 @@ namespace Content.Server.Atmos.Components
public class AtmosExposedComponent : Component
{
public override string Name => "AtmosExposed";
[ViewVariables]
[ComponentDependency] private readonly TemperatureComponent? _temperatureComponent = null;
public void Update(GasMixture air, float frameDelta, AtmosphereSystem atmosphereSystem)
{
// TODO: I'm coming for you next, TemperatureComponent... Fear me for I am death, destroyer of shitcode.
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();
}
}
}
}