Convert almost all IActivate instances that open UIs to ActivatableUI (#7028)
* Chem master * Drone support for handhelds * Vending machines, scanners * Cloners, R&D computers * make research a little less sussy * Unfuck wires * PA control computer * Unfuck merge * Clean up git gore for good * Disposals * Microwaves * paper * Magic mirror * More vendors for drones * Solar computer whitelist * EFR review updates
This commit is contained in:
@@ -5,25 +5,20 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Paper
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
[ComponentReference(typeof(SharedPaperComponent))]
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public sealed class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing, IActivate
|
||||
public sealed class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private PaperAction _mode;
|
||||
public PaperAction Mode;
|
||||
[DataField("content")]
|
||||
public string Content { get; set; } = "";
|
||||
|
||||
@@ -42,7 +37,7 @@ namespace Content.Server.Paper
|
||||
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
||||
}
|
||||
|
||||
_mode = PaperAction.Read;
|
||||
Mode = PaperAction.Read;
|
||||
UpdateUserInterface();
|
||||
}
|
||||
|
||||
@@ -62,9 +57,9 @@ namespace Content.Server.Paper
|
||||
appearance.SetData(PaperVisuals.Status, status);
|
||||
}
|
||||
|
||||
private void UpdateUserInterface()
|
||||
public void UpdateUserInterface()
|
||||
{
|
||||
UserInterface?.SetState(new PaperBoundUserInterfaceState(Content, _mode));
|
||||
UserInterface?.SetState(new PaperBoundUserInterfaceState(Content, Mode));
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
@@ -81,17 +76,6 @@ namespace Content.Server.Paper
|
||||
);
|
||||
}
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
_mode = PaperAction.Read;
|
||||
UpdateUserInterface();
|
||||
UserInterface?.Toggle(actor.PlayerSession);
|
||||
return;
|
||||
}
|
||||
|
||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||
{
|
||||
var msg = (PaperInputText) obj.Message;
|
||||
@@ -118,7 +102,7 @@ namespace Content.Server.Paper
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
return false;
|
||||
|
||||
_mode = PaperAction.Write;
|
||||
Mode = PaperAction.Write;
|
||||
UpdateUserInterface();
|
||||
UserInterface?.Open(actor.PlayerSession);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user