From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sun, 7 Jan 2024 13:55:22 +0000 (-0500) Subject: Hellfire Thermomachines (#23543) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=a78e9a854ebb744ca82fcdbca4968f0197d05a84;p=space-station-14.git Hellfire Thermomachines (#23543) * hellfire thermomachines * slight nerf? idk * ilya review * Improve clarity * Update Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs Co-authored-by: Kevin Zheng --------- Co-authored-by: Kevin Zheng --- diff --git a/Content.Client/Atmos/UI/GasThermomachineWindow.xaml.cs b/Content.Client/Atmos/UI/GasThermomachineWindow.xaml.cs index 12e0617a55..bc8cb14336 100644 --- a/Content.Client/Atmos/UI/GasThermomachineWindow.xaml.cs +++ b/Content.Client/Atmos/UI/GasThermomachineWindow.xaml.cs @@ -17,7 +17,7 @@ public sealed partial class GasThermomachineWindow : DefaultWindow RobustXamlLoader.Load(this); SpinboxHBox.AddChild( - TemperatureSpinbox = new FloatSpinBox(.1f, 2) { MaxWidth = 150, HorizontalExpand = true } + TemperatureSpinbox = new FloatSpinBox(.1f, 2) { MinWidth = 150, HorizontalExpand = true } ); } diff --git a/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs b/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs index e8d0f0f30f..93d973d123 100644 --- a/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs +++ b/Content.Server/Atmos/Piping/Unary/Components/GasThermoMachineComponent.cs @@ -1,7 +1,4 @@ using Content.Shared.Atmos; -using Content.Shared.Atmos.Piping.Unary.Components; -using Content.Shared.Construction.Prototypes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.Atmos.Piping.Unary.Components { @@ -15,24 +12,16 @@ namespace Content.Server.Atmos.Piping.Unary.Components /// Current electrical power consumption, in watts. Increasing power increases the ability of the /// thermomachine to heat or cool air. /// - [ViewVariables(VVAccess.ReadWrite)] - 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, ViewVariables(VVAccess.ReadWrite)] + public float HeatCapacity = 5000; - [DataField("targetTemperature")] - [ViewVariables(VVAccess.ReadWrite)] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float TargetTemperature = Atmospherics.T20C; /// /// Tolerance for temperature setpoint hysteresis. /// - [ViewVariables(VVAccess.ReadOnly)] + [DataField, ViewVariables(VVAccess.ReadOnly)] public float TemperatureTolerance = 2f; /// @@ -40,7 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.Components /// If true, add Sign(Cp)*TemperatureTolerance to the temperature setpoint. /// [ViewVariables(VVAccess.ReadOnly)] - public bool HysteresisState = false; + public bool HysteresisState; /// /// Coefficient of performance. Output power / input power. @@ -51,68 +40,29 @@ namespace Content.Server.Atmos.Piping.Unary.Components public float Cp = 0.9f; // output power / input power, positive is heat /// - /// Current minimum temperature, calculated from and . + /// Current minimum temperature /// Ignored if heater. /// - [ViewVariables(VVAccess.ReadWrite)] - public float MinTemperature; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MinTemperature = 73.15f; /// - /// Current maximum temperature, calculated from and . + /// Current maximum temperature /// Ignored if freezer. /// - [ViewVariables(VVAccess.ReadWrite)] - public float MaxTemperature; - - /// - /// Minimum temperature the device can reach with a 0 total capacitor quality. Usually the quality will be at - /// least 1. - /// - [DataField("baseMinTemperature")] - [ViewVariables(VVAccess.ReadWrite)] - public float BaseMinTemperature = 96.625f; // Selected so that tier-1 parts can reach 73.15k - - /// - /// Maximum temperature the device can reach with a 0 total capacitor quality. Usually the quality will be at - /// least 1. - /// - [DataField("baseMaxTemperature")] - [ViewVariables(VVAccess.ReadWrite)] - public float BaseMaxTemperature = Atmospherics.T20C; - - /// - /// 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; - - /// - /// The machine part that affects the heat capacity. - /// - [DataField("machinePartHeatCapacity", customTypeSerializer: typeof(PrototypeIdSerializer))] - public string MachinePartHeatCapacity = "MatterBin"; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float MaxTemperature = 593.15f; /// - /// The machine part that affects the temperature range. + /// Last amount of energy added/removed from the attached pipe network /// - [DataField("machinePartTemperature", customTypeSerializer: typeof(PrototypeIdSerializer))] - public string MachinePartTemperature = "Capacitor"; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float LastEnergyDelta; /// - /// Last amount of energy added/removed from the attached pipe network + /// An percentage of the energy change that is leaked into the surrounding environment rather than the inlet pipe. /// - [DataField("lastEnergyDelta")] - [ViewVariables(VVAccess.ReadWrite)] - public float LastEnergyDelta; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float EnergyLeakPercentage; } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs index 46e3b3c172..eec610ffa6 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs @@ -2,7 +2,6 @@ using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.Monitor.Systems; using Content.Server.Atmos.Piping.Components; using Content.Server.Atmos.Piping.Unary.Components; -using Content.Server.Construction; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; @@ -15,6 +14,7 @@ using Content.Shared.Atmos.Piping.Unary.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; using Content.Server.Power.EntitySystems; +using Content.Server.UserInterface; using Content.Shared.Examine; namespace Content.Server.Atmos.Piping.Unary.EntitySystems @@ -28,17 +28,15 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems [Dependency] private readonly NodeContainerSystem _nodeContainer = default!; [Dependency] private readonly DeviceNetworkSystem _deviceNetwork = default!; - public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnThermoMachineUpdated); - SubscribeLocalEvent(OnGasThermoRefreshParts); - SubscribeLocalEvent(OnGasThermoUpgradeExamine); SubscribeLocalEvent(OnExamined); // UI events + SubscribeLocalEvent(OnBeforeOpened); SubscribeLocalEvent(OnToggleMessage); SubscribeLocalEvent(OnChangeTemperature); @@ -46,6 +44,11 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems SubscribeLocalEvent(OnPacketRecv); } + private void OnBeforeOpened(Entity ent, ref BeforeActivatableUIOpenEvent args) + { + DirtyUI(ent, ent.Comp); + } + private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, ref AtmosDeviceUpdateEvent args) { if (!(_power.IsPowered(uid) && TryComp(uid, out var receiver)) @@ -90,7 +93,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems thermoMachine.HysteresisState = false; // turn off } float dQActual = dQ * scale; - _atmosphereSystem.AddHeat(inlet.Air, dQActual); + float dQLeak = dQActual * thermoMachine.EnergyLeakPercentage; + float dQPipe = dQActual - dQLeak; + _atmosphereSystem.AddHeat(inlet.Air, dQPipe); + + if (_atmosphereSystem.GetContainingMixture(uid) is { } containingMixture) + _atmosphereSystem.AddHeat(containingMixture, dQLeak); + receiver.Load = thermoMachine.HeatCapacity;// * scale; // we're not ready for dynamic load yet, see note above } @@ -99,41 +108,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return comp.Cp >= 0; } - private void OnGasThermoRefreshParts(EntityUid uid, GasThermoMachineComponent thermoMachine, RefreshPartsEvent args) - { - var heatCapacityPartRating = args.PartRatings[thermoMachine.MachinePartHeatCapacity]; - thermoMachine.HeatCapacity = thermoMachine.BaseHeatCapacity * MathF.Pow(heatCapacityPartRating, 2); - - var temperatureRangePartRating = args.PartRatings[thermoMachine.MachinePartTemperature]; - if (IsHeater(thermoMachine)) - { - // 593.15K with stock parts. - thermoMachine.MaxTemperature = thermoMachine.BaseMaxTemperature + thermoMachine.MaxTemperatureDelta * temperatureRangePartRating; - thermoMachine.MinTemperature = Atmospherics.T20C; - } - else { - // 73.15K with stock parts. - thermoMachine.MinTemperature = MathF.Max( - thermoMachine.BaseMinTemperature - thermoMachine.MinTemperatureDelta * temperatureRangePartRating, Atmospherics.TCMB); - thermoMachine.MaxTemperature = Atmospherics.T20C; - } - - DirtyUI(uid, thermoMachine); - } - - private void OnGasThermoUpgradeExamine(EntityUid uid, GasThermoMachineComponent thermoMachine, UpgradeExamineEvent args) - { - if (IsHeater(thermoMachine)) - { - args.AddPercentageUpgrade("gas-thermo-component-upgrade-heating", thermoMachine.MaxTemperature / (thermoMachine.BaseMaxTemperature + thermoMachine.MaxTemperatureDelta)); - } - else - { - args.AddPercentageUpgrade("gas-thermo-component-upgrade-cooling", thermoMachine.MinTemperature / (thermoMachine.BaseMinTemperature - thermoMachine.MinTemperatureDelta)); - } - args.AddPercentageUpgrade("gas-thermo-component-upgrade-heat-capacity", thermoMachine.HeatCapacity / thermoMachine.BaseHeatCapacity); - } - private void OnToggleMessage(EntityUid uid, GasThermoMachineComponent thermoMachine, GasThermomachineToggleMessage args) { _power.TogglePower(uid); diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index d683195f2f..a16a69ee21 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -394,6 +394,46 @@ deconstructionTarget: null node: heater +- type: entity + parent: BaseMachineCircuitboard + id: HellfireFreezerMachineCircuitBoard + name: hellfire freezer machine board + description: Looks like you could use a screwdriver to change the board type. + components: + - type: Sprite + state: engineering + - type: MachineBoard + prototype: GasThermoMachineHellfireFreezer + requirements: + MatterBin: 2 + Capacitor: 2 + materialRequirements: + Plasma: 1 + - type: Construction + deconstructionTarget: null + graph: ThermomachineBoard + node: hellfirefreezer + +- type: entity + parent: BaseMachineCircuitboard + id: HellfireHeaterMachineCircuitBoard + name: hellfire heater machine board + description: Looks like you could use a screwdriver to change the board type. + components: + - type: Sprite + state: engineering + - type: MachineBoard + prototype: GasThermoMachineHellfireHeater + requirements: + MatterBin: 2 + Capacitor: 2 + materialRequirements: + Plasma: 1 + - type: Construction + graph: ThermomachineBoard + deconstructionTarget: null + node: hellfireheater + - type: entity id: CondenserMachineCircuitBoard parent: BaseMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 07d5f3f854..80ed1f1136 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -366,6 +366,7 @@ - FloorBlueCircuit dynamicRecipes: - ThermomachineFreezerMachineCircuitBoard + - HellfireFreezerMachineCircuitBoard - PortableScrubberMachineCircuitBoard - CloningPodMachineCircuitboard - MedicalScannerMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index 12514f03fe..45030bd28b 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -356,6 +356,36 @@ - type: ApcPowerReceiver powerDisabled: false +- type: entity + parent: GasThermoMachineFreezer + id: GasThermoMachineHellfireFreezer + name: hellfire freezer + description: An advanced machine that cools gas in connected pipes. Has the side effect of chilling the surrounding area. Cold as Hell! + components: + - type: Sprite + sprite: Structures/Piping/Atmospherics/hellfirethermomachine.rsi + - type: GasThermoMachine + minTemperature: 23.15 + heatCapacity: 40000 + energyLeakPercentage: 0.15 + - type: Machine + board: HellfireFreezerMachineCircuitBoard + +- type: entity + parent: GasThermoMachineHeater + id: GasThermoMachineHellfireHeater + name: hellfire heater + description: An advanced machine that heats gas in connected pipes. Has the side effect of leaking heat into the surrounding area. Hot as Hell! + components: + - type: Sprite + sprite: Structures/Piping/Atmospherics/hellfirethermomachine.rsi + - type: GasThermoMachine + maxTemperature: 1193.15 + heatCapacity: 40000 + energyLeakPercentage: 0.15 + - type: Machine + board: HellfireHeaterMachineCircuitBoard + - type: entity parent: [ BaseMachinePowered, ConstructibleMachine ] id: BaseGasCondenser diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml index 8818e5d1ba..e9c7a3c9a3 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/thermomachine-board.yml @@ -16,3 +16,17 @@ steps: - tool: Screwing doAfter: 2 + - node: hellfirefreezer + entity: HellfireFreezerMachineCircuitBoard + edges: + - to: hellfireheater + steps: + - tool: Screwing + doAfter: 2 + - node: hellfireheater + entity: HellfireHeaterMachineCircuitBoard + edges: + - to: hellfirefreezer + steps: + - tool: Screwing + doAfter: 2 diff --git a/Resources/Prototypes/Recipes/Lathes/electronics.yml b/Resources/Prototypes/Recipes/Lathes/electronics.yml index 3b5c04f4fe..55337702b5 100644 --- a/Resources/Prototypes/Recipes/Lathes/electronics.yml +++ b/Resources/Prototypes/Recipes/Lathes/electronics.yml @@ -104,6 +104,15 @@ Glass: 900 Gold: 50 +- type: latheRecipe + id: HellfireFreezerMachineCircuitBoard + result: HellfireFreezerMachineCircuitBoard + completetime: 4 + materials: + Steel: 150 + Glass: 900 + Gold: 50 + - type: latheRecipe id: CondenserMachineCircuitBoard result: CondenserMachineCircuitBoard diff --git a/Resources/Prototypes/Research/industrial.yml b/Resources/Prototypes/Research/industrial.yml index d991645be0..f47d5a6398 100644 --- a/Resources/Prototypes/Research/industrial.yml +++ b/Resources/Prototypes/Research/industrial.yml @@ -157,10 +157,11 @@ state: icon discipline: Industrial tier: 2 - cost: 5000 + cost: 7500 recipeUnlocks: - - HolofanProjector + - HellfireFreezerMachineCircuitBoard - PortableScrubberMachineCircuitBoard + - HolofanProjector - type: technology id: AdvancedToolsTechnology diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerOff.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerOff.png new file mode 100644 index 0000000000..03271358f3 Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerOff.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerOn.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerOn.png new file mode 100644 index 0000000000..17e68ca2db Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerOn.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerPanelOpen.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerPanelOpen.png new file mode 100644 index 0000000000..9955f7d2dd Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/freezerPanelOpen.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterOff.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterOff.png new file mode 100644 index 0000000000..70597088a6 Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterOff.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterOn.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterOn.png new file mode 100644 index 0000000000..565052b7b7 Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterOn.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterPanelOpen.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterPanelOpen.png new file mode 100644 index 0000000000..f1b2a9d0e3 Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/heaterPanelOpen.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/meta.json b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/meta.json new file mode 100644 index 0000000000..979d804fb4 --- /dev/null +++ b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/meta.json @@ -0,0 +1,38 @@ +{ + "version":1, + "size":{"x":32,"y":32}, + "copyright":"Base sprites taken from tgstation, split to display on two layers (machinebody/panel) by Menshin, and recolored and edited by EmoGarbage404 (github)", + "license":"CC-BY-SA-3.0", + "states":[ + { + "name":"freezerOff", + "directions":1 + }, + { + "name":"freezerPanelOpen", + "directions":1 + }, + { + "name":"freezerOn", + "directions":1, + "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] ] + }, + { + "name":"heaterOff", + "directions":1 + }, + { + "name":"heaterPanelOpen", + "directions":1 + }, + { + "name":"heaterOn", + "directions":1, + "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] ] + }, + { + "name":"pipe", + "directions":4 + } + ] +} diff --git a/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/pipe.png b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/pipe.png new file mode 100644 index 0000000000..620ba905be Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/hellfirethermomachine.rsi/pipe.png differ