diff --git a/Content.Server/Interaction/Components/InteractionPopupComponent.cs b/Content.Server/Interaction/Components/InteractionPopupComponent.cs index 2df01a8641..1109578179 100644 --- a/Content.Server/Interaction/Components/InteractionPopupComponent.cs +++ b/Content.Server/Interaction/Components/InteractionPopupComponent.cs @@ -51,10 +51,10 @@ namespace Content.Server.Interaction.Components; public float SuccessChance = 1.0f; // Always succeed, unless specified otherwise on the yaml prototype. /// - /// Will the popup message be perceived by entities not involved in the interaction? + /// If set, shows a message to all surrounding players but NOT the current player. /// - [DataField("popupPerceivedByOthers")] - public bool PopupPerceivedByOthers = false; + [DataField("messagePerceivedByOthers")] + public string? MessagePerceivedByOthers; /// /// Will the sound effect be perceived by entities not involved in the interaction? diff --git a/Content.Server/Interaction/InteractionPopupSystem.cs b/Content.Server/Interaction/InteractionPopupSystem.cs index bed519ff9d..ec6a3a7357 100644 --- a/Content.Server/Interaction/InteractionPopupSystem.cs +++ b/Content.Server/Interaction/InteractionPopupSystem.cs @@ -56,8 +56,12 @@ public sealed class InteractionPopupSystem : EntitySystem sfx = component.InteractFailureSound.GetSound(); } - if (component.PopupPerceivedByOthers) - _popupSystem.PopupEntity(msg, uid, Filter.Pvs(uid)); //play for everyone in range + if (component.MessagePerceivedByOthers != null) + { + string msgOthers = Loc.GetString(component.MessagePerceivedByOthers,("user", args.User), ("target", uid)); + _popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User)); + _popupSystem.PopupEntity(msgOthers, uid, Filter.Pvs(uid, 2F, EntityManager).RemoveWhereAttachedEntity(puid => puid == args.User)); + } else _popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User)); //play only for the initiating entity. diff --git a/Resources/Locale/en-US/interaction/interaction-popup-component.ftl b/Resources/Locale/en-US/interaction/interaction-popup-component.ftl index 1dedff22cc..fd58476c17 100644 --- a/Resources/Locale/en-US/interaction/interaction-popup-component.ftl +++ b/Resources/Locale/en-US/interaction/interaction-popup-component.ftl @@ -38,4 +38,6 @@ comp-window-knock = *knock knock* ## Hugging players -hugging-success-generic = You hug {THE($target)}. \ No newline at end of file +hugging-success-generic = You hug {THE($target)}. +hugging-success-generic-others = { CAPITALIZE(THE($user)) } hugs {THE($target)}. +hugging-success-generic-target = { CAPITALIZE(THE($user)) } hugs you. \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Mobs/Player/dwarf.yml b/Resources/Prototypes/Entities/Mobs/Player/dwarf.yml index 5a58b2b4e6..72a71f21a5 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/dwarf.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/dwarf.yml @@ -9,6 +9,7 @@ successChance: 1 interactSuccessString: hugging-success-generic interactSuccessSound: /Audio/Effects/hug.ogg + messagePerceivedByOthers: hugging-success-generic-others - type: Mind showExamineInfo: true - type: Input @@ -23,4 +24,4 @@ - type: CanHostGuardian - type: AiFactionTag factions: - - NanoTrasen \ No newline at end of file + - NanoTrasen diff --git a/Resources/Prototypes/Entities/Mobs/Player/human.yml b/Resources/Prototypes/Entities/Mobs/Player/human.yml index 0688a0c535..7ea0a96436 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/human.yml @@ -9,6 +9,7 @@ successChance: 1 interactSuccessString: hugging-success-generic interactSuccessSound: /Audio/Effects/hug.ogg + messagePerceivedByOthers: hugging-success-generic-others - type: Mind showExamineInfo: true - type: Input diff --git a/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml b/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml index 399f70a88e..91bc86d9c9 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml @@ -9,6 +9,7 @@ successChance: 1 interactSuccessString: hugging-success-generic interactSuccessSound: /Audio/Effects/hug.ogg + messagePerceivedByOthers: hugging-success-generic-others - type: Mind showExamineInfo: true - type: Input diff --git a/Resources/Prototypes/Entities/Mobs/Player/slime.yml b/Resources/Prototypes/Entities/Mobs/Player/slime.yml index ec35bc77b4..0679b21832 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/slime.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/slime.yml @@ -7,6 +7,7 @@ successChance: 1 interactSuccessString: hugging-success-generic interactSuccessSound: /Audio/Effects/hug.ogg + messagePerceivedByOthers: hugging-success-generic-others - type: Mind showExamineInfo: true - type: Input diff --git a/Resources/Prototypes/Entities/Mobs/Player/vox.yml b/Resources/Prototypes/Entities/Mobs/Player/vox.yml index b47587134a..654d9a76af 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/vox.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/vox.yml @@ -8,6 +8,7 @@ successChance: 1 interactSuccessString: hugging-success-generic interactSuccessSound: /Audio/Effects/hug.ogg + messagePerceivedByOthers: hugging-success-generic-others - type: Mind showExamineInfo: true - type: Input diff --git a/Resources/Prototypes/Entities/Structures/Windows/window.yml b/Resources/Prototypes/Entities/Structures/Windows/window.yml index fde55af0c2..b97155eeb6 100644 --- a/Resources/Prototypes/Entities/Structures/Windows/window.yml +++ b/Resources/Prototypes/Entities/Structures/Windows/window.yml @@ -69,7 +69,7 @@ base: window - type: InteractionPopup interactSuccessString: comp-window-knock - popupPerceivedByOthers: true + messagePerceivedByOthers: comp-window-knock interactSuccessSound: path: /Audio/Effects/glass_knock.ogg - type: Construction @@ -110,7 +110,7 @@ state: window - type: InteractionPopup interactSuccessString: comp-window-knock - popupPerceivedByOthers: true + messagePerceivedByOthers: comp-window-knock interactSuccessSound: path: /Audio/Effects/glass_knock.ogg - type: Physics