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

@@ -2,25 +2,17 @@ using Content.Server.CharacterAppearance.Systems;
using Content.Server.UserInterface;
using Content.Shared.CharacterAppearance;
using Content.Shared.CharacterAppearance.Components;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
namespace Content.Server.CharacterAppearance.Components
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
public sealed class MagicMirrorComponent : SharedMagicMirrorComponent, IActivate
public sealed class MagicMirrorComponent : SharedMagicMirrorComponent
{
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly SpriteAccessoryManager _spriteAccessoryManager = default!;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
protected override void Initialize()
{
@@ -94,36 +86,5 @@ namespace Content.Server.CharacterAppearance.Components
EntitySystem.Get<HumanoidAppearanceSystem>().ForceAppearanceUpdate(player);
}
void IActivate.Activate(ActivateEventArgs eventArgs)
{
if (!_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
{
return;
}
if (!_entities.TryGetComponent(eventArgs.User, out HumanoidAppearanceComponent? looks))
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("magic-mirror-component-activate-user-has-no-hair"));
return;
}
UserInterface?.Toggle(actor.PlayerSession);
var appearance = looks.Appearance;
var msg = new MagicMirrorInitialDataMessage(
appearance.HairColor,
appearance.FacialHairColor,
appearance.HairStyleId,
appearance.FacialHairStyleId,
appearance.EyeColor,
looks.CategoriesHair,
looks.CategoriesFacialHair,
looks.CanColorHair,
looks.CanColorFacialHair);
UserInterface?.SendMessage(msg, actor.PlayerSession);
}
}
}