From f2eea7923843a9da280d2ffbdc3d2f7241e40fa5 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Wed, 24 Nov 2021 20:51:43 +0000 Subject: [PATCH] Fix solar control console UI not responding to input (#5506) --- .../PowerSolarControlConsoleSystem.cs | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs index 429d763d68..0b91652ada 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs @@ -7,6 +7,7 @@ using Robust.Shared.GameObjects; using Robust.Server.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; +using Robust.Shared.Log; namespace Content.Server.Solar.EntitySystems { @@ -27,7 +28,7 @@ namespace Content.Server.Solar.EntitySystems { base.Initialize(); - SubscribeLocalEvent(OnUIMessage); + SubscribeLocalEvent(OnUIMessage); } public override void Update(float frameTime) @@ -44,23 +45,17 @@ namespace Content.Server.Solar.EntitySystems } } - private void OnUIMessage(EntityUid uid, SolarControlConsoleComponent component, ServerBoundUserInterfaceMessage obj) + private void OnUIMessage(EntityUid uid, SolarControlConsoleComponent component, SolarControlConsoleAdjustMessage msg) { - if (component.Deleted) return; - switch (obj.Message) + if (double.IsFinite(msg.Rotation)) { - case SolarControlConsoleAdjustMessage msg: - if (double.IsFinite(msg.Rotation)) - { - _powerSolarSystem.TargetPanelRotation = msg.Rotation.Reduced(); - } - if (double.IsFinite(msg.AngularVelocity)) - { - var degrees = msg.AngularVelocity.Degrees; - degrees = Math.Clamp(degrees, -PowerSolarSystem.MaxPanelVelocityDegrees, PowerSolarSystem.MaxPanelVelocityDegrees); - _powerSolarSystem.TargetPanelVelocity = Angle.FromDegrees(degrees); - } - break; + _powerSolarSystem.TargetPanelRotation = msg.Rotation.Reduced(); + } + if (double.IsFinite(msg.AngularVelocity)) + { + var degrees = msg.AngularVelocity.Degrees; + degrees = Math.Clamp(degrees, -PowerSolarSystem.MaxPanelVelocityDegrees, PowerSolarSystem.MaxPanelVelocityDegrees); + _powerSolarSystem.TargetPanelVelocity = Angle.FromDegrees(degrees); } }