Activatable UI component (#5184)
* Transfer most Instrument UI logic to a new component, ActivatableUIComponent * Move more ActivatableUIComponent stuff to ECS * ActivatableUI component ignore on client * ActivatableUI: Get rid of component interfaces where possible * Add in adminOnly attribute for activatable UIs This is so that porting #4926 to this will be easier * Transition Solar Control Computer to ActivatableUI * Move communications console to ActivatableUI * Move cargo console to ActivatableUI * Move ID card console to ActivatableUI * ActivatableUI: Make things more amiable to entity tests adding components weirdly * ActivatableUI: Use handling or lack thereof of events properly * ActivatableUI: component dependency issue resolution stuffs * ActivatableUISystem: Fix #5258 * More fixes because master did stuffo * Check for HandDeselectedEvent again because otherwise active-hand check doesn't work * Move just a bit more code into the system, introduce a workaround for #5258 * Purge the player status detection stuff * Oh and some obsolete stuff too
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Content.Shared.Solar;
|
||||
using Content.Server.Solar.EntitySystems;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -11,45 +11,8 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Solar.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(BaseComputerUserInterfaceComponent))]
|
||||
public class SolarControlConsoleComponent : BaseComputerUserInterfaceComponent
|
||||
public class SolarControlConsoleComponent : Component
|
||||
{
|
||||
public override string Name => "SolarControlConsole";
|
||||
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
|
||||
private PowerSolarSystem _powerSolarSystem = default!;
|
||||
|
||||
public SolarControlConsoleComponent() : base(SolarControlConsoleUiKey.Key) { }
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_powerSolarSystem = _entitySystemManager.GetEntitySystem<PowerSolarSystem>();
|
||||
}
|
||||
|
||||
public void UpdateUIState()
|
||||
{
|
||||
UserInterface?.SetState(new SolarControlConsoleBoundInterfaceState(_powerSolarSystem.TargetPanelRotation, _powerSolarSystem.TargetPanelVelocity, _powerSolarSystem.TotalPanelPower, _powerSolarSystem.TowardsSun));
|
||||
}
|
||||
|
||||
protected override void OnReceiveUserInterfaceMessage(ServerBoundUserInterfaceMessage obj)
|
||||
{
|
||||
switch (obj.Message)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user