Hook up ternary snake prototype#4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func _ensure_default_actions() -> void: | ||
| var defaults := { | ||
| "ui_left": Key.KEY_Q, | ||
| "ui_right": Key.KEY_E, | ||
| "ui_accept": Key.KEY_SPACE, | ||
| } | ||
| for action in defaults.keys(): | ||
| if not InputMap.has_action(action): | ||
| InputMap.add_action(action) | ||
| if InputMap.action_get_events(action).is_empty(): | ||
| var evt := InputEventKey.new() | ||
| evt.physical_keycode = defaults[action] | ||
| InputMap.action_add_event(action, evt) |
There was a problem hiding this comment.
Fails to bind Q/E keys when default actions already exist
_ensure_default_actions only appends a key binding when action_get_events returns empty. Godot projects ship with ui_left/ui_right actions pre-populated with arrow and WASD keys, so this check skips adding the new Q/E bindings advertised in the README. As a result, players who follow the instructions will find Q and E unresponsive unless they manually edit the Input Map. Consider checking whether the desired key is already registered for each action and adding it when missing rather than skipping whenever any binding exists.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task