diff --git a/Content.Server/GameObjects/Components/Movement/PlayerInputMoverComponent.cs b/Content.Server/GameObjects/Components/Movement/PlayerInputMoverComponent.cs index 1d80e1c9d5..3b4708eec4 100644 --- a/Content.Server/GameObjects/Components/Movement/PlayerInputMoverComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/PlayerInputMoverComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.Interfaces.GameObjects.Components.Movement; + +using Content.Server.Interfaces.GameObjects.Components.Movement; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components; @@ -8,6 +9,9 @@ using Robust.Shared.Maths; using Robust.Shared.Physics; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; +using Robust.Shared.IoC; +using Robust.Shared.Interfaces.Configuration; +using Robust.Shared.Configuration; namespace Content.Server.GameObjects.Components.Movement { @@ -18,6 +22,11 @@ namespace Content.Server.GameObjects.Components.Movement [ComponentReference(typeof(IMoverComponent))] public class PlayerInputMoverComponent : Component, IMoverComponent, ICollideSpecial { + +#pragma warning disable 649 + [Dependency] private readonly IConfigurationManager _configurationManager; +#pragma warning restore 649 + private bool _movingUp; private bool _movingDown; private bool _movingLeft; @@ -54,6 +63,17 @@ namespace Content.Server.GameObjects.Components.Movement public float StepSoundDistance { get; set; } + /// + /// Whether or not the player can move diagonally. + /// + [ViewVariables] public bool DiagonalMovementEnabled => _configurationManager.GetCVar("game.diagonalmovement"); + + public override void Initialize() + { + base.Initialize(); + _configurationManager.RegisterCVar("game.diagonalmovement", true, CVar.ARCHIVE); + } + /// public override void OnAdd() { @@ -110,8 +130,11 @@ namespace Content.Server.GameObjects.Components.Movement x += _movingRight ? 1 : 0; var y = 0; - y -= _movingDown ? 1 : 0; - y += _movingUp ? 1 : 0; + if (DiagonalMovementEnabled || x == 0) + { + y -= _movingDown ? 1 : 0; + y += _movingUp ? 1 : 0; + } VelocityDir = new Vector2(x, y);