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:
Nemanja
2022-12-24 20:59:51 -05:00
committed by GitHub
parent 5eadce16ec
commit 6d97764e9d
13 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
namespace Content.Server.Chemistry.Components;
[RegisterComponent]
public sealed class ActiveSolutionHeaterComponent : Component
{
}

View File

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

View File

@@ -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);
}
}
}
}

View File

@@ -0,0 +1 @@
solution-heater-upgrade-heat = Heat strength

View File

@@ -103,6 +103,7 @@
- Dropper
- Syringe
- ReagentGrinderMachineCircuitboard
- HotplateMachineCircuitboard
- PillCanister
- ChemistryEmptyBottle01
- ChemicalPayload

View File

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

View File

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

View File

@@ -287,6 +287,7 @@
- AutolatheMachineCircuitboard
- ProtolatheMachineCircuitboard
- ReagentGrinderMachineCircuitboard
- HotplateMachineCircuitboard
- MicrowaveMachineCircuitboard
- UniformPrinterMachineCircuitboard
- ShuttleConsoleCircuitboard

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -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"}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B