Skip to content

fix: SH-048 crouch — the input + controller half (repairs main) - #20

Merged
proggeramlug merged 1 commit into
mainfrom
fix/sh-048-crouch-input-controller
Jul 15, 2026
Merged

proggeramlug merged 1 commit into
mainfrom
fix/sh-048-crouch-input-controller

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

main currently does not compile: main.ts already calls
updatePlayerController(..., wantSprint, input.crouchDown) and reads
isCrouching() for the animation tier, but the two files that define those
landed separately. This is the missing half.

  • input.ts — crouchDown on InputState, held on C (Ctrl is already
    dodge). Touch returns false; there is no crouch control on the phone yet.
  • player.ts — CROUCH_MUL 0.45 (4.5 → ~2.0 m/s), crouch state in P[7],
    and the crouch param. Crouch wins over sprint — you cannot do both, and
    holding crouch is the more deliberate intent. Cleared on dodge and on
    resetPlayerMotion.

Scope, stated honestly

Crouch is speed + pose only. The capsule is not resized, so it does not
shrink the hitbox or fit under low geometry (the arena has none). That would be
setCharacterShape — a follow-up.

Verification

Driven through the real keys (LOCOPROBE + SendInput scancode — not a forced
flag, which is what hid the sprint bug for so long):

phase key speed state
baseline — 4.50 walk
Shift held shiftKey=1 9.00 sprint=1
C held cKey=1 2.03 crouch=1

Game boots and runs past the load with isCrouching() resolving at runtime (the
real risk here — Perry resolves cross-module refs at runtime, so a green compile
proves nothing).

Needs engine PR Bloom-Engine/engine#99 for Shift to reach the game at all.

https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp

Summary by CodeRabbit

  • New Features
    • Added crouch controls for keyboard players using the C key.
    • Player movement now supports crouching at reduced speed.
    • Crouching and sprinting are mutually exclusive, with crouching taking priority.
    • Crouch state is cleared during dodge actions and motion resets.
    • Touch controls do not currently include a crouch action.

main.ts already calls updatePlayerController(..., wantSprint, input.crouchDown)
and reads isCrouching() for the animation tier, but the two files that DEFINE
those landed separately — so main did not compile at all. This is the other half.

- input.ts: crouchDown on InputState, held on C (Ctrl is already dodge). Touch
  returns false; there is no crouch control on the phone yet.
- player.ts: CROUCH_MUL 0.45 (4.5 -> ~2.0 m/s), crouch state in P[7], and the
  crouch param. Crouch WINS over sprint — you cannot do both, and holding crouch
  is the more deliberate intent. Cleared on dodge and on resetPlayerMotion.

Crouch is speed + pose only for now: the capsule is NOT resized, so it does not
shrink the hitbox or fit under low geometry (the arena has none). That would be
setCharacterShape — a follow-up.

Verified through the REAL keys (LOCOPROBE + SendInput scancode, not a forced
flag): walk 4.50 -> Shift 9.00 (sprint=1) -> C 2.03 (crouch=1), and the game
boots and runs past the load with isCrouching() resolving at runtime.

Claude-Session: https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c64a84f-123a-4046-9648-c9cf0c4f2305

📥 Commits

Reviewing files that changed from the base of the PR and between 344132d and b6a8e23.

📒 Files selected for processing (2)
  • src/input.ts
  • src/player.ts

📝 Walkthrough

Walkthrough

Keyboard input now exposes a crouch control through Key.C. The player controller tracks crouching, applies reduced grounded movement speed, disables sprinting while crouched, and clears crouch state during dodges and motion resets.

Changes

Crouch control

Layer / File(s) Summary
Crouch input contract and readings
src/input.ts
InputState adds crouchDown; touch input reports false, while keyboard input maps crouching to Key.C.
Player crouch movement and state
src/player.ts
Player state and controller inputs now track crouching, apply CROUCH_MUL, prioritize crouching over sprinting, expose isCrouching(), and clear crouch state during dodges and resets.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sh-048-crouch-input-controller

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit b1c8baf into main Jul 15, 2026
1 check was pending
@proggeramlug
proggeramlug deleted the fix/sh-048-crouch-input-controller branch July 15, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant