Fix pulled physics objects not being woken up when the puller moves (#1720)
This commit is contained in:
@@ -20,6 +20,7 @@ using Robust.Server.GameObjects.EntitySystemMessages;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Components.Transform;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -571,6 +572,21 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveEvent(MoveEvent moveEvent)
|
||||
{
|
||||
if (moveEvent.Sender != Owner)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsPulling)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PulledObject!.WakeBody();
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
@@ -584,9 +600,13 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
switch (message)
|
||||
{
|
||||
case PullStartedMessage msg:
|
||||
Owner.EntityManager.EventBus.SubscribeEvent<MoveEvent>(EventSource.Local, this, MoveEvent);
|
||||
|
||||
AddPullingStatuses(msg.Pulled.Owner);
|
||||
break;
|
||||
case PullStoppedMessage msg:
|
||||
Owner.EntityManager.EventBus.UnsubscribeEvent<MoveEvent>(EventSource.Local, this);
|
||||
|
||||
RemovePullingStatuses(msg.Pulled.Owner);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace Content.Shared.Physics.Pull
|
||||
return;
|
||||
}
|
||||
|
||||
ControlledComponent.WakeBody();
|
||||
|
||||
var message = new PullStartedMessage(this, _puller, ControlledComponent);
|
||||
|
||||
_puller.Owner.SendMessage(null, message);
|
||||
@@ -64,6 +66,8 @@ namespace Content.Shared.Physics.Pull
|
||||
return;
|
||||
}
|
||||
|
||||
ControlledComponent.WakeBody();
|
||||
|
||||
var message = new PullStoppedMessage(this, oldPuller, ControlledComponent);
|
||||
|
||||
oldPuller.Owner.SendMessage(null, message);
|
||||
@@ -86,6 +90,8 @@ namespace Content.Shared.Physics.Pull
|
||||
return;
|
||||
}
|
||||
|
||||
ControlledComponent.WakeBody();
|
||||
|
||||
var dist = _puller.Owner.Transform.GridPosition.Position - to.Position;
|
||||
|
||||
if (Math.Sqrt(dist.LengthSquared) > DistBeforeStopPull ||
|
||||
|
||||
Reference in New Issue
Block a user