diff --git a/Content.IntegrationTests/Tests/Slipping/SlippingTest.cs b/Content.IntegrationTests/Tests/Slipping/SlippingTest.cs index 7f77146f455..511a720ed07 100644 --- a/Content.IntegrationTests/Tests/Slipping/SlippingTest.cs +++ b/Content.IntegrationTests/Tests/Slipping/SlippingTest.cs @@ -1,11 +1,14 @@ #nullable enable using System.Collections.Generic; using Content.IntegrationTests.Tests.Interaction; +using Content.Shared.CCVar; using Content.Shared.Movement.Components; using Content.Shared.Slippery; using Content.Shared.Stunnable; +using Robust.Shared.Configuration; using Robust.Shared.GameObjects; using Robust.Shared.Input; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.IntegrationTests.Tests.Slipping; @@ -14,6 +17,7 @@ public sealed class SlippingTest : MovementTest { public sealed class SlipTestSystem : EntitySystem { + [Dependency] public readonly IConfigurationManager Config = default!; public HashSet Slipped = new(); public override void Initialize() { @@ -30,6 +34,7 @@ private void OnSlip(EntityUid uid, SlipperyComponent component, ref SlipEvent ar public async Task BananaSlipTest() { var sys = SEntMan.System(); + var sprintWalks = sys.Config.GetCVar(CCVars.GamePressToSprint); await SpawnTarget("TrashBananaPeel"); var modifier = Comp(Player).SprintSpeedModifier; @@ -42,7 +47,7 @@ public async Task BananaSlipTest() #pragma warning restore NUnit2045 // Walking over the banana slowly does not trigger a slip. - await SetKey(EngineKeyFunctions.Walk, BoundKeyState.Down); + await SetKey(EngineKeyFunctions.Walk, sprintWalks ? BoundKeyState.Up : BoundKeyState.Down); await Move(DirectionFlag.East, 1f); #pragma warning disable NUnit2045 Assert.That(Delta(), Is.LessThan(0.5f)); @@ -51,10 +56,9 @@ public async Task BananaSlipTest() AssertComp(false, Player); // Moving at normal speeds does trigger a slip. - await SetKey(EngineKeyFunctions.Walk, BoundKeyState.Up); + await SetKey(EngineKeyFunctions.Walk, sprintWalks ? BoundKeyState.Down : BoundKeyState.Up); await Move(DirectionFlag.West, 1f); Assert.That(sys.Slipped, Does.Contain(SEntMan.GetEntity(Player))); AssertComp(true, Player); } } - diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 3c3bfa8862d..df463b27299 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -407,6 +407,13 @@ public static readonly CVarDef public static readonly CVarDef GameAutoEatDrinks = CVarDef.Create("game.auto_eat_drinks", false, CVar.REPLICATED); + + /// + /// When true, you have to press the change speed button to sprint. + /// + public static readonly CVarDef GamePressToSprint = + CVarDef.Create("game.press_to_sprint", true, CVar.REPLICATED); + #if EXCEPTION_TOLERANCE /// /// Amount of times round start must fail before the server is shut down. diff --git a/Content.Shared/Movement/Components/CanWalkComponent.cs b/Content.Shared/Movement/Components/CanWalkComponent.cs deleted file mode 100644 index fab851595c7..00000000000 --- a/Content.Shared/Movement/Components/CanWalkComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Robust.Shared.GameStates; - -namespace Content.Shared.Movement.Components; - -/// -/// Indicates if the entity can toggle walking or not. -/// -[NetworkedComponent, RegisterComponent] -public sealed partial class CanWalkComponent : Component -{ -} diff --git a/Content.Shared/Movement/Components/InputMoverComponent.cs b/Content.Shared/Movement/Components/InputMoverComponent.cs index 263190d46fd..916ecc90af1 100644 --- a/Content.Shared/Movement/Components/InputMoverComponent.cs +++ b/Content.Shared/Movement/Components/InputMoverComponent.cs @@ -1,6 +1,8 @@ using System.Numerics; using Content.Shared.Alert; +using Content.Shared.CCVar; using Content.Shared.Movement.Systems; +using Robust.Shared.Configuration; using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; @@ -72,7 +74,10 @@ public sealed partial class InputMoverComponent : Component public const float LerpTime = 1.0f; - public bool Sprinting => (HeldMoveButtons & MoveButtons.Walk) == 0x0; + //NOTE I don't think I'm supposed to do this + public bool Sprinting => IoCManager.Resolve().GetCVar(CCVars.GamePressToSprint) + ? (HeldMoveButtons & MoveButtons.Walk) != 0x0 + : (HeldMoveButtons & MoveButtons.Walk) == 0x0; [ViewVariables(VVAccess.ReadWrite)] public bool CanMove = true; diff --git a/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs b/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs index 813a18f974c..0f404f45b97 100644 --- a/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs +++ b/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs @@ -22,8 +22,8 @@ public sealed partial class MovementSpeedModifierComponent : Component public const float DefaultFriction = 20f; public const float DefaultFrictionNoInput = 20f; - public const float DefaultBaseWalkSpeed = 2.5f; - public const float DefaultBaseSprintSpeed = 4.5f; + public const float DefaultBaseWalkSpeed = 3f; + public const float DefaultBaseSprintSpeed = 5f; [AutoNetworkedField, ViewVariables] public float WalkSpeedModifier = 1.0f; diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs index 891bd518b1c..50cffa6ffea 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs @@ -620,7 +620,7 @@ public enum MoveButtons : byte Down = 2, Left = 4, Right = 8, - Walk = 16, + Walk = 16, // This may be either a sprint button or a walk button, depending on server config AnyDirection = Up | Down | Left | Right, } diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 4c2c91db6a1..0944634db35 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -289,12 +289,10 @@ protected void HandleMobMovement( PhysicsSystem.SetAngularVelocity(physicsUid, 0, body: physicsComponent); } - public void WalkingAlert(EntityUid player, bool walking) + private void WalkingAlert(EntityUid player, bool walking) { - if (HasComp(player)) - { - _alerts.ShowAlert(player, AlertType.Walking, walking ? (short) 0 : (short) 1); - } + walking = _configManager.GetCVar(CCVars.GamePressToSprint) ? !walking : walking; + _alerts.ShowAlert(player, AlertType.Walking, walking ? (short) 0 : (short) 1); } public void LerpRotation(EntityUid uid, InputMoverComponent mover, float frameTime) diff --git a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl index 8c6cf575d54..7b25b616b24 100644 --- a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl +++ b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl @@ -112,13 +112,13 @@ ui-options-header-dev = Development ui-options-header-general = General ui-options-hotkey-keymap = Use US QWERTY Keys -ui-options-hotkey-toggle-walk = Toggle Walk +ui-options-hotkey-toggle-walk = Toggle Speed ui-options-function-move-up = Move Up ui-options-function-move-left = Move Left ui-options-function-move-down = Move Down ui-options-function-move-right = Move Right -ui-options-function-walk = Walk +ui-options-function-walk = Change Speed ui-options-function-camera-rotate-left = Rotate left ui-options-function-camera-rotate-right = Rotate right diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index eba1253dde4..9ff9837a3b9 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -223,7 +223,6 @@ understands: - GalacticCommon - RobotTalk - - type: CanWalk - type: entity id: BaseBorgChassisNT diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 92ede14d3ec..29234ea34cf 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1313,7 +1313,6 @@ tags: - VimPilot - DoorBumpOpener - - type: CanWalk - type: entity name: monkey diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml b/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml index 2515c7880ac..c2380c40278 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml @@ -293,7 +293,6 @@ solution: bloodstream - type: DrainableSolution solution: bloodstream - - type: CanWalk - type: entity name: Reagent Slime Spawner diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml b/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml index e10bdbcf0ec..d1b3bd6a6a9 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml @@ -126,7 +126,6 @@ understands: - GalacticCommon - Mouse - - type: CanWalk - type: entity id: MobRatKingBuff diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml index 3735bcc4eca..fbf133a0f1e 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml @@ -128,7 +128,6 @@ speechSounds: Slime - type: TypingIndicator proto: slime - - type: CanWalk - type: entity name: blue slime diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 1b9e9674f44..c4906f6f975 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -229,7 +229,6 @@ - CanPilot - FootstepSound - DoorBumpOpener - - type: CanWalk - type: entity save: false diff --git a/Resources/Prototypes/Entities/Mobs/Species/harpy.yml b/Resources/Prototypes/Entities/Mobs/Species/harpy.yml index b265d9343a3..05d70e8adc5 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/harpy.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/harpy.yml @@ -119,8 +119,8 @@ False: {visible: false} True: {visible: true} - type: MovementSpeedModifier - baseWalkSpeed: 2.5 - baseSprintSpeed: 5.0 + baseWalkSpeed: 3 + baseSprintSpeed: 5.5 weightlessAcceleration: 2.5 - type: Inventory speciesId: harpy @@ -140,7 +140,6 @@ understands: - GalacticCommon - SolCommon - - type: entity save: false name: Urist McHands diff --git a/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml b/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml index 471801f3a1f..6e5362d9bbb 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml @@ -92,7 +92,6 @@ - type: GuideHelp guides: - Robotics - - type: CanWalk - type: entity id: MechRipley