From 7672076b438330be0f142c139a5ec98d946fb6d9 Mon Sep 17 00:00:00 2001 From: korczoczek Date: Sat, 22 Nov 2025 01:08:06 +0100 Subject: [PATCH] Let PopupOnTrigger display names of user and item (#41157) * waved away * waves at you with my [Prime Cut Corgi Meat] * pls dont litter the repository with unnecessary components * forgot to remove a variable from testing * guh * the more things change, the more things stay the same * and then she ternaried everywhere * owie --- .../Components/Effects/PopupOnTriggerComponent.cs | 3 +++ .../Trigger/Systems/PopupOnTriggerSystem.cs | 13 ++++++++----- .../Locale/en-US/triggers/popup-on-trigger.ftl | 7 +++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Resources/Locale/en-US/triggers/popup-on-trigger.ftl diff --git a/Content.Shared/Trigger/Components/Effects/PopupOnTriggerComponent.cs b/Content.Shared/Trigger/Components/Effects/PopupOnTriggerComponent.cs index 0f85da81c3..5f744e4058 100644 --- a/Content.Shared/Trigger/Components/Effects/PopupOnTriggerComponent.cs +++ b/Content.Shared/Trigger/Components/Effects/PopupOnTriggerComponent.cs @@ -5,6 +5,9 @@ namespace Content.Shared.Trigger.Components.Effects; /// /// Displays a popup on the target when triggered. +/// Supports following fluent variables: +/// $entity - displays the target entity's name +/// $user - displays the user's name /// Will display the popup on the user when is true. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] diff --git a/Content.Shared/Trigger/Systems/PopupOnTriggerSystem.cs b/Content.Shared/Trigger/Systems/PopupOnTriggerSystem.cs index d123c213db..7f118aab52 100644 --- a/Content.Shared/Trigger/Systems/PopupOnTriggerSystem.cs +++ b/Content.Shared/Trigger/Systems/PopupOnTriggerSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.IdentityManagement; using Content.Shared.Popups; using Content.Shared.Trigger.Components.Effects; @@ -12,12 +13,14 @@ public sealed class PopupOnTriggerSystem : XOnTriggerSystem 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.PopupClient(Loc.GetString(ent.Comp.Text), + _popup.PopupClient(Loc.GetString(ent.Comp.Text, ("entity", ent), ("user", user)), target, ent.Comp.UserIsRecipient ? args.User : ent.Owner, ent.Comp.PopupType); @@ -25,7 +28,7 @@ public sealed class PopupOnTriggerSystem : XOnTriggerSystem