Fix a player's mob continuing to move after disconnecting (#1265)

This commit is contained in:
DrSmugleaf
2020-07-03 23:32:41 +02:00
committed by GitHub
parent 299b2bda6b
commit 73eb53da46
5 changed files with 10 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ namespace Content.Client.GameObjects.EntitySystems
protected override void SetController(PhysicsComponent physics) protected override void SetController(PhysicsComponent physics)
{ {
((PhysicsComponent)physics).SetController<MoverController>(); physics.SetController<MoverController>();
} }
} }
} }

View File

@@ -79,7 +79,7 @@ namespace Content.Server.GameObjects.EntitySystems
protected override void SetController(PhysicsComponent physics) protected override void SetController(PhysicsComponent physics)
{ {
((PhysicsComponent) physics).SetController<MoverController>(); physics.SetController<MoverController>();
} }
private static void PlayerAttached(PlayerAttachSystemMessage ev) private static void PlayerAttached(PlayerAttachSystemMessage ev)
@@ -96,6 +96,11 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
ev.Entity.RemoveComponent<PlayerInputMoverComponent>(); ev.Entity.RemoveComponent<PlayerInputMoverComponent>();
} }
if (ev.Entity.TryGetComponent(out PhysicsComponent physics))
{
(physics.Controller as MoverController)?.StopMoving();
}
} }
protected override void HandleFootsteps(IMoverComponent mover) protected override void HandleFootsteps(IMoverComponent mover)

View File

@@ -22,6 +22,7 @@ using Content.Shared;
using Content.Shared.Chat; using Content.Shared.Chat;
using Content.Shared.GameObjects.Components.PDA; using Content.Shared.GameObjects.Components.PDA;
using Content.Shared.Jobs; using Content.Shared.Jobs;
using Content.Shared.Physics;
using Content.Shared.Preferences; using Content.Shared.Preferences;
using Prometheus; using Prometheus;
using Robust.Server.Interfaces; using Robust.Server.Interfaces;
@@ -32,6 +33,7 @@ using Robust.Server.ServerStatus;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Enums; using Robust.Shared.Enums;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.GameObjects.Systems; using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Configuration; using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;

View File

@@ -45,7 +45,7 @@ namespace Content.Shared.GameObjects.Components.Movement
/// <summary> /// <summary>
/// Toggles one of the four cardinal directions. Each of the four directions are /// Toggles one of the four cardinal directions. Each of the four directions are
/// composed into a single direction vector, <see cref="PlayerInputMoverComponent.VelocityDir"/>. Enabling /// composed into a single direction vector, <see cref="SharedPlayerInputMoverComponent.VelocityDir"/>. Enabling
/// opposite directions will cancel each other out, resulting in no direction. /// opposite directions will cancel each other out, resulting in no direction.
/// </summary> /// </summary>
/// <param name="direction">Direction to toggle.</param> /// <param name="direction">Direction to toggle.</param>

View File

@@ -54,7 +54,6 @@ namespace Content.Shared.GameObjects.EntitySystems
base.Shutdown(); base.Shutdown();
} }
protected void UpdateKinematics(ITransformComponent transform, IMoverComponent mover, PhysicsComponent physics, protected void UpdateKinematics(ITransformComponent transform, IMoverComponent mover, PhysicsComponent physics,
CollidableComponent? collider = null) CollidableComponent? collider = null)
{ {