Revert "ctrl-rclick tweaks" (#7171)

This commit is contained in:
metalgearsloth
2022-03-18 15:40:02 +11:00
committed by GitHub
parent aec9dc4d82
commit 8bf00b40cd
7 changed files with 209 additions and 39 deletions

View File

@@ -1,11 +1,9 @@
using Content.Server.Throwing;
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.Map;
using Robust.Shared.Players;
namespace Content.Server.Pulling
@@ -19,6 +17,9 @@ namespace Content.Server.Pulling
UpdatesAfter.Add(typeof(PhysicsSystem));
SubscribeLocalEvent<SharedPullableComponent, PullableMoveMessage>(OnPullableMove);
SubscribeLocalEvent<SharedPullableComponent, PullableStopMovingMessage>(OnPullableStopMove);
CommandBinds.Builder
.Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(HandleReleasePulledObject))
.Register<PullingSystem>();
@@ -43,32 +44,5 @@ namespace Content.Server.Pulling
TryStopPull(pullable);
}
public override bool TryMoveTo(SharedPullableComponent pullable, EntityCoordinates to)
{
if (!base.TryMoveTo(pullable, to)) return false;
var xformQuery = GetEntityQuery<TransformComponent>();
var pullableXform = xformQuery.GetComponent(pullable.Owner);
var targetPos = to.ToMap(EntityManager);
if (targetPos.MapId != pullableXform.MapID) return false;
var pullablePos = pullableXform.WorldPosition;
if (pullablePos.EqualsApprox(targetPos.Position, 0.01f)) return false;
var vec = (targetPos.Position - pullablePos);
// Just move it to the spot for finetuning
if (vec.Length < 0.15f)
{
pullableXform.WorldPosition = targetPos.Position;
return true;
}
pullable.Owner.TryThrow(vec, 3f);
return true;
}
}
}