mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 00:27:59 +00:00
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
(cherry picked from commit c584f6444a)
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
using System.Numerics;
|
||||
using Content.Server.Inventory;
|
||||
using Content.Server.Pulling;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Hands.Components;
|
||||
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.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;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Map;
|
||||
@@ -38,7 +42,7 @@ namespace Content.Server.Hands.Systems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, DisarmedEvent>(OnDisarmed, before: new[] {typeof(StunSystem)});
|
||||
SubscribeLocalEvent<HandsComponent, DisarmedEvent>(OnDisarmed, before: new[] {typeof(StunSystem), typeof(StaminaSystem)});
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, PullStartedMessage>(HandlePullStarted);
|
||||
SubscribeLocalEvent<HandsComponent, PullStoppedMessage>(HandlePullStopped);
|
||||
@@ -83,13 +87,14 @@ 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;
|
||||
|
||||
args.PopupPrefix = "disarm-action-";
|
||||
|
||||
args.Handled = true; // no shove/stun.
|
||||
}
|
||||
|
||||
@@ -123,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??");
|
||||
}
|
||||
@@ -137,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.
|
||||
@@ -146,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;
|
||||
|
||||
Reference in New Issue
Block a user