Skip to content

Commit

Permalink
Invert the Running/Walking States (Simple-Station#485)
Browse files Browse the repository at this point in the history
# Description

Ports
Simple-Station/Parkstation-Friendly-Chainsaw#39

A change made to encourage people to [stop and smell the
roses](https://www.urbandictionary.com/define.php?term=slow+down+and+smell+the+roses),
instead of sprinting everywhere trying to get shit done.
This goes well with Simple-Station#486, so people don't actually *have* to rush places
to try to get things done before the shift ends fatally.
It's weird anyway how we're all constantly sprinting everywhere and have
to *very actively* choose not to (and why would you?).
Increases the default speeds so that walking isn't painfully slow and
sprinting feels more like sprinting in combination with the active
choice to sprint.

Someone needs to PR changing the default sprint or examine buttons, so
people can fight and sprint with this change.
(A lot of other default keybinds suck or conflict too and need to
change)

# Media

Terrible video but whatever


https://github.com/user-attachments/assets/5ff3863d-92c8-4df3-b76b-82874b5e1ae3

# Changelog

:cl:
- tweak: The station's crew hivemind has decided to slow down their
movement and enjoy The Park instead of sprinting everywhere

---------

Signed-off-by: DEATHB4DEFEAT <[email protected]>
Co-authored-by: Pspritechologist <[email protected]>
  • Loading branch information
DEATHB4DEFEAT and Pspritechologist committed Aug 1, 2024
1 parent 00a74a2 commit ac2fc06
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 35 deletions.
10 changes: 7 additions & 3 deletions Content.IntegrationTests/Tests/Slipping/SlippingTest.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +17,7 @@ public sealed class SlippingTest : MovementTest
{
public sealed class SlipTestSystem : EntitySystem
{
[Dependency] public readonly IConfigurationManager Config = default!;
public HashSet<EntityUid> Slipped = new();
public override void Initialize()
{
Expand All @@ -30,6 +34,7 @@ private void OnSlip(EntityUid uid, SlipperyComponent component, ref SlipEvent ar
public async Task BananaSlipTest()
{
var sys = SEntMan.System<SlipTestSystem>();
var sprintWalks = sys.Config.GetCVar(CCVars.GamePressToSprint);
await SpawnTarget("TrashBananaPeel");

var modifier = Comp<MovementSpeedModifierComponent>(Player).SprintSpeedModifier;
Expand All @@ -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));
Expand All @@ -51,10 +56,9 @@ public async Task BananaSlipTest()
AssertComp<KnockedDownComponent>(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<KnockedDownComponent>(true, Player);
}
}

7 changes: 7 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,13 @@ public static readonly CVarDef<bool>
public static readonly CVarDef<bool> GameAutoEatDrinks =
CVarDef.Create("game.auto_eat_drinks", false, CVar.REPLICATED);


/// <summary>
/// When true, you have to press the change speed button to sprint.
/// </summary>
public static readonly CVarDef<bool> GamePressToSprint =
CVarDef.Create("game.press_to_sprint", true, CVar.REPLICATED);

#if EXCEPTION_TOLERANCE
/// <summary>
/// Amount of times round start must fail before the server is shut down.
Expand Down
11 changes: 0 additions & 11 deletions Content.Shared/Movement/Components/CanWalkComponent.cs

This file was deleted.

7 changes: 6 additions & 1 deletion Content.Shared/Movement/Components/InputMoverComponent.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<IConfigurationManager>().GetCVar(CCVars.GamePressToSprint)
? (HeldMoveButtons & MoveButtons.Walk) != 0x0
: (HeldMoveButtons & MoveButtons.Walk) == 0x0;

[ViewVariables(VVAccess.ReadWrite)]
public bool CanMove = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
8 changes: 3 additions & 5 deletions Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CanWalkComponent>(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)
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@
understands:
- GalacticCommon
- RobotTalk
- type: CanWalk

- type: entity
id: BaseBorgChassisNT
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,6 @@
tags:
- VimPilot
- DoorBumpOpener
- type: CanWalk

- type: entity
name: monkey
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@
solution: bloodstream
- type: DrainableSolution
solution: bloodstream
- type: CanWalk

- type: entity
name: Reagent Slime Spawner
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
understands:
- GalacticCommon
- Mouse
- type: CanWalk

- type: entity
id: MobRatKingBuff
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
speechSounds: Slime
- type: TypingIndicator
proto: slime
- type: CanWalk

- type: entity
name: blue slime
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@
- CanPilot
- FootstepSound
- DoorBumpOpener
- type: CanWalk

- type: entity
save: false
Expand Down
5 changes: 2 additions & 3 deletions Resources/Prototypes/Entities/Mobs/Species/harpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -140,7 +140,6 @@
understands:
- GalacticCommon
- SolCommon

- type: entity
save: false
name: Urist McHands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
- type: GuideHelp
guides:
- Robotics
- type: CanWalk

- type: entity
id: MechRipley
Expand Down

0 comments on commit ac2fc06

Please sign in to comment.