diff --git a/Content.Server/Atmos/EntitySystems/GasThermoSystem.cs b/Content.Server/Atmos/EntitySystems/GasThermoSystem.cs deleted file mode 100644 index 1f62dba223..0000000000 --- a/Content.Server/Atmos/EntitySystems/GasThermoSystem.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Content.Server.Atmos.Piping.Unary.Components; -using Content.Server.Construction; -using Content.Shared.Atmos; -using Robust.Shared.GameObjects; - -namespace Content.Server.Atmos.EntitySystems; - -public sealed class GasThermoSystem : EntitySystem -{ - public override void Initialize() - { - base.Initialize(); - SubscribeLocalEvent(OnGasThermoRefreshParts); - } - - private static void OnGasThermoRefreshParts(EntityUid uid, GasThermoMachineComponent component, RefreshPartsEvent args) - { - var matterBinRating = 0; - var laserRating = 0; - - foreach (var part in args.Parts) - { - switch (part.PartType) - { - case MachinePart.MatterBin: - matterBinRating += part.Rating; - break; - case MachinePart.Laser: - laserRating += part.Rating; - break; - } - } - - component.HeatCapacity = 5000 * MathF.Pow((matterBinRating - 1), 2); - - switch (component.Mode) - { - // 573.15K with stock parts. - case ThermoMachineMode.Heater: - component.MaxTemperature = Atmospherics.T20C + (component.InitialMaxTemperature * laserRating); - break; - // 73.15K with stock parts. - case ThermoMachineMode.Freezer: - component.MinTemperature = MathF.Max(Atmospherics.T0C - component.InitialMinTemperature + laserRating * 15f, Atmospherics.TCMB); - break; - } - } -} diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs index 240dec9e99..4b52b6afb8 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs @@ -1,8 +1,10 @@ using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.Piping.Components; using Content.Server.Atmos.Piping.Unary.Components; +using Content.Server.Construction; using Content.Server.NodeContainer; using Content.Server.NodeContainer.Nodes; +using Content.Shared.Atmos; using Content.Shared.Atmos.Piping; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -21,6 +23,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems SubscribeLocalEvent(OnThermoMachineUpdated); SubscribeLocalEvent(OnThermoMachineLeaveAtmosphere); + SubscribeLocalEvent(OnGasThermoRefreshParts); } private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args) @@ -39,7 +42,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems var combinedHeatCapacity = airHeatCapacity + thermoMachine.HeatCapacity; var oldTemperature = inlet.Air.Temperature; - if (combinedHeatCapacity > 0) + if (!MathHelper.CloseTo(combinedHeatCapacity, 0, 0.001f)) { appearance?.SetData(ThermoMachineVisuals.Enabled, true); var combinedEnergy = thermoMachine.HeatCapacity * thermoMachine.TargetTemperature + airHeatCapacity * inlet.Air.Temperature; @@ -56,5 +59,38 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems appearance.SetData(ThermoMachineVisuals.Enabled, false); } } + + private void OnGasThermoRefreshParts(EntityUid uid, GasThermoMachineComponent component, RefreshPartsEvent args) + { + var matterBinRating = 0; + var laserRating = 0; + + foreach (var part in args.Parts) + { + switch (part.PartType) + { + case MachinePart.MatterBin: + matterBinRating += part.Rating; + break; + case MachinePart.Laser: + laserRating += part.Rating; + break; + } + } + + component.HeatCapacity = 5000 * MathF.Pow((matterBinRating - 1), 2); + + switch (component.Mode) + { + // 573.15K with stock parts. + case ThermoMachineMode.Heater: + component.MaxTemperature = Atmospherics.T20C + (component.InitialMaxTemperature * laserRating); + break; + // 73.15K with stock parts. + case ThermoMachineMode.Freezer: + component.MinTemperature = MathF.Max(Atmospherics.T0C - component.InitialMinTemperature + laserRating * 15f, Atmospherics.TCMB); + break; + } + } } } diff --git a/Resources/Prototypes/Catalog/Research/technologies.yml b/Resources/Prototypes/Catalog/Research/technologies.yml index 736428184b..2e7b4fa925 100644 --- a/Resources/Prototypes/Catalog/Research/technologies.yml +++ b/Resources/Prototypes/Catalog/Research/technologies.yml @@ -264,6 +264,19 @@ - SheetRGlass - SheetGlass1 +- type: technology + name: advanced atmospherics technology + id: AdvancedAtmosTechnology + description: As if it can get more advanced. + icon: + sprite: Structures/Piping/Atmospherics/thermomachine.rsi + state: freezer_off + requiredPoints: 3000 + requiredTechnologies: + - IndustrialEngineering + unlockedRecipes: + - ThermomachineFreezerMachineCircuitBoard + # Avionics Circuitry Technology Tree - type: technology diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index cae196edd0..9a51e7f4df 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -46,6 +46,40 @@ ExamineName: Glass Beaker +- type: entity + id: ThermomachineFreezerMachineCircuitBoard + parent: BaseMachineCircuitboard + name: Freezer Thermomachine (Machine Board) + description: Looks like you could use a screwdriver to change the board type. + components: + - type: MachineBoard + prototype: GasThermoMachineFreezer + requirements: + MatterBin: 3 + Laser: 3 + materialRequirements: + Cable: 5 + - type: Construction + graph: ThermomachineBoard + node: freezer + +- type: entity + id: ThermomachineHeaterMachineCircuitBoard + parent: BaseMachineCircuitboard + name: Heater Thermomachine (Machine Board) + description: Looks like you could use a screwdriver to change the board type. + components: + - type: MachineBoard + prototype: GasThermoMachineHeater + requirements: + MatterBin: 3 + Laser: 3 + materialRequirements: + Cable: 5 + - type: Construction + graph: ThermomachineBoard + node: heater + - type: entity id: CloningPodMachineCircuitboard parent: BaseMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 2378c0724c..80c0025d0b 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -218,6 +218,7 @@ protolatherecipes: - SMESMachineCircuitboard - SubstationMachineCircuitboard + - ThermomachineFreezerMachineCircuitBoard - CloningPodMachineCircuitboard - MedicalScannerMachineCircuitboard - ChemMasterMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index 2f74a03beb..ad975b07f0 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -148,6 +148,12 @@ - type: GasThermoMachine - type: AtmosPipeColor - type: AtmosDevice + - type: Construction + graph: Machine + node: machine + - type: Wires + BoardName: "Thermomachine" + LayoutId: Thermomachine - type: NodeContainer nodes: pipe: @@ -177,6 +183,8 @@ - type: GasThermoMachine mode: Freezer minTemperature: 73.15 + - type: Machine + board: ThermomachineFreezerMachineCircuitBoard - type: entity parent: BaseGasThermoMachine @@ -200,3 +208,5 @@ - type: GasThermoMachine mode: Heater maxTemperature: 573.15 # This is changed when parts are refreshed. + - type: Machine + board: ThermomachineHeaterMachineCircuitBoard diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml new file mode 100644 index 0000000000..8818e5d1ba --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml @@ -0,0 +1,18 @@ +- type: constructionGraph + id: ThermomachineBoard + start: freezer + graph: + - node: freezer + entity: ThermomachineFreezerMachineCircuitBoard + edges: + - to: heater + steps: + - tool: Screwing + doAfter: 2 + - node: heater + entity: ThermomachineHeaterMachineCircuitBoard + edges: + - to: freezer + steps: + - tool: Screwing + doAfter: 2 diff --git a/Resources/Prototypes/Recipes/Lathes/electronics.yml b/Resources/Prototypes/Recipes/Lathes/electronics.yml index 3e881cd04a..e1acd7b760 100644 --- a/Resources/Prototypes/Recipes/Lathes/electronics.yml +++ b/Resources/Prototypes/Recipes/Lathes/electronics.yml @@ -71,6 +71,16 @@ Glass: 900 Gold: 100 +- type: latheRecipe + id: ThermomachineFreezerMachineCircuitBoard + icon: Objects/Misc/module.rsi/id_mod.png + result: ThermomachineFreezerMachineCircuitBoard + completetime: 1000 + materials: + Steel: 150 + Glass: 900 + Gold: 50 + - type: latheRecipe id: MedicalScannerMachineCircuitboard icon: Objects/Misc/module.rsi/id_mod.png