]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix uncuff popups (#35743)
authorErrant <35878406+Errant-4@users.noreply.github.com>
Thu, 20 Mar 2025 02:15:44 +0000 (03:15 +0100)
committerGitHub <noreply@github.com>
Thu, 20 Mar 2025 02:15:44 +0000 (19:15 -0700)
* fix uncuff popups

* them too

Content.Shared/Cuffs/SharedCuffableSystem.cs
Resources/Locale/en-US/cuffs/components/cuffable-component.ftl
Resources/Locale/en-US/cuffs/components/handcuff-component.ftl

index 0e8b51137f8cea300fb64856a8ca8cc599cbe171..815760626d985934ed3687a9eaca734c7a7991ef 100644 (file)
@@ -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
         /// <summary>
         /// Checks if the target is handcuffed.
         /// </summary>
+        /// /// <param name="target">The entity to be checked</param>
         /// <param name="requireFullyCuffed">when true, return false if the target is only partially cuffed (for things with more than 2 hands)</param>
         /// <returns></returns>
         public bool IsCuffed(Entity<CuffableComponent> 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);
                 }
             }
index d84ed3f7818e46b73788e075489b7b2197329c4c..a2cb6ed65897b89940c2bc62fcd42652fcf7bb92 100644 (file)
@@ -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!
 
index a4de62ede48a3f86f92e553115b8b618d147ae09..0f3c7cfd522f62ace6fe62ae1417fc89fc42ff28 100644 (file)
@@ -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.