Skip to content

Add Sensing action_control block to bind keys for movement/actions#344

Open
tracygardner wants to merge 5 commits intomainfrom
codex/add-key-setting-button-to-forward-block
Open

Add Sensing action_control block to bind keys for movement/actions#344
tracygardner wants to merge 5 commits intomainfrom
codex/add-key-setting-button-to-forward-block

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • Provide a way in the Sensing category to bind keyboard keys to high-level actions (FORWARD/BACK/LEFT/RIGHT/BUTTON1-4) using a camera-style grid key picker, matching the existing Camera key-bind UX.

Description

  • Added a new Blockly block action_control (blocks/sensing.js) that shows an action dropdown plus a grid key picker and appears next to action_pressed in the Sensing toolbox (toolbox.js, locale/en.js).
  • Added generator support so action_control emits setActionKey(action, key) at generation time (generators/generators.js).
  • Implemented runtime APIs in api/sensing.js: setActionKey(action, key) and getActionKeys(action), and updated actionPressed(action) to consult custom keys plus defaults; updated whenActionEvent to use getActionKeys so events and booleans stay in sync.
  • Added persistent runtime state flock.actionKeyMap and initialization/reset hooks in flock.js, and added translation strings and tooltip text for the new block (locale/en.js).

Testing

  • npm run build completed successfully on the branch (bundle built).
  • npm run lint failed due to pre-existing lint issues in flock.js that are unrelated to this change (reported by the linter).
  • npm run test:api failed in this environment because Playwright’s browser binaries are not installed (environment limitation), not because of the change.
  • Ran the dev server and an automated Playwright script to open the page and capture the toolbox UI; a screenshot showing the new action_control block in Sensing was produced at artifacts/action-control-sensing.png.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant