Public: anyone can read this; the crew can change it.

forked from trevato/cs

cant change sens mid game. this is annoying. any other settings we should hav… #405

Closed opened this in answer to
Closed without merging

You can now change sensitivity in the middle of a match: Sensitivity, Touch sens and Motion are in the pause panel as well as the menu. A change takes effect right away, so the next mouse movement turns at the new number and you stay in the round. For "any other settings", I added a **Sound** on/off toggle. There is no volume slider because the sound mix has a single fixed level, so a slider would…

stopped closed without shipping deploy 94d1bd6

opened this

You can now change sensitivity in the middle of a match: Sensitivity, Touch sens and Motion are in the pause panel as well as the menu. A change takes effect right away, so the next mouse movement turns at the new number and you stay in the round. For "any other settings", I added a Sound on/off toggle. There is no volume slider because the sound mix has a single fixed level, so a slider would have nothing real to control.

The pause panel and the menu always show the same values: a change in one is copied into the other. Settings are now saved in the browser's localStorage (cs.sens, cs.touchsens, cs.motion, cs.sound), so they come back on the next visit. Before this, sensitivity went back to 2.2 on every reload. Saved values are checked like any other input: a number outside 0.2–12 becomes the nearest end of the range, and anything that isn't a number falls back to the default. If you never change Motion, it still starts from the system's reduced-motion setting.

What to look at:

  • src/client/settings.ts (new) holds the range, the parsing, the storage keys and the rule for applying one change.
  • src/pages/game.ts draws the settings row with one function and uses it for both the menu (existing ids plus sound) and the pause panel (psens, ptouchsens, pmotion, psound). The min, max and default come from the module instead of being typed into the page.
  • src/client/main.ts connects each menu field to its pause field. The look follows a number as you type it; out-of-range values are corrected only when you leave the field, so the box doesn't change under you mid-typing. Starting a match still reads the menu fields once.

What I chose not to do:

  • Side, length and map stay in the menu only, because changing them means starting a different match.
  • The terminal interface gets no settings, because they belong to one browser and the terminal only shows the leaderboard.
  • I added no dependencies.

Tests: settings.test.ts covers the parsing and saving. New tests in main.test.ts check that a sensitivity change in the pause panel turns the view at the new rate within the same match, that settings come back from storage and junk values are ignored, and that Sound off mutes the audio. game.test.ts checks the pause panel's fields. bun run test passes (1684 tests). On one full run, two timing-limited tests I didn't touch failed (a cookie-bucket test and the 20,000-match standings "under 10 ms" test). Both passed when run alone and in the next full run. No existing test was changed.

To try it in the preview: start a match, press P or Esc, change Sensitivity and click Resume. Aiming uses the new number straight away, and it's still set after you reload the page.

🤖 Generated with Claude Code

Closes #401

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs