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

@@ -21,9 +21,8 @@ using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
using Content.Shared.Physics.Pull;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Popups;
using Content.Shared.Pulling.Components;
using Content.Shared.Pulling.Events;
using Content.Shared.Rejuvenate;
using Content.Shared.Stunnable;
@@ -36,6 +35,7 @@ using Robust.Shared.Containers;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Serialization;
using PullableComponent = Content.Shared.Movement.Pulling.Components.PullableComponent;
namespace Content.Shared.Cuffs
{
@@ -70,7 +70,7 @@ namespace Content.Shared.Cuffs
SubscribeLocalEvent<CuffableComponent, EntInsertedIntoContainerMessage>(OnCuffsInsertedIntoContainer);
SubscribeLocalEvent<CuffableComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<CuffableComponent, ComponentInit>(OnStartup);
SubscribeLocalEvent<CuffableComponent, StopPullingEvent>(HandleStopPull);
SubscribeLocalEvent<CuffableComponent, AttemptStopPullingEvent>(HandleStopPull);
SubscribeLocalEvent<CuffableComponent, UpdateCanMoveEvent>(HandleMoveAttempt);
SubscribeLocalEvent<CuffableComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
SubscribeLocalEvent<CuffableComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
@@ -182,7 +182,7 @@ namespace Content.Shared.Cuffs
private void OnBeingPulledAttempt(EntityUid uid, CuffableComponent component, BeingPulledAttemptEvent args)
{
if (!TryComp<SharedPullableComponent>(uid, out var pullable))
if (!TryComp<PullableComponent>(uid, out var pullable))
return;
if (pullable.Puller != null && !component.CanStillInteract) // If we are being pulled already and cuffed, we can't get pulled again.
@@ -214,19 +214,19 @@ namespace Content.Shared.Cuffs
private void HandleMoveAttempt(EntityUid uid, CuffableComponent component, UpdateCanMoveEvent args)
{
if (component.CanStillInteract || !EntityManager.TryGetComponent(uid, out SharedPullableComponent? pullable) || !pullable.BeingPulled)
if (component.CanStillInteract || !EntityManager.TryGetComponent(uid, out PullableComponent? pullable) || !pullable.BeingPulled)
return;
args.Cancel();
}
private void HandleStopPull(EntityUid uid, CuffableComponent component, StopPullingEvent args)
private void HandleStopPull(EntityUid uid, CuffableComponent component, AttemptStopPullingEvent args)
{
if (args.User == null || !Exists(args.User.Value))
return;
if (args.User.Value == uid && !component.CanStillInteract)
args.Cancel();
args.Cancelled = true;
}
private void AddUncuffVerb(EntityUid uid, CuffableComponent component, GetVerbsEvent<Verb> args)