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:
@@ -6,17 +6,17 @@ namespace Content.Shared.Hands.EntitySystems;
|
||||
// These functions are mostly unused except for some AI operator stuff
|
||||
// Nothing stops them from being used in general. If they ever get used elsewhere, then this file probably needs to be renamed.
|
||||
|
||||
public abstract partial class SharedHandsSystem : EntitySystem
|
||||
public abstract partial class SharedHandsSystem
|
||||
{
|
||||
public bool TrySelect(EntityUid uid, EntityUid? entity, HandsComponent? handsComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
return false;
|
||||
|
||||
if (!IsHolding(uid, entity, out var hand, handsComp))
|
||||
if (!IsHolding((uid, handsComp), entity, out var hand))
|
||||
return false;
|
||||
|
||||
SetActiveHand(uid, hand, handsComp);
|
||||
SetActiveHand((uid, handsComp), hand);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,12 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
return false;
|
||||
|
||||
foreach (var hand in handsComp.Hands.Values)
|
||||
foreach (var hand in handsComp.Hands.Keys)
|
||||
{
|
||||
if (TryComp(hand.HeldEntity, out component))
|
||||
if (!TryGetHeldItem((uid, handsComp), hand, out var held))
|
||||
continue;
|
||||
|
||||
if (TryComp(held, out component))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user