mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* PopupClient to PopupEntity/Coordinates * PopupPredictedX to PopupEntity/Cursor/Coordinates * The rest of the damn owl * nullability fixes * Buckle cleanup * cleanup, address PR comments * ExecutionSystem: one popup method * correct my filthy lies * Apply most of ajcm's suggestions * return user to SharedItemRecallSystem.cs * Fix lingering Ensnarable broadcast popups * targeted drain popups * fix lingering untargeted Guardian popups I read the comment on GuardianHostRecall. Oops. * target stethoscope popups * fix the PDA vibration popup * Fix target for encryption key removal popup * anomaly scanner: args.User, not uid * disposal unit comment, bcast pda vibration popup
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using Content.Shared.Popups;
|
|
|
|
namespace Content.Shared.UserInterface;
|
|
|
|
/// <summary>
|
|
/// <see cref="ActivatableUIRequiresAnchorComponent"/>
|
|
/// </summary>
|
|
public sealed partial class ActivatableUIRequiresAnchorSystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedPopupSystem _popup = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<ActivatableUIRequiresAnchorComponent, ActivatableUIOpenAttemptEvent>(OnActivatableUIOpenAttempt);
|
|
SubscribeLocalEvent<ActivatableUIRequiresAnchorComponent, BoundUserInterfaceCheckRangeEvent>(OnUICheck);
|
|
}
|
|
|
|
private void OnUICheck(Entity<ActivatableUIRequiresAnchorComponent> ent, ref BoundUserInterfaceCheckRangeEvent args)
|
|
{
|
|
if (args.Result == BoundUserInterfaceRangeResult.Fail)
|
|
return;
|
|
|
|
if (!Transform(ent.Owner).Anchored)
|
|
{
|
|
args.Result = BoundUserInterfaceRangeResult.Fail;
|
|
}
|
|
}
|
|
|
|
private void OnActivatableUIOpenAttempt(Entity<ActivatableUIRequiresAnchorComponent> ent, ref ActivatableUIOpenAttemptEvent args)
|
|
{
|
|
if (args.Cancelled)
|
|
return;
|
|
|
|
if (Transform(ent.Owner).Anchored)
|
|
return;
|
|
|
|
if (ent.Comp.Popup != null && !args.Silent)
|
|
{
|
|
_popup.PopupEntity(Loc.GetString(ent.Comp.Popup), args.User, args.User);
|
|
}
|
|
|
|
args.Cancel();
|
|
}
|
|
}
|