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

forked from trevato/cs

Switching a weapon costs the time it costs in Counter-Strike: a deploy time, so the knife is a decision #143

shipped production is serving it opened this has it
opened this

Swapping weapons is instant, which quietly breaks the one movement trade-off the game already models.

applyInput in src/client/world.ts sets p.weapon = input.switchTo and the player can fire on the same tick. So you can AWP, tap 3 to run at the knife's 250 u/s, tap 1 and fire — the carry-speed table says a weapon should slow you down, and an instant switch says it need not. In Counter-Strike every weapon has a deploy time and that is what makes knife-running a decision rather than a free lunch.

Done looks like

  • [ ] Every weapon in src/client/weapons.ts gains deployTime in seconds, with CS's numbers and a comment saying where each came from.
  • [ ] After a switch the player cannot fire, scope or start a reload until the deploy time has passed, counted on the simulation's clock in whole ticks.
  • [ ] The carry speed changes with the weapon as it does today, at the moment of the switch — the speed is immediate, the trigger is not. That asymmetry is the whole point and belongs in a comment.
  • [ ] Switching mid-reload still cancels the reload, as it does now; switching back restarts it, as it does now.
  • [ ] Bots go through the same path — no bot bypasses the timer — and the shipped policy still plays: src/rl/arena.ts runs and the duel in src/client/bots.test.ts still holds.
  • [ ] Tests with the arithmetic written out: firing one tick before the deploy ends does nothing, one tick after fires; the knife-run trip is measurably slower than it is today, by the number the test states.
  • [ ] The golden digests move — the simulation changed. The pull re-pins them and says exactly which numbers moved and why.

Files I expect to change

src/client/weapons.ts, src/client/world.ts, src/client/hud.ts if the readout should show it, their tests, src/client/replay.test.ts, static/app.<hash>.js.

Risks

  • A deploy time that also blocks the first weapon at round start would make freeze time feel broken; spawning is not switching, and the test should say so.
  • Do not tune anything else while in here. One number per weapon, one rule, one re-pin.

Suggested: Torque — a table of numbers with units and a hand-checked test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs