Fix solar control console UI not responding to input (#5506)

This commit is contained in:
20kdc
2021-11-24 20:51:43 +00:00
committed by GitHub
parent 1342451243
commit f2eea79238

View File

@@ -7,6 +7,7 @@ using Robust.Shared.GameObjects;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Log;
namespace Content.Server.Solar.EntitySystems namespace Content.Server.Solar.EntitySystems
{ {
@@ -27,7 +28,7 @@ namespace Content.Server.Solar.EntitySystems
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<SolarControlConsoleComponent, ServerBoundUserInterfaceMessage>(OnUIMessage); SubscribeLocalEvent<SolarControlConsoleComponent, SolarControlConsoleAdjustMessage>(OnUIMessage);
} }
public override void Update(float frameTime) public override void Update(float frameTime)
@@ -44,12 +45,8 @@ 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)
{
case SolarControlConsoleAdjustMessage msg:
if (double.IsFinite(msg.Rotation)) if (double.IsFinite(msg.Rotation))
{ {
_powerSolarSystem.TargetPanelRotation = msg.Rotation.Reduced(); _powerSolarSystem.TargetPanelRotation = msg.Rotation.Reduced();
@@ -60,8 +57,6 @@ namespace Content.Server.Solar.EntitySystems
degrees = Math.Clamp(degrees, -PowerSolarSystem.MaxPanelVelocityDegrees, PowerSolarSystem.MaxPanelVelocityDegrees); degrees = Math.Clamp(degrees, -PowerSolarSystem.MaxPanelVelocityDegrees, PowerSolarSystem.MaxPanelVelocityDegrees);
_powerSolarSystem.TargetPanelVelocity = Angle.FromDegrees(degrees); _powerSolarSystem.TargetPanelVelocity = Angle.FromDegrees(degrees);
} }
break;
}
} }
} }