Pulling rework v2 (#24936)

* Pulling rework

Fixing up the FOUR systems managing pulling, all the shitcode, and also making it nicer ingame.

* More pulling cleanup

* stats

* More cleanup

* First draft

* More pulling

* weh

* Fix puller

* Pulling working

* Fix merge

* Dunked

* Self-merge time

* Fix hotkey

* Fix container changes

* oop

* Fix multi-pulling

* Move alerts cleanup.

* pulling fixes
This commit is contained in:
metalgearsloth
2024-03-19 14:30:56 +11:00
committed by GitHub
parent f8b54a06b7
commit c584f6444a
53 changed files with 797 additions and 1357 deletions

View File

@@ -1,6 +1,5 @@
using System.Numerics;
using Content.Server.Inventory;
using Content.Server.Pulling;
using Content.Server.Stack;
using Content.Server.Stunnable;
using Content.Shared.ActionBlocker;
@@ -13,9 +12,9 @@ using Content.Shared.Hands.EntitySystems;
using Content.Shared.IdentityManagement;
using Content.Shared.Input;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Physics.Pull;
using Content.Shared.Popups;
using Content.Shared.Pulling.Components;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Stacks;
using Content.Shared.Throwing;
using Robust.Shared.Audio;
@@ -88,9 +87,8 @@ namespace Content.Server.Hands.Systems
return;
// Break any pulls
if (TryComp(uid, out SharedPullerComponent? puller) && puller.Pulling is EntityUid pulled &&
TryComp(pulled, out SharedPullableComponent? pullable))
_pullingSystem.TryStopPull(pullable);
if (TryComp(uid, out PullerComponent? puller) && TryComp(puller.Pulling, out PullableComponent? pullable))
_pullingSystem.TryStopPull(puller.Pulling.Value, pullable);
if (!_handsSystem.TryDrop(uid, component.ActiveHand!, null, checkActionBlocker: false))
return;
@@ -130,13 +128,13 @@ namespace Content.Server.Hands.Systems
private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args)
{
if (args.Puller.Owner != uid)
if (args.PullerUid != uid)
return;
if (TryComp<SharedPullerComponent>(args.Puller.Owner, out var pullerComp) && !pullerComp.NeedsHands)
if (TryComp<PullerComponent>(args.PullerUid, out var pullerComp) && !pullerComp.NeedsHands)
return;
if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.Pulled.Owner, uid))
if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.PulledUid, uid))
{
DebugTools.Assert("Unable to find available hand when starting pulling??");
}
@@ -144,7 +142,7 @@ namespace Content.Server.Hands.Systems
private void HandlePullStopped(EntityUid uid, HandsComponent component, PullStoppedMessage args)
{
if (args.Puller.Owner != uid)
if (args.PullerUid != uid)
return;
// Try find hand that is doing this pull.
@@ -153,8 +151,10 @@ namespace Content.Server.Hands.Systems
{
if (hand.HeldEntity == null
|| !TryComp(hand.HeldEntity, out VirtualItemComponent? virtualItem)
|| virtualItem.BlockingEntity != args.Pulled.Owner)
|| virtualItem.BlockingEntity != args.PulledUid)
{
continue;
}
QueueDel(hand.HeldEntity.Value);
break;