Partial hand ECS (#5634)
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com> Co-authored-by: Paul <ritter.paul1@googlemail.com>
This commit is contained in:
@@ -47,18 +47,14 @@ namespace Content.Server.Strip
|
||||
|
||||
_strippableSystem = EntitySystem.Get<StrippableSystem>();
|
||||
Owner.EnsureComponentWarn<ServerInventoryComponent>();
|
||||
var hands = Owner.EnsureComponentWarn<HandsComponent>();
|
||||
var cuffed = Owner.EnsureComponentWarn<CuffableComponent>();
|
||||
cuffed.OnCuffedStateChanged += UpdateState;
|
||||
hands.OnItemChanged += UpdateState;
|
||||
}
|
||||
|
||||
protected override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
if(_entities.TryGetComponent<HandsComponent>(Owner, out var hands))
|
||||
hands.OnItemChanged -= UpdateState;
|
||||
if(_entities.TryGetComponent<CuffableComponent>(Owner, out var cuffed))
|
||||
cuffed.OnCuffedStateChanged -= UpdateState;
|
||||
}
|
||||
@@ -208,8 +204,8 @@ namespace Content.Server.Strip
|
||||
if (result != DoAfterStatus.Finished) return;
|
||||
|
||||
userHands.Drop(hand);
|
||||
hands.TryPickupEntity(hand, item!.Owner, checkActionBlocker: false);
|
||||
UpdateState();
|
||||
hands.TryPickupEntity(hand, item!.Owner, checkActionBlocker: false, animateUser: true);
|
||||
// hand update will trigger strippable update
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -314,10 +310,12 @@ namespace Content.Server.Strip
|
||||
var result = await doAfterSystem.WaitDoAfter(doAfterArgs);
|
||||
if (result != DoAfterStatus.Finished) return;
|
||||
|
||||
var item = hands.GetItem(hand);
|
||||
if (!hands.TryGetHeldEntity(hand, out var entity))
|
||||
return;
|
||||
|
||||
hands.Drop(hand, false);
|
||||
userHands.PutInHandOrDrop(item!);
|
||||
UpdateState();
|
||||
userHands.PutInHandOrDrop(entity.Value);
|
||||
// hand update will trigger strippable update
|
||||
}
|
||||
|
||||
private void HandleUserInterfaceMessage(ServerBoundUserInterfaceMessage obj)
|
||||
|
||||
Reference in New Issue
Block a user