Gas Thermo ECS (#6442)
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -11,7 +7,7 @@ using Robust.Shared.ViewVariables;
|
||||
namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class GasThermoMachineComponent : Component, IRefreshParts, ISerializationHooks
|
||||
public sealed class GasThermoMachineComponent : Component, ISerializationHooks
|
||||
{
|
||||
[DataField("inlet")]
|
||||
public string InletName { get; set; } = "pipe";
|
||||
@@ -40,39 +36,6 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
public float InitialMinTemperature { get; private set; }
|
||||
public float InitialMaxTemperature { get; private set; }
|
||||
|
||||
void IRefreshParts.RefreshParts(IEnumerable<MachinePartComponent> parts)
|
||||
{
|
||||
var matterBinRating = 0;
|
||||
var laserRating = 0;
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
switch (part.PartType)
|
||||
{
|
||||
case MachinePart.MatterBin:
|
||||
matterBinRating += part.Rating;
|
||||
break;
|
||||
case MachinePart.Laser:
|
||||
laserRating += part.Rating;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HeatCapacity = 5000 * MathF.Pow((matterBinRating - 1), 2);
|
||||
|
||||
switch (Mode)
|
||||
{
|
||||
// 573.15K with stock parts.
|
||||
case ThermoMachineMode.Heater:
|
||||
MaxTemperature = Atmospherics.T20C + (InitialMaxTemperature * laserRating);
|
||||
break;
|
||||
// 73.15K with stock parts.
|
||||
case ThermoMachineMode.Freezer:
|
||||
MinTemperature = MathF.Max(Atmospherics.T0C - InitialMinTemperature + laserRating * 15f, Atmospherics.TCMB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
InitialMinTemperature = MinTemperature;
|
||||
|
||||
Reference in New Issue
Block a user