Selectively revert PullController (#28126) (#330)

I am leaving the issues open and have updated #26547 with more info on what we should do long-term. This is just to bandaid the short-term complaining.

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Aviu00
2024-06-05 14:31:32 +00:00
committed by GitHub
parent 2978834228
commit a60d4eec45
5 changed files with 346 additions and 45 deletions

View File

@@ -43,8 +43,6 @@ public sealed class PullingSystem : EntitySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _xformSys = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
public override void Initialize()
{
@@ -65,7 +63,6 @@ public sealed class PullingSystem : EntitySystem
SubscribeLocalEvent<PullerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
CommandBinds.Builder
.Bind(ContentKeyFunctions.MovePulledObject, new PointerInputCmdHandler(OnRequestMovePulledObject))
.Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(OnReleasePulledObject, handle: false))
.Register<PullingSystem>();
}
@@ -233,47 +230,6 @@ public sealed class PullingSystem : EntitySystem
return Resolve(uid, ref component, false) && component.BeingPulled;
}
private bool OnRequestMovePulledObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
if (session?.AttachedEntity is not { } player ||
!player.IsValid())
{
return false;
}
if (!TryComp<PullerComponent>(player, out var pullerComp))
return false;
var pulled = pullerComp.Pulling;
if (!HasComp<PullableComponent>(pulled))
return false;
if (_containerSystem.IsEntityInContainer(player))
return false;
// Cooldown buddy
if (_timing.CurTime < pullerComp.NextThrow)
return false;
pullerComp.NextThrow = _timing.CurTime + pullerComp.ThrowCooldown;
// Cap the distance
const float range = 2f;
var fromUserCoords = coords.WithEntityId(player, EntityManager);
var userCoords = new EntityCoordinates(player, Vector2.Zero);
if (!userCoords.InRange(EntityManager, _xformSys, fromUserCoords, range))
{
var userDirection = fromUserCoords.Position - userCoords.Position;
fromUserCoords = userCoords.Offset(userDirection.Normalized() * range);
}
Dirty(player, pullerComp);
_throwing.TryThrow(pulled.Value, fromUserCoords, user: player, strength: 4f, animated: false, recoil: false, playSound: false, doSpin: false);
return false;
}
// WD ADDED
public bool TryGetPulledEntity(
EntityUid puller,