Fix misc cuffing issues (#12127)

This commit is contained in:
Leon Friedrich
2022-10-22 18:54:28 +13:00
committed by GitHub
parent b75cd3f7ca
commit b73d188e67
4 changed files with 27 additions and 7 deletions

View File

@@ -285,6 +285,8 @@ namespace Content.Client.Hands.Systems
if (!Resolve(uid, ref handComp, ref sprite, false)) if (!Resolve(uid, ref handComp, ref sprite, false))
return; return;
OnPlayerItemAdded?.Invoke(hand.Name, held);
if (!handComp.ShowInHands) if (!handComp.ShowInHands)
return; return;
@@ -361,7 +363,6 @@ namespace Content.Client.Hands.Systems
private void HandlePlayerAttached(EntityUid uid, HandsComponent component, PlayerAttachedEvent args) private void HandlePlayerAttached(EntityUid uid, HandsComponent component, PlayerAttachedEvent args)
{ {
if (_playerManager.LocalPlayer?.ControlledEntity == uid)
OnPlayerHandsAdded?.Invoke(component); OnPlayerHandsAdded?.Invoke(component);
} }

View File

@@ -108,7 +108,17 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
foreach (var (name, hand) in handsComp.Hands) foreach (var (name, hand) in handsComp.Hands)
{ {
var handButton = AddHand(name, hand.Location); var handButton = AddHand(name, hand.Location);
if (_entities.TryGetComponent(hand.HeldEntity, out HandVirtualItemComponent? virt))
{
handButton.SpriteView.Sprite = _entities.GetComponentOrNull<SpriteComponent>(virt.BlockingEntity);
handButton.Blocked = true;
}
else
{
handButton.SpriteView.Sprite = _entities.GetComponentOrNull<SpriteComponent>(hand.HeldEntity); handButton.SpriteView.Sprite = _entities.GetComponentOrNull<SpriteComponent>(hand.HeldEntity);
handButton.Blocked = false;
}
} }
var activeHand = handsComp.ActiveHand; var activeHand = handsComp.ActiveHand;
@@ -149,9 +159,16 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
var hand = GetHand(name); var hand = GetHand(name);
if (hand == null) if (hand == null)
return; return;
if (_entities.TryGetComponent(entity, out ISpriteComponent? sprite))
if (_entities.TryGetComponent(entity, out HandVirtualItemComponent? virt))
{ {
hand.SpriteView.Sprite = sprite; hand.SpriteView.Sprite = _entities.GetComponentOrNull<SpriteComponent>(virt.BlockingEntity);
hand.Blocked = true;
}
else
{
hand.SpriteView.Sprite = _entities.GetComponentOrNull<SpriteComponent>(entity);
hand.Blocked = false;
} }
if (_playerHandsComponent?.ActiveHand?.Name == name) if (_playerHandsComponent?.ActiveHand?.Name == name)

View File

@@ -235,7 +235,7 @@ namespace Content.Server.Cuffs.Components
} }
var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime; var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime;
var doAfterEventArgs = new DoAfterEventArgs(user, uncuffTime) var doAfterEventArgs = new DoAfterEventArgs(user, uncuffTime, target: Owner)
{ {
BreakOnUserMove = true, BreakOnUserMove = true,
BreakOnTargetMove = true, BreakOnTargetMove = true,

View File

@@ -1,5 +1,6 @@
using System.Threading; using System.Threading;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Robust.Shared.Utility;
namespace Content.Server.DoAfter namespace Content.Server.DoAfter
{ {
@@ -125,6 +126,7 @@ namespace Content.Server.DoAfter
if (Target == null) if (Target == null)
{ {
DebugTools.Assert(!BreakOnTargetMove);
BreakOnTargetMove = false; BreakOnTargetMove = false;
} }
} }