Pulling rework (#20906)

* 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
This commit is contained in:
metalgearsloth
2024-02-03 14:36:09 +11:00
committed by GitHub
parent 79e3a6630d
commit 0d8254b2a2
53 changed files with 764 additions and 1359 deletions

View File

@@ -1,48 +0,0 @@
using Content.Shared.Input;
using Content.Shared.Pulling;
using Content.Shared.Pulling.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
namespace Content.Server.Pulling
{
[UsedImplicitly]
public sealed class PullingSystem : SharedPullingSystem
{
public override void Initialize()
{
base.Initialize();
UpdatesAfter.Add(typeof(PhysicsSystem));
SubscribeLocalEvent<SharedPullableComponent, PullableMoveMessage>(OnPullableMove);
SubscribeLocalEvent<SharedPullableComponent, PullableStopMovingMessage>(OnPullableStopMove);
CommandBinds.Builder
.Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(HandleReleasePulledObject))
.Register<PullingSystem>();
}
private void HandleReleasePulledObject(ICommonSession? session)
{
if (session?.AttachedEntity is not {Valid: true} player)
{
return;
}
if (!TryGetPulled(player, out var pulled))
{
return;
}
if (!EntityManager.TryGetComponent(pulled.Value, out SharedPullableComponent? pullable))
{
return;
}
TryStopPull(pullable);
}
}
}