Goodbye Microwave, Hello Hot Plates! (#13061)
* hot plates * sprite fix AND i spelled it wrong AND forgot upgrade examine * fix license * IGameTiming is shit like yo mamma * active comp
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace Content.Server.Chemistry.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class ActiveSolutionHeaterComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Content.Server.Chemistry.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class SolutionHeaterComponent : Component
|
||||
{
|
||||
public readonly string BeakerSlotId = "beakerSlot";
|
||||
|
||||
[DataField("heatPerSecond")]
|
||||
public float HeatPerSecond = 120;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float HeatMultiplier = 1;
|
||||
|
||||
[DataField("machinePartHeatPerSecond")]
|
||||
public string MachinePartHeatPerSecond = "Laser";
|
||||
|
||||
[DataField("partRatingHeatMultiplier")]
|
||||
public float PartRatingHeatMultiplier = 1.5f;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems;
|
||||
|
||||
public sealed class SolutionHeaterSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solution = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<SolutionHeaterComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<SolutionHeaterComponent, RefreshPartsEvent>(OnRefreshParts);
|
||||
SubscribeLocalEvent<SolutionHeaterComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
||||
}
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, SolutionHeaterComponent component, ref PowerChangedEvent args)
|
||||
{
|
||||
if (args.Powered)
|
||||
{
|
||||
EnsureComp<ActiveSolutionHeaterComponent>(uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<ActiveSolutionHeaterComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRefreshParts(EntityUid uid, SolutionHeaterComponent component, RefreshPartsEvent args)
|
||||
{
|
||||
var heatRating = args.PartRatings[component.MachinePartHeatPerSecond] - 1;
|
||||
|
||||
component.HeatMultiplier = MathF.Pow(component.PartRatingHeatMultiplier, heatRating);
|
||||
}
|
||||
|
||||
private void OnUpgradeExamine(EntityUid uid, SolutionHeaterComponent component, UpgradeExamineEvent args)
|
||||
{
|
||||
args.AddPercentageUpgrade("solution-heater-upgrade-heat", component.HeatMultiplier);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var (_, heater) in EntityQuery<ActiveSolutionHeaterComponent, SolutionHeaterComponent>())
|
||||
{
|
||||
if (_itemSlots.GetItemOrNull(heater.Owner, heater.BeakerSlotId) is not { } item)
|
||||
continue;
|
||||
|
||||
if (!TryComp<SolutionContainerManagerComponent>(item, out var solution))
|
||||
continue;
|
||||
|
||||
var energy = heater.HeatPerSecond * heater.HeatMultiplier * frameTime;
|
||||
foreach (var s in solution.Solutions.Values)
|
||||
{
|
||||
_solution.AddThermalEnergy(solution.Owner, s, energy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
solution-heater-upgrade-heat = Heat strength
|
||||
@@ -103,6 +103,7 @@
|
||||
- Dropper
|
||||
- Syringe
|
||||
- ReagentGrinderMachineCircuitboard
|
||||
- HotplateMachineCircuitboard
|
||||
- PillCanister
|
||||
- ChemistryEmptyBottle01
|
||||
- ChemicalPayload
|
||||
|
||||
@@ -507,6 +507,19 @@
|
||||
DefaultPrototype: Beaker
|
||||
ExamineName: Glass Beaker
|
||||
|
||||
- type: entity
|
||||
id: HotplateMachineCircuitboard
|
||||
parent: BaseMachineCircuitboard
|
||||
name: hotplate machine board
|
||||
description: A machine printed circuit board for a hotplate
|
||||
components:
|
||||
- type: MachineBoard
|
||||
prototype: ChemistryHotplate
|
||||
requirements:
|
||||
Laser: 2
|
||||
materialRequirements:
|
||||
Steel: 2
|
||||
|
||||
- type: entity
|
||||
id: StasisBedMachineCircuitboard
|
||||
parent: BaseMachineCircuitboard
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
- type: entity
|
||||
id: ChemistryHotplate
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
name: hotplate
|
||||
description: "The descendent of the microwaves, our newest invention in beaker heating technology: the hotplate!"
|
||||
components:
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.08,-0.35,0.15,0.25"
|
||||
mask:
|
||||
- TabletopMachineMask
|
||||
layer:
|
||||
- TabletopMachineLayer
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Structures/Machines/hotplate.rsi
|
||||
drawdepth: SmallObjects
|
||||
snapCardinals: true
|
||||
layers:
|
||||
- state: icon
|
||||
- state: on
|
||||
map: ["enum.PowerDeviceVisualLayers.Powered"]
|
||||
shader: unshaded
|
||||
- type: ApcPowerReceiver
|
||||
powerLoad: 300
|
||||
- type: ItemSlots
|
||||
slots:
|
||||
beakerSlot:
|
||||
whitelist:
|
||||
components:
|
||||
- FitsInDispenser
|
||||
- type: ItemMapper
|
||||
sprite: Structures/Machines/hotplate.rsi
|
||||
mapLayers:
|
||||
beaker:
|
||||
whitelist:
|
||||
components:
|
||||
- FitsInDispenser
|
||||
- type: SolutionHeater
|
||||
- type: Machine
|
||||
board: HotplateMachineCircuitboard
|
||||
- type: Appearance
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
beakerSlot: !type:ContainerSlot
|
||||
machine_board: !type:Container
|
||||
machine_parts: !type:Container
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
enum.PowerDeviceVisuals.Powered:
|
||||
enum.PowerDeviceVisualLayers.Powered:
|
||||
True: { visible: true }
|
||||
False: { visible: false }
|
||||
@@ -287,6 +287,7 @@
|
||||
- AutolatheMachineCircuitboard
|
||||
- ProtolatheMachineCircuitboard
|
||||
- ReagentGrinderMachineCircuitboard
|
||||
- HotplateMachineCircuitboard
|
||||
- MicrowaveMachineCircuitboard
|
||||
- UniformPrinterMachineCircuitboard
|
||||
- ShuttleConsoleCircuitboard
|
||||
|
||||
@@ -223,6 +223,15 @@
|
||||
Steel: 100
|
||||
Glass: 900
|
||||
|
||||
- type: latheRecipe
|
||||
id: HotplateMachineCircuitboard
|
||||
icon: { sprite: Objects/Misc/module.rsi, state: id_mod }
|
||||
result: HotplateMachineCircuitboard
|
||||
completetime: 4
|
||||
materials:
|
||||
Steel: 100
|
||||
Glass: 900
|
||||
|
||||
- type: latheRecipe
|
||||
id: AnalysisComputerCircuitboard
|
||||
icon: { sprite: Objects/Misc/module.rsi, state: cpu_science }
|
||||
|
||||
BIN
Resources/Textures/Structures/Machines/hotplate.rsi/beaker.png
Normal file
BIN
Resources/Textures/Structures/Machines/hotplate.rsi/beaker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 218 B |
BIN
Resources/Textures/Structures/Machines/hotplate.rsi/icon.png
Normal file
BIN
Resources/Textures/Structures/Machines/hotplate.rsi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 382 B |
@@ -0,0 +1 @@
|
||||
{"license": "CC0-1.0", "copyright": "Created by EmoGarbage","version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "icon"}, {"name": "beaker"}, {"name": "on"}]}
|
||||
BIN
Resources/Textures/Structures/Machines/hotplate.rsi/on.png
Normal file
BIN
Resources/Textures/Structures/Machines/hotplate.rsi/on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 B |
Reference in New Issue
Block a user