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

@@ -255,7 +255,7 @@ namespace Content.Shared.Containers.ItemSlots
}
// Drop the held item onto the floor. Return if the user cannot drop.
if (!_handsSystem.TryDrop(args.User, args.Used, handsComp: hands))
if (!_handsSystem.TryDrop(args.User, args.Used))
return;
slots.Sort(SortEmpty);
@@ -395,17 +395,17 @@ namespace Content.Shared.Containers.ItemSlots
if (!Resolve(user, ref hands, false))
return false;
if (hands.ActiveHand?.HeldEntity is not { } held)
if (!_handsSystem.TryGetActiveItem((uid, hands), out var held))
return false;
if (!CanInsert(uid, held, user, slot))
if (!CanInsert(uid, held.Value, user, slot))
return false;
// hands.Drop(item) checks CanDrop action blocker
if (!_handsSystem.TryDrop(user, hands.ActiveHand))
if (!_handsSystem.TryDrop(user, hands.ActiveHandId!))
return false;
Insert(uid, slot, held, user, excludeUserAudio: excludeUserAudio);
Insert(uid, slot, held.Value, user, excludeUserAudio: excludeUserAudio);
return true;
}
@@ -428,16 +428,14 @@ namespace Content.Shared.Containers.ItemSlots
if (!Resolve(ent, ref ent.Comp, false))
return false;
TryComp(user, out HandsComponent? handsComp);
if (!TryGetAvailableSlot(ent,
item,
user == null ? null : (user.Value, handsComp),
user,
out var itemSlot,
emptyOnly: true))
return false;
if (user != null && !_handsSystem.TryDrop(user.Value, item, handsComp: handsComp))
if (user != null && !_handsSystem.TryDrop(user.Value, item))
return false;
Insert(ent, itemSlot, item, user, excludeUserAudio: excludeUserAudio);
@@ -466,7 +464,7 @@ namespace Content.Shared.Containers.ItemSlots
&& Resolve(user, ref user.Comp)
&& _handsSystem.IsHolding(user, item))
{
if (!_handsSystem.CanDrop(user, item, user.Comp))
if (!_handsSystem.CanDrop(user, item))
return false;
}