Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invert the Running/Walking States #485

Merged
merged 8 commits into from
Aug 1, 2024
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/Slipping/SlippingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +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.GameSprintWalks);
var sprintWalks = sys.Config.GetCVar(CCVars.GamePressToSprint);
await SpawnTarget("TrashBananaPeel");

var modifier = Comp<MovementSpeedModifierComponent>(Player).SprintSpeedModifier;
Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ public static readonly CVarDef<bool>


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

#if EXCEPTION_TOLERANCE
/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Movement/Components/InputMoverComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public sealed partial class InputMoverComponent : Component
public const float LerpTime = 1.0f;

//NOTE I don't think I'm supposed to do this
public bool Sprinting => IoCManager.Resolve<IConfigurationManager>().GetCVar(CCVars.GameSprintWalks)
? (HeldMoveButtons & MoveButtons.Sprint) != 0x0
: (HeldMoveButtons & MoveButtons.Sprint) == 0x0;
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 @@ -468,7 +468,7 @@ public void SetSprinting(EntityUid entity, InputMoverComponent component, ushort
{
// Logger.Info($"[{_gameTiming.CurTick}/{subTick}] Sprint: {enabled}");
WalkingAlert(entity, walking);
SetMoveInput(entity, component, subTick, walking, MoveButtons.Sprint);
SetMoveInput(entity, component, subTick, walking, MoveButtons.Walk);
}

/// <summary>
Expand Down Expand Up @@ -620,7 +620,7 @@ public enum MoveButtons : byte
Down = 2,
Left = 4,
Right = 8,
Sprint = 16,
Walk = 16,
DEATHB4DEFEAT marked this conversation as resolved.
Show resolved Hide resolved
AnyDirection = Up | Down | Left | Right,
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ protected void HandleMobMovement(

private void WalkingAlert(EntityUid player, bool walking)
{
walking = _configManager.GetCVar(CCVars.GameSprintWalks) ? !walking : walking;
walking = _configManager.GetCVar(CCVars.GamePressToSprint) ? !walking : walking;
_alerts.ShowAlert(player, AlertType.Walking, walking ? (short) 0 : (short) 1);
}

Expand Down
Loading