CatStation/Content.Shared/Actions/DangerousActionSystem.cs
Whatstone a88d2c5164
Cleanup: Resolve remaining PopupSystem warnings in Content.Shared (#44685)
* 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
2026-07-16 21:54:33 +00:00

34 lines
1.1 KiB
C#

using Content.Shared.Actions.Components;
using Content.Shared.Actions.Events;
using Content.Shared.CombatMode.Pacification;
using Content.Shared.Popups;
namespace Content.Shared.Actions;
/// <summary>
/// Just the system to realize Dangerous Action Component.
/// <seealso cref="DangerousActionComponent"/>
/// </summary>
public sealed partial class DangerousActionSystem : EntitySystem
{
[Dependency] private SharedPopupSystem _popup = default!;
[Dependency] private EntityQuery<PacifiedComponent> _pacifiedQuery = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DangerousActionComponent, ActionAttemptEvent>(OnAttempt);
}
private void OnAttempt(Entity<DangerousActionComponent> ent, ref ActionAttemptEvent args)
{
if (args.Cancelled)
return;
//query for pacification
if (!_pacifiedQuery.HasComp(args.User))
return;
//if found popup message and cancel
_popup.PopupEntity(Loc.GetString(ent.Comp.PacificationMessage), args.User, args.User);
args.Cancelled = true;
}
}