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:
Rane
2022-03-12 13:26:06 -05:00
committed by GitHub
parent 865c9630bd
commit 926e36d81d
48 changed files with 305 additions and 584 deletions

View File

@@ -14,19 +14,13 @@ using Content.Shared.Sound;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.AME.Components
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IInteractUsing))]
public sealed class AMEControllerComponent : SharedAMEControllerComponent, IActivate, IInteractUsing
public sealed class AMEControllerComponent : SharedAMEControllerComponent, IInteractUsing
{
[Dependency] private readonly IEntityManager _entities = default!;
@@ -115,30 +109,6 @@ namespace Content.Server.AME.Components
}
/// <summary>
/// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible.
/// </summary>
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
void IActivate.Activate(ActivateEventArgs args)
{
if (!_entities.TryGetComponent(args.User, out ActorComponent? actor))
{
return;
}
if (!_entities.TryGetComponent(args.User, out HandsComponent? hands))
{
Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-no-hands-text"));
return;
}
var activeHandEntity = hands.GetActiveHandItem?.Owner;
if (activeHandEntity == null)
{
UserInterface?.Open(actor.PlayerSession);
}
}
private void OnPowerChanged(PowerChangedMessage e)
{
UpdateUserInterface();