Remove telekinesis (#9737)

This commit is contained in:
Leon Friedrich
2022-07-15 13:37:58 +12:00
committed by GitHub
parent 4100516bde
commit 2b726617cd

View File

@@ -10,6 +10,7 @@ using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Players;
namespace Content.Shared.Pulling
@@ -41,6 +42,7 @@ namespace Content.Shared.Pulling
SubscribeLocalEvent<PullStartedMessage>(OnPullStarted);
SubscribeLocalEvent<PullStoppedMessage>(OnPullStopped);
SubscribeLocalEvent<EntInsertedIntoContainerMessage>(HandleContainerInsert);
SubscribeLocalEvent<SharedPullableComponent, JointRemovedEvent>(OnJointRemoved);
SubscribeLocalEvent<SharedPullableComponent, PullStartedMessage>(PullableHandlePullStarted);
SubscribeLocalEvent<SharedPullableComponent, PullStoppedMessage>(PullableHandlePullStopped);
@@ -52,6 +54,28 @@ namespace Content.Shared.Pulling
.Register<SharedPullingSystem>();
}
private void OnJointRemoved(EntityUid uid, SharedPullableComponent component, JointRemovedEvent args)
{
if (component.Puller != args.OtherBody.Owner)
return;
// Do we have some other join with our Puller?
// or alternatively:
// TODO track the relevant joint.
if (TryComp(uid, out JointComponent? joints))
{
foreach (var jt in joints.GetJoints)
{
if (jt.BodyAUid == component.Puller || jt.BodyBUid == component.Puller)
return;
}
}
// No more joints with puller -> force stop pull.
_pullSm.ForceDisconnectPullable(component);
}
private void AddPullVerbs(EntityUid uid, SharedPullableComponent component, GetVerbsEvent<Verb> args)
{
if (!args.CanAccess || !args.CanInteract)