From 9cefe6b3f32f2f6acbea7d4a648ea01c1ec49bb0 Mon Sep 17 00:00:00 2001
From: collinlunn <60152240+collinlunn@users.noreply.github.com>
Date: Sun, 28 Feb 2021 04:05:10 -0700
Subject: [PATCH] PipeHeaterComponent (#3443)
* PipeHeaterComponent
Heater rsi
Heater prototype
* Client ignore
---
Content.Client/IgnoredComponents.cs | 1 +
.../Atmos/Piping/PipeHeaterComponent.cs | 66 ++++++++++++++++++
.../Entities/Constructible/Piping/heaters.yml | 33 +++++++++
.../Constructible/Atmos/heater.rsi/heater.png | Bin 0 -> 1624 bytes
.../Atmos/heater.rsi/heaterOn.png | Bin 0 -> 2829 bytes
.../Atmos/heater.rsi/heaterPipe.png | Bin 0 -> 321 bytes
.../Constructible/Atmos/heater.rsi/meta.json | 21 ++++++
7 files changed, 121 insertions(+)
create mode 100644 Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs
create mode 100644 Resources/Prototypes/Entities/Constructible/Piping/heaters.yml
create mode 100644 Resources/Textures/Constructible/Atmos/heater.rsi/heater.png
create mode 100644 Resources/Textures/Constructible/Atmos/heater.rsi/heaterOn.png
create mode 100644 Resources/Textures/Constructible/Atmos/heater.rsi/heaterPipe.png
create mode 100644 Resources/Textures/Constructible/Atmos/heater.rsi/meta.json
diff --git a/Content.Client/IgnoredComponents.cs b/Content.Client/IgnoredComponents.cs
index abfaadcbe5..61a47e73c6 100644
--- a/Content.Client/IgnoredComponents.cs
+++ b/Content.Client/IgnoredComponents.cs
@@ -151,6 +151,7 @@ namespace Content.Client
"PressureVent",
"VolumePump",
"PressureSiphon",
+ "PipeHeater",
"SignalReceiver",
"SignalSwitch",
"SignalTransmitter",
diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs
new file mode 100644
index 0000000000..234c9ac7cc
--- /dev/null
+++ b/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs
@@ -0,0 +1,66 @@
+#nullable enable
+using Content.Server.GameObjects.Components.NodeContainer;
+using Content.Server.GameObjects.Components.NodeContainer.Nodes;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Log;
+using Robust.Shared.ViewVariables;
+using System.Linq;
+
+namespace Content.Server.GameObjects.Components.Atmos.Piping
+{
+ ///
+ /// Placeholder component for adjusting the temperature of gas in pipes.
+ ///
+ [RegisterComponent]
+ public class PipeHeaterComponent : Component
+ {
+ public override string Name => "PipeHeater";
+
+ [ViewVariables]
+ private PipeNode? _heaterPipe;
+
+ [ViewVariables(VVAccess.ReadWrite)]
+ private float TargetTemperature { get; set; }
+
+ public override void Initialize()
+ {
+ base.Initialize();
+ Owner.EnsureComponentWarn();
+ SetPipe();
+ }
+
+ public override void HandleMessage(ComponentMessage message, IComponent? component)
+ {
+ base.HandleMessage(message, component);
+ switch (message)
+ {
+ case PipeNetUpdateMessage:
+ Update();
+ break;
+ }
+ }
+
+ public void Update()
+ {
+ if (_heaterPipe == null)
+ return;
+
+ _heaterPipe.Air.Temperature = TargetTemperature;
+ }
+
+ private void SetPipe()
+ {
+ if (!Owner.TryGetComponent(out var container))
+ {
+ Logger.Error($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
+ return;
+ }
+ _heaterPipe = container.Nodes.OfType().FirstOrDefault();
+ if (_heaterPipe == null)
+ {
+ Logger.Error($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
+ return;
+ }
+ }
+ }
+}
diff --git a/Resources/Prototypes/Entities/Constructible/Piping/heaters.yml b/Resources/Prototypes/Entities/Constructible/Piping/heaters.yml
new file mode 100644
index 0000000000..d71bff1d12
--- /dev/null
+++ b/Resources/Prototypes/Entities/Constructible/Piping/heaters.yml
@@ -0,0 +1,33 @@
+- type: entity
+ id: Heater
+ name: Heater
+ description: Heats gas.
+ placement:
+ mode: SnapgridCenter
+ components:
+ - type: Clickable
+ - type: InteractionOutline
+ - type: Physics
+ - type: SnapGrid
+ offset: Center
+ - type: Damageable
+ - type: Destructible
+ thresholds:
+ - trigger:
+ !type:DamageTrigger
+ damage: 100
+ behaviors:
+ - !type:DoActsBehavior
+ acts: ["Destruction"]
+ - type: Sprite
+ netsync: false
+ sprite: Constructible/Atmos/heater.rsi
+ layers:
+ - state: heater
+ - state: heaterPipe
+ - type: NodeContainer
+ nodes:
+ - !type:PipeNode
+ nodeGroupID: Pipe
+ pipeDirection: East
+ - type: PipeHeater
\ No newline at end of file
diff --git a/Resources/Textures/Constructible/Atmos/heater.rsi/heater.png b/Resources/Textures/Constructible/Atmos/heater.rsi/heater.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ed5ae46f91c2ce7a8aa4bc36249804788238eb5
GIT binary patch
literal 1624
zcmV-e2B-OnP)9)x6@b6{?t5=$Jf5-f53cYZ!LB0^4wVd1>Sj?zX{Cl37dEX`Wz)YM$s!Wn1Z06&
zfP$h%O)J=yP1P-jK`iC&%Aka@9kn{US_bJq>Hqh
zoXwl}?woVJbIv{IUiebJl>f7cCqJA&f8Kmi&Q6>-vB{rZ`*QZ|S#$jO@h{3hp68j9
zCr{Qv1OR8woH2(FA7*uR6)EMmMzq!#^WP^)2*I&q$H->0=G?h+0fY@OIXP)&W@hN?
z>*L|Whk>J7km~PZvB>P~>?Vlqpbi{3fDi)5aWKYUjA3$e(u|CZhyb7}jg5^crI?$W
z;~yV|PBodCcX!^Xx&
z05Aj$Rn~4+){QZQA`z~?_uiH%uQgs>-@ku9#uzNi!WgqX06->_K?s4AvJL>?K?UH>
zojZK)`3W4&|0(i>8FuW20+^a2qEx158JkpQquA72@K^wYo$qk
z^btY`BGD*oxm*xwRV>Rw2vL_}tu@hD45d^6QPq3x)mP2W-+o)v0Vt)gEQ?SiLN1r9
zGt{(W2LMVbN~KaAK()4x<6zr%03n3HwrzahM{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