HandsSystem Refactor (#38438)

* checkpoint

* pt 2

* pt... i forgot

* pt 4

* patch

* More test fixes

* optimization!!!

* the REAL hand system

* fix RetractableItemActionSystem.cs oversight

* the review

* test

* remove test usage of body prototype

* Update Content.IntegrationTests/Tests/Interaction/InteractionTest.cs

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>

* hellcode

* hellcode 2

* Minor cleanup

* test

* Chasing the last of the bugs

* changes

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
This commit is contained in:
Nemanja
2025-06-25 09:13:03 -04:00
committed by GitHub
parent 6cffa8aabe
commit 524725d378
79 changed files with 849 additions and 897 deletions

View File

@@ -112,7 +112,7 @@ public abstract class SharedWieldableSystem : EntitySystem
private void OnDeselectWieldable(EntityUid uid, WieldableComponent component, HandDeselectedEvent args)
{
if (_hands.EnumerateHands(args.User).Count() > 2)
if (_hands.GetHandCount(uid) > 2)
return;
TryUnwield(uid, component, args.User);
@@ -168,7 +168,7 @@ public abstract class SharedWieldableSystem : EntitySystem
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
return;
if (!_hands.IsHolding(args.User, uid, out _, args.Hands))
if (!_hands.IsHolding((args.User, args.Hands), uid, out _))
return;
// TODO VERB TOOLTIPS Make CanWield or some other function return string, set as verb tooltip and disable
@@ -252,7 +252,7 @@ public abstract class SharedWieldableSystem : EntitySystem
}
// Is it.. actually in one of their hands?
if (!_hands.IsHolding(user, uid, out _, hands))
if (!_hands.IsHolding((user, hands), uid, out _))
{
if (!quiet)
_popup.PopupClient(Loc.GetString("wieldable-component-not-in-hands", ("item", uid)), user, user);
@@ -373,7 +373,7 @@ public abstract class SharedWieldableSystem : EntitySystem
/// <param name="force">If this is true we will bypass UnwieldAttemptEvent.</param>
public void UnwieldAll(Entity<HandsComponent?> wielder, bool force = false)
{
foreach (var held in _hands.EnumerateHeld(wielder.Owner, wielder.Comp))
foreach (var held in _hands.EnumerateHeld(wielder))
{
if (TryComp<WieldableComponent>(held, out var wieldable))
TryUnwield(held, wieldable, wielder, force);