From ba56fe8ebc6d1407f625394d2dfa2588d2867211 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Thu, 20 Mar 2025 03:15:44 +0100 Subject: [PATCH] fix uncuff popups (#35743) * fix uncuff popups * them too --- Content.Shared/Cuffs/SharedCuffableSystem.cs | 32 ++++++++++++------- .../cuffs/components/cuffable-component.ftl | 1 + .../cuffs/components/handcuff-component.ftl | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 0e8b51137f..815760626d 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -341,8 +341,11 @@ namespace Content.Shared.Cuffs component.Used = true; _audio.PlayPredicted(component.EndCuffSound, uid, user); - _popup.PopupEntity(Loc.GetString("handcuff-component-cuff-observer-success-message", - ("user", Identity.Name(user, EntityManager)), ("target", Identity.Name(target, EntityManager))), + var popupText = (user == target) + ? "handcuff-component-cuff-self-observer-success-message" + : "handcuff-component-cuff-observer-success-message"; + _popup.PopupEntity(Loc.GetString(popupText, + ("user", Identity.Name(user, EntityManager)), ("target", Identity.Entity(target, EntityManager))), target, Filter.Pvs(target, entityManager: EntityManager) .RemoveWhere(e => e.AttachedEntity == target || e.AttachedEntity == user), true); @@ -521,8 +524,11 @@ namespace Content.Shared.Cuffs if (!_doAfter.TryStartDoAfter(doAfterEventArgs)) return true; - _popup.PopupEntity(Loc.GetString("handcuff-component-start-cuffing-observer", - ("user", Identity.Name(user, EntityManager)), ("target", Identity.Name(target, EntityManager))), + var popupText = (user == target) + ? "handcuff-component-start-cuffing-self-observer" + : "handcuff-component-start-cuffing-observer"; + _popup.PopupEntity(Loc.GetString(popupText, + ("user", Identity.Name(user, EntityManager)), ("target", Identity.Entity(target, EntityManager))), target, Filter.Pvs(target, entityManager: EntityManager) .RemoveWhere(e => e.AttachedEntity == target || e.AttachedEntity == user), true); @@ -545,6 +551,7 @@ namespace Content.Shared.Cuffs /// /// Checks if the target is handcuffed. /// + /// /// The entity to be checked /// when true, return false if the target is only partially cuffed (for things with more than 2 hands) /// public bool IsCuffed(Entity target, bool requireFullyCuffed = true) @@ -642,10 +649,13 @@ namespace Content.Shared.Cuffs _adminLog.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(user)} is trying to uncuff {ToPrettyString(target)}"); + var popupText = user == target + ? "cuffable-component-start-uncuffing-self-observer" + : "cuffable-component-start-uncuffing-observer"; _popup.PopupEntity( - Loc.GetString("cuffable-component-start-uncuffing-observer", + Loc.GetString(popupText, ("user", Identity.Name(user, EntityManager)), - ("target", Identity.Name(target, EntityManager))), + ("target", Identity.Entity(target, EntityManager))), target, Filter.Pvs(target, entityManager: EntityManager) .RemoveWhere(e => e.AttachedEntity == target || e.AttachedEntity == user), @@ -710,11 +720,11 @@ namespace Content.Shared.Cuffs if (cuffable.CuffedHandCount == 0) { if (user != null) - _popup.PopupPredicted(Loc.GetString("cuffable-component-remove-cuffs-success-message"), user.Value, user.Value); + _popup.PopupClient(Loc.GetString("cuffable-component-remove-cuffs-success-message"), user.Value, user.Value); if (target != user && user != null) { - _popup.PopupPredicted(Loc.GetString("cuffable-component-remove-cuffs-by-other-success-message", + _popup.PopupEntity(Loc.GetString("cuffable-component-remove-cuffs-by-other-success-message", ("otherName", Identity.Name(user.Value, EntityManager, user))), target, target); _adminLog.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user):player} has successfully uncuffed {ToPrettyString(target):player}"); @@ -729,17 +739,17 @@ namespace Content.Shared.Cuffs { if (user != target) { - _popup.PopupPredicted(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", + _popup.PopupClient(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", ("cuffedHandCount", cuffable.CuffedHandCount), ("otherName", Identity.Name(user.Value, EntityManager, user.Value))), user.Value, user.Value); - _popup.PopupPredicted(Loc.GetString( + _popup.PopupEntity(Loc.GetString( "cuffable-component-remove-cuffs-by-other-partial-success-message", ("otherName", Identity.Name(user.Value, EntityManager, user.Value)), ("cuffedHandCount", cuffable.CuffedHandCount)), target, target); } else { - _popup.PopupPredicted(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", + _popup.PopupClient(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", ("cuffedHandCount", cuffable.CuffedHandCount)), user.Value, user.Value); } } diff --git a/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl b/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl index d84ed3f781..a2cb6ed658 100644 --- a/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl +++ b/Resources/Locale/en-US/cuffs/components/cuffable-component.ftl @@ -3,6 +3,7 @@ cuffable-component-cannot-remove-cuffs-too-far-message = You are too far away to cuffable-component-start-uncuffing-self = You start to painfully wriggle out of your restraints. cuffable-component-start-uncuffing-observer = {$user} starts unrestraining {$target}! +cuffable-component-start-uncuffing-self-observer = {$user} starts unrestraining {REFLEXIVE($target)}! cuffable-component-start-uncuffing-target-message = You start unrestraining {$targetName}. cuffable-component-start-uncuffing-by-other-message = {$otherName} starts unrestraining you! diff --git a/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl b/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl index a4de62ede4..0f3c7cfd52 100644 --- a/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl +++ b/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl @@ -4,9 +4,11 @@ handcuff-component-target-has-no-hands-error = {$targetName} has no hands! handcuff-component-target-has-no-free-hands-error = {$targetName} has no free hands! handcuff-component-too-far-away-error = You are too far away to use the restraints! handcuff-component-start-cuffing-observer = {$user} starts restraining {$target}! +handcuff-component-start-cuffing-self-observer = {$user} starts restraining {REFLEXIVE($target)}. handcuff-component-start-cuffing-target-message = You start restraining {$targetName}. handcuff-component-start-cuffing-by-other-message = {$otherName} starts restraining you! handcuff-component-cuff-observer-success-message = {$user} restrains {$target}. +handcuff-component-cuff-self-observer-success-message = {$user} restrains {REFLEXIVE($target)}. handcuff-component-cuff-other-success-message = You successfully restrain {$otherName}. handcuff-component-cuff-by-other-success-message = You have been restrained by {$otherName}! handcuff-component-cuff-self-success-message = You restrain yourself. -- 2.51.2