Today I join Zumorica in leaving behind our crimes against humanity (#2396)
This commit is contained in:
@@ -146,26 +146,6 @@ namespace Content.Shared.GameObjects.Components.Pulling
|
||||
return controller.TryMoveTo(Puller.Transform.Coordinates, to);
|
||||
}
|
||||
|
||||
private void PullerMoved(MoveEvent moveEvent)
|
||||
{
|
||||
if (Puller == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (moveEvent.Sender != Puller)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Owner.TryGetComponent(out IPhysicsComponent? physics))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
physics.WakeBody();
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new PullableComponentState(Puller?.Uid);
|
||||
@@ -202,13 +182,9 @@ namespace Content.Shared.GameObjects.Components.Pulling
|
||||
switch (message)
|
||||
{
|
||||
case PullStartedMessage msg:
|
||||
Owner.EntityManager.EventBus.SubscribeEvent<MoveEvent>(EventSource.Local, this, PullerMoved);
|
||||
|
||||
AddPullingStatuses(msg.Puller.Owner);
|
||||
break;
|
||||
case PullStoppedMessage msg:
|
||||
Owner.EntityManager.EventBus.UnsubscribeEvent<MoveEvent>(EventSource.Local, this);
|
||||
|
||||
RemovePullingStatuses(msg.Puller.Owner);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ using Content.Shared.Input;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Components.Transform;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -17,6 +19,9 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
[UsedImplicitly]
|
||||
public class SharedPullingSystem : EntitySystem
|
||||
{
|
||||
/// <summary>
|
||||
/// A mapping of pullers to the entity that they are pulling.
|
||||
/// </summary>
|
||||
private readonly Dictionary<IEntity, IEntity> _pullers =
|
||||
new Dictionary<IEntity, IEntity>();
|
||||
|
||||
@@ -26,6 +31,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
SubscribeLocalEvent<PullStartedMessage>(OnPullStarted);
|
||||
SubscribeLocalEvent<PullStoppedMessage>(OnPullStopped);
|
||||
SubscribeLocalEvent<MoveEvent>(PullerMoved);
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(ContentKeyFunctions.MovePulledObject, new PointerInputCmdHandler(HandleMovePulledObject))
|
||||
@@ -43,6 +49,21 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
RemovePuller(message.Puller.Owner);
|
||||
}
|
||||
|
||||
private void PullerMoved(MoveEvent ev)
|
||||
{
|
||||
if (!TryGetPulled(ev.Sender, out var pulled))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pulled.TryGetComponent(out IPhysicsComponent? physics))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
physics.WakeBody();
|
||||
}
|
||||
|
||||
private bool HandleMovePulledObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
|
||||
{
|
||||
var player = session?.AttachedEntity;
|
||||
|
||||
Reference in New Issue
Block a user