Thermomachine fix + machine boards (#6803)

This commit is contained in:
mirrorcult
2022-02-20 17:17:45 -07:00
committed by GitHub
parent 9834c1f806
commit d91f969451
8 changed files with 123 additions and 50 deletions

View File

@@ -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<GasThermoMachineComponent, RefreshPartsEvent>(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;
}
}
}

View File

@@ -1,8 +1,10 @@
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components; using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components; using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Construction;
using Content.Server.NodeContainer; using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes; using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -21,6 +23,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
SubscribeLocalEvent<GasThermoMachineComponent, AtmosDeviceUpdateEvent>(OnThermoMachineUpdated); SubscribeLocalEvent<GasThermoMachineComponent, AtmosDeviceUpdateEvent>(OnThermoMachineUpdated);
SubscribeLocalEvent<GasThermoMachineComponent, AtmosDeviceDisabledEvent>(OnThermoMachineLeaveAtmosphere); SubscribeLocalEvent<GasThermoMachineComponent, AtmosDeviceDisabledEvent>(OnThermoMachineLeaveAtmosphere);
SubscribeLocalEvent<GasThermoMachineComponent, RefreshPartsEvent>(OnGasThermoRefreshParts);
} }
private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args) 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 combinedHeatCapacity = airHeatCapacity + thermoMachine.HeatCapacity;
var oldTemperature = inlet.Air.Temperature; var oldTemperature = inlet.Air.Temperature;
if (combinedHeatCapacity > 0) if (!MathHelper.CloseTo(combinedHeatCapacity, 0, 0.001f))
{ {
appearance?.SetData(ThermoMachineVisuals.Enabled, true); appearance?.SetData(ThermoMachineVisuals.Enabled, true);
var combinedEnergy = thermoMachine.HeatCapacity * thermoMachine.TargetTemperature + airHeatCapacity * inlet.Air.Temperature; 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); 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;
}
}
} }
} }

View File

@@ -264,6 +264,19 @@
- SheetRGlass - SheetRGlass
- SheetGlass1 - 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 # Avionics Circuitry Technology Tree
- type: technology - type: technology

View File

@@ -46,6 +46,40 @@
ExamineName: Glass Beaker 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 - type: entity
id: CloningPodMachineCircuitboard id: CloningPodMachineCircuitboard
parent: BaseMachineCircuitboard parent: BaseMachineCircuitboard

View File

@@ -218,6 +218,7 @@
protolatherecipes: protolatherecipes:
- SMESMachineCircuitboard - SMESMachineCircuitboard
- SubstationMachineCircuitboard - SubstationMachineCircuitboard
- ThermomachineFreezerMachineCircuitBoard
- CloningPodMachineCircuitboard - CloningPodMachineCircuitboard
- MedicalScannerMachineCircuitboard - MedicalScannerMachineCircuitboard
- ChemMasterMachineCircuitboard - ChemMasterMachineCircuitboard

View File

@@ -148,6 +148,12 @@
- type: GasThermoMachine - type: GasThermoMachine
- type: AtmosPipeColor - type: AtmosPipeColor
- type: AtmosDevice - type: AtmosDevice
- type: Construction
graph: Machine
node: machine
- type: Wires
BoardName: "Thermomachine"
LayoutId: Thermomachine
- type: NodeContainer - type: NodeContainer
nodes: nodes:
pipe: pipe:
@@ -177,6 +183,8 @@
- type: GasThermoMachine - type: GasThermoMachine
mode: Freezer mode: Freezer
minTemperature: 73.15 minTemperature: 73.15
- type: Machine
board: ThermomachineFreezerMachineCircuitBoard
- type: entity - type: entity
parent: BaseGasThermoMachine parent: BaseGasThermoMachine
@@ -200,3 +208,5 @@
- type: GasThermoMachine - type: GasThermoMachine
mode: Heater mode: Heater
maxTemperature: 573.15 # This is changed when parts are refreshed. maxTemperature: 573.15 # This is changed when parts are refreshed.
- type: Machine
board: ThermomachineHeaterMachineCircuitBoard

View File

@@ -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

View File

@@ -71,6 +71,16 @@
Glass: 900 Glass: 900
Gold: 100 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 - type: latheRecipe
id: MedicalScannerMachineCircuitboard id: MedicalScannerMachineCircuitboard
icon: Objects/Misc/module.rsi/id_mod.png icon: Objects/Misc/module.rsi/id_mod.png