CatStation/Content.Shared/Trigger/Systems/PopupOnTriggerSystem.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

57 lines
1.9 KiB
C#

using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.Trigger.Components.Effects;
namespace Content.Shared.Trigger.Systems;
/// <summary>
/// This handles <see cref="PopupOnTriggerComponent"/>
/// </summary>
public sealed partial class PopupOnTriggerSystem : XOnTriggerSystem<PopupOnTriggerComponent>
{
[Dependency] private SharedPopupSystem _popup = default!;
protected override void OnTrigger(Entity<PopupOnTriggerComponent> ent, EntityUid target, ref TriggerEvent args)
{
var user = args.User != null ? Identity.Name(args.User.Value, EntityManager) : Loc.GetString("generic-unknown");
// Popups only play for one entity
if (ent.Comp.Quiet)
{
if (ent.Comp.Predicted)
{
_popup.PopupEntity(Loc.GetString(ent.Comp.Text, ("entity", ent), ("user", user)),
target,
ent.Comp.UserIsRecipient ? args.User : ent.Owner,
ent.Comp.PopupType);
}
else if (args.User != null)
{
_popup.PopupEntity(Loc.GetString(ent.Comp.OtherText ?? ent.Comp.Text, ("entity", ent), ("user", user)),
target,
args.User.Value,
ent.Comp.PopupType);
}
return;
}
// Popups play for all entities
if (ent.Comp.Predicted)
{
_popup.PopupEntity(Loc.GetString(ent.Comp.Text, ("entity", ent), ("user", user)),
Loc.GetString(ent.Comp.OtherText ?? ent.Comp.Text, ("entity", ent), ("user", user)),
target,
ent.Comp.UserIsRecipient ? args.User : ent.Owner,
ent.Comp.PopupType);
}
else
{
_popup.PopupEntity(Loc.GetString(ent.Comp.OtherText ?? ent.Comp.Text, ("entity", ent), ("user", user)),
target,
ent.Comp.PopupType);
}
}
}