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:
@@ -0,0 +1,42 @@
|
||||
using Content.Server.CharacterAppearance.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.CharacterAppearance.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.CharacterAppearance.Systems
|
||||
{
|
||||
public sealed class MagicMirrorSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<MagicMirrorComponent, ActivatableUIOpenAttemptEvent>(OnOpenUIAttempt);
|
||||
SubscribeLocalEvent<MagicMirrorComponent, AfterActivatableUIOpenEvent>(AfterUIOpen);
|
||||
}
|
||||
|
||||
private void OnOpenUIAttempt(EntityUid uid, MagicMirrorComponent mirror, ActivatableUIOpenAttemptEvent args)
|
||||
{
|
||||
if (!HasComp<HumanoidAppearanceComponent>(args.User))
|
||||
args.Cancel();
|
||||
}
|
||||
private void AfterUIOpen(EntityUid uid, MagicMirrorComponent component, AfterActivatableUIOpenEvent args)
|
||||
{
|
||||
var looks = Comp<HumanoidAppearanceComponent>(args.User);
|
||||
var actor = Comp<ActorComponent>(args.User);
|
||||
var appearance = looks.Appearance;
|
||||
|
||||
var msg = new MagicMirrorComponent.MagicMirrorInitialDataMessage(
|
||||
appearance.HairColor,
|
||||
appearance.FacialHairColor,
|
||||
appearance.HairStyleId,
|
||||
appearance.FacialHairStyleId,
|
||||
appearance.EyeColor,
|
||||
looks.CategoriesHair,
|
||||
looks.CategoriesFacialHair,
|
||||
looks.CanColorHair,
|
||||
looks.CanColorFacialHair);
|
||||
|
||||
component.UserInterface?.SendMessage(msg, actor.PlayerSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user