Add joy axis input map binding#479
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR addresses #465 by extending the InputMap MCP “bind_event” pathway to support joystick axis bindings (event_type="joy_axis") in the Godot-side input handler, along with docs and tests. From code inspection, input_map_manage(op=list) already serializes both joy button and joy axis events (and user-authored/custom actions persisted in project.godot), so the prior “read dropped joy events / custom actions” report is likely due to filtering (include_builtin=false) or the project lacking persisted [input] entries rather than missing serialization.
Changes:
- Add
joy_axishandling toInputHandler._create_event()by creatingInputEventJoypadMotionand requiringaxis(with optionalaxis_valuedefaulting to1.0). - Update the MCP tool description to document
joy_axisbindings and parameters. - Add GDScript tests covering missing
axisvalidation and successfuljoy_axisbinding/serialization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
plugin/addons/godot_ai/handlers/input_handler.gd |
Adds joy_axis event creation and updates unsupported-type messaging. |
src/godot_ai/tools/input_map.py |
Documents joy_axis support and new parameters for bind_event. |
test_project/tests/test_input.gd |
Adds tests for missing axis and successful joy-axis binding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fixes #465 by adding support for binding joystick axis events through
input_map_manage(op=bind_event).event_type=joy_axissupport in the GDScript input handler by creatingInputEventJoypadMotion.axisand accept optionalaxis_value(default1.0).joy_axisalongside key, mouse button, and joy button bindings.axisand successful axis binding.Verification
inputsuite failed ontest_bind_joy_axis_eventbecausejoy_axisreturned an error instead of data.test_run suite=input: 22/22 passed, 0 failed.python -m ruff check src/godot_ai/tools/input_map.py: passed.git diff --check: passed.