fix uncuff popups (#35743)

* fix uncuff popups

* them too
This commit is contained in:
Errant
2025-03-20 03:15:44 +01:00
committed by GitHub
parent 887edf2d7b
commit ba56fe8ebc
3 changed files with 24 additions and 11 deletions

View 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);
}
}