diff --git a/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs b/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs
index eab9addecd..0a4ba4a322 100644
--- a/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs
+++ b/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs
@@ -1,43 +1,82 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Unary.Components;
-using Robust.Shared.Serialization;
namespace Content.Server.Atmos.Piping.Unary.Components
{
[RegisterComponent]
- public sealed class GasThermoMachineComponent : Component, ISerializationHooks
+ public sealed class GasThermoMachineComponent : Component
{
[DataField("inlet")]
- public string InletName { get; set; } = "pipe";
+ public string InletName = "pipe";
[ViewVariables(VVAccess.ReadWrite)]
- public bool Enabled { get; set; } = true;
+ [DataField("enabled")]
+ public bool Enabled = true;
+ ///
+ /// Current maximum temperature, calculated from and the quality of matter
+ /// bins. The heat capacity effectively determines the rate at which the thermo machine can add or remove
+ /// heat from a pipenet.
+ ///
[ViewVariables(VVAccess.ReadWrite)]
- public float HeatCapacity { get; set; } = 0;
+ public float HeatCapacity = 10000;
+ ///
+ /// Base heat capacity of the device. Actual heat capacity is calculated by taking this number and doubling
+ /// it for every matter bin quality tier above one.
+ ///
+ [DataField("baseHeatCapacity")]
+ public float BaseHeatCapacity = 5000;
+
+ [DataField("targetTemperature")]
[ViewVariables(VVAccess.ReadWrite)]
- public float TargetTemperature { get; set; } = Atmospherics.T20C;
+ public float TargetTemperature = Atmospherics.T20C;
[DataField("mode")]
+ public ThermoMachineMode Mode = ThermoMachineMode.Freezer;
+
+ ///
+ /// Current minimum temperature, calculated from and .
+ ///
[ViewVariables(VVAccess.ReadWrite)]
- public ThermoMachineMode Mode { get; set; } = ThermoMachineMode.Freezer;
+ public float MinTemperature;
- [DataField("minTemperature")]
+ ///
+ /// Current maximum temperature, calculated from and .
+ ///
[ViewVariables(VVAccess.ReadWrite)]
- public float MinTemperature { get; set; } = Atmospherics.T20C;
+ public float MaxTemperature;
- [DataField("maxTemperature")]
+ ///
+ /// Minimum temperature the device can reach with a 0 total laser quality. Usually the quality will be at
+ /// least 1.
+ ///
+ [DataField("baseMinTemperature")]
[ViewVariables(VVAccess.ReadWrite)]
- public float MaxTemperature { get; set; } = Atmospherics.T20C;
+ public float BaseMinTemperature = 96.625f; // Selected so that tier-1 parts can reach 73.15k
- public float InitialMinTemperature { get; private set; }
- public float InitialMaxTemperature { get; private set; }
+ ///
+ /// Maximum temperature the device can reach with a 0 total laser quality. Usually the quality will be at
+ /// least 1.
+ ///
+ [DataField("baseMaxTemperature")]
+ [ViewVariables(VVAccess.ReadWrite)]
+ public float BaseMaxTemperature = Atmospherics.T20C;
- void ISerializationHooks.AfterDeserialization()
- {
- InitialMinTemperature = MinTemperature;
- InitialMaxTemperature = MaxTemperature;
- }
+ ///
+ /// Decrease in minimum temperature, per unit machine part quality.
+ ///
+ [DataField("minTemperatureDelta")]
+ [ViewVariables(VVAccess.ReadWrite)]
+ public float MinTemperatureDelta = 23.475f; // selected so that tier-4 parts can reach TCMB
+
+ ///
+ /// Change in maximum temperature, per unit machine part quality.
+ ///
+ [DataField("maxTemperatureDelta")]
+ [ViewVariables(VVAccess.ReadWrite)]
+ public float MaxTemperatureDelta = 300;
}
}
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
index c5df8d75a6..09e35b0892 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
@@ -46,7 +46,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
var airHeatCapacity = _atmosphereSystem.GetHeatCapacity(inlet.Air);
var combinedHeatCapacity = airHeatCapacity + thermoMachine.HeatCapacity;
- var oldTemperature = inlet.Air.Temperature;
if (!MathHelper.CloseTo(combinedHeatCapacity, 0, 0.001f))
{
@@ -70,6 +69,9 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnGasThermoRefreshParts(EntityUid uid, GasThermoMachineComponent component, RefreshPartsEvent args)
{
+ // Here we evaluate the average quality of relevant machine parts.
+ var nLasers = 0;
+ var nBins= 0;
var matterBinRating = 0;
var laserRating = 0;
@@ -78,25 +80,32 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
switch (part.PartType)
{
case MachinePart.MatterBin:
+ nBins += 1;
matterBinRating += part.Rating;
break;
case MachinePart.Laser:
+ nLasers += 1;
laserRating += part.Rating;
break;
}
}
+ laserRating /= nLasers;
+ matterBinRating /= nBins;
- component.HeatCapacity = 5000 * MathF.Pow((matterBinRating - 1), 2);
+ component.HeatCapacity = 5000 * MathF.Pow(matterBinRating, 2);
switch (component.Mode)
{
- // 573.15K with stock parts.
+ // 593.15K with stock parts.
case ThermoMachineMode.Heater:
- component.MaxTemperature = Atmospherics.T20C + (component.InitialMaxTemperature * laserRating);
+ component.MaxTemperature = component.BaseMaxTemperature + component.MaxTemperatureDelta * laserRating;
+ component.MinTemperature = Atmospherics.T20C;
break;
// 73.15K with stock parts.
case ThermoMachineMode.Freezer:
- component.MinTemperature = MathF.Max(Atmospherics.T0C - component.InitialMinTemperature + laserRating * 15f, Atmospherics.TCMB);
+ component.MinTemperature = MathF.Max(
+ component.BaseMinTemperature - component.MinTemperatureDelta * laserRating, Atmospherics.TCMB);
+ component.MaxTemperature = Atmospherics.T20C;
break;
}
diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml
index 1e88e684cf..dc447e1bb4 100644
--- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml
+++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml
@@ -218,7 +218,6 @@
enabledState: freezer_on
- type: GasThermoMachine
mode: Freezer
- minTemperature: 73.15
- type: Machine
board: ThermomachineFreezerMachineCircuitBoard
@@ -244,6 +243,5 @@
enabledState: heater_on
- type: GasThermoMachine
mode: Heater
- maxTemperature: 573.15 # This is changed when parts are refreshed.
- type: Machine
board: ThermomachineHeaterMachineCircuitBoard