Skip to content

Hold mouse buttons with drive --key mouse0:<ms> - #2003

Merged
Noisemaker111 merged 2 commits into
betafrom
drive-mouse-hold
Oct 20, 2026
Merged

Noisemaker111 merged 2 commits into
betafrom
drive-mouse-hold

Conversation

@Noisemaker111

Copy link
Copy Markdown
Owner

A Scrap Signal playtest couldn't fire its hold-to-fire guns: drive --key mouse0:1200 sent mouse0 as a keyboard code, which nothing reads. Only --click-at fired, one round per click.

  • templates/gameSurfaceFocus.ts: mouseButtonForCode maps the shell's pointer binding codes (mouse0/mouse1/mouse2) to the CDP button and buttons mask; gameSurfaceCenter returns the play canvas centre. Both are self-contained, so they embed into drive.mjs like the existing helpers.
  • holdKey in the drive template: a mouse code moves to the canvas centre, presses, waits with the same duration-plus-one-frame rule as key holds, then releases. Keyboard codes are unchanged. Usage text and the scaffold's agent notes mention it; changes/drive-mouse-hold.md.

Verification

  • bun test packages/jgengine/src/templates packages/jgengine/src/driveNative.test.ts — 61 pass, 0 fail (5 new, including a serialization round-trip); check-types — pass; bun run gen — ok; ship:preflight — ok
  • Live, Scrap Signal on this branch's CLI build: --click "GUNK" --wait 30000 --key mouse0:8000 took the pistol from 12 to 11 rounds. Headless runs at about 0.2 fps, so one shot fits in the hold.

drive-mouse0-ammo


Generated by Claude Code

--key sent mouse0 as a keyboard code, which nothing reads, so a playtest
could not fire Scrap Signal's hold-to-fire guns; only --click-at fired,
one round per click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwsemkhoUGyeQkdkKFmUmw

Copy link
Copy Markdown
Owner Author

test failed on CreatorApp.test.ts › "unsaved and pending failed saves survive native play, pause, resume and return". That editor browser test also flaked on #1990, before any of today's changes, and this PR only changes the drive template's mouse holds. I merged the latest beta and pushed, which re-runs CI. I can't re-run the jobs directly (403).


Generated by Claude Code

@Noisemaker111
Noisemaker111 merged commit 3b21f8b into beta Oct 20, 2026
6 checks passed
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.

2 participants