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:
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Hands.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.GameTicking;
|
||||
@@ -24,6 +25,7 @@ public sealed class WiresSystem : SharedWiresSystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly HandsSystem _hands = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
@@ -405,19 +407,13 @@ public sealed class WiresSystem : SharedWiresSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var activeHand = handsComponent.ActiveHand;
|
||||
|
||||
if (activeHand == null)
|
||||
if (!_hands.TryGetActiveItem((player, handsComponent), out var heldEntity))
|
||||
return;
|
||||
|
||||
if (activeHand.HeldEntity == null)
|
||||
if (!EntityManager.TryGetComponent(heldEntity, out ToolComponent? tool))
|
||||
return;
|
||||
|
||||
var activeHandEntity = activeHand.HeldEntity.Value;
|
||||
if (!EntityManager.TryGetComponent(activeHandEntity, out ToolComponent? tool))
|
||||
return;
|
||||
|
||||
TryDoWireAction(uid, player, activeHandEntity, args.Id, args.Action, component, tool);
|
||||
TryDoWireAction(uid, player, heldEntity.Value, args.Id, args.Action, component, tool);
|
||||
}
|
||||
|
||||
private void OnDoAfter(EntityUid uid, WiresComponent component, WireDoAfterEvent args)
|
||||
|
||||
Reference in New Issue
Block a user