* 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
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using System;
|
|
using Content.Shared.Instruments;
|
|
using Content.Shared.Interaction;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Reflection;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Utility;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Content.Server.UserInterface
|
|
{
|
|
[RegisterComponent]
|
|
public class ActivatableUIComponent : Component,
|
|
ISerializationHooks
|
|
{
|
|
public override string Name => "ActivatableUI";
|
|
|
|
[ViewVariables]
|
|
public Enum? Key { get; set; }
|
|
|
|
[ViewVariables] public BoundUserInterface? UserInterface => (Key != null) ? Owner.GetUIOrNull(Key) : null;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
[DataField("inHandsOnly")]
|
|
public bool InHandsOnly { get; set; } = false;
|
|
|
|
[ViewVariables]
|
|
[DataField("singleUser")]
|
|
public bool SingleUser { get; set; } = false;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
[DataField("adminOnly")]
|
|
public bool AdminOnly { get; set; } = false;
|
|
|
|
[DataField("key", readOnly: true, required: true)]
|
|
private string _keyRaw = default!;
|
|
|
|
/// <summary>
|
|
/// The client channel currently using the object, or null if there's none/not single user.
|
|
/// NOTE: DO NOT DIRECTLY SET, USE ActivatableUISystem.SetCurrentSingleUser
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public IPlayerSession? CurrentSingleUser;
|
|
|
|
void ISerializationHooks.AfterDeserialization()
|
|
{
|
|
var reflectionManager = IoCManager.Resolve<IReflectionManager>();
|
|
if (reflectionManager.TryParseEnumReference(_keyRaw, out var key))
|
|
Key = key;
|
|
}
|
|
}
|
|
}
|
|
|