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);
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);
/// <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)
_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),
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}");
{
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);
}
}