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

@@ -64,10 +64,10 @@ public sealed class SmartEquipSystem : EntitySystem
return;
// early out if we don't have any hands or a valid inventory slot
if (!TryComp<HandsComponent>(uid, out var hands) || hands.ActiveHand == null)
if (!TryComp<HandsComponent>(uid, out var hands) || hands.ActiveHandId == null)
return;
var handItem = hands.ActiveHand.HeldEntity;
var handItem = _hands.GetActiveItem((uid, hands));
// can the user interact, and is the item interactable? e.g. virtual items
if (!_actionBlocker.CanInteract(uid, handItem))
@@ -80,7 +80,7 @@ public sealed class SmartEquipSystem : EntitySystem
}
// early out if we have an item and cant drop it at all
if (handItem != null && !_hands.CanDropHeld(uid, hands.ActiveHand))
if (hands.ActiveHandId != null && !_hands.CanDropHeld(uid, hands.ActiveHandId))
{
_popup.PopupClient(Loc.GetString("smart-equip-cant-drop"), uid, uid);
return;
@@ -121,7 +121,7 @@ public sealed class SmartEquipSystem : EntitySystem
return;
}
_hands.TryDrop(uid, hands.ActiveHand, handsComp: hands);
_hands.TryDrop((uid, hands), hands.ActiveHandId!);
_inventory.TryEquip(uid, handItem.Value, equipmentSlot, predicted: true, checkDoafter:true);
return;
}
@@ -149,7 +149,7 @@ public sealed class SmartEquipSystem : EntitySystem
return;
}
_hands.TryDrop(uid, hands.ActiveHand, handsComp: hands);
_hands.TryDrop((uid, hands), hands.ActiveHandId!);
_storage.Insert(slotItem, handItem.Value, out var stacked, out _);
// if the hand item stacked with the things in inventory, but there's no more space left for the rest