-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Allow checking for exact matches with Action events. #50874
Conversation
May close godotengine/godot-proposals#2464 |
28e496e
to
fcde297
Compare
Rebased on top of #50788 |
fcde297
to
64cb437
Compare
Rebased on top of #50985 |
The class reference needs to be updated (make sure to keep the descriptions): https://github.com/godotengine/godot/pull/50874/checks?check_run_id=3200490164 The |
08c5e54
to
6b38857
Compare
Could you squash the commits? Otherwise we'd been merging an intermediate commit that actually fails CI. |
Added additional param to action related methods to test for exactness. If "p_exact_match" is true, then the action will only be "matched" if the provided input event *exactly* matches with the action event. Before: * Action Event = KEY_S * Input Event = KEY_CONTROL + KEY_S * Is Action Pressed = True Now: You can still do the above, however you can optionally check that the input is exactly what the action event is: * Action Event = KEY_S * Input Event = KEY_CONTROL + KEY_S * p_exact_match = True * Is Action Pressed = False * If the Input Event was only KEY_S, then the result would be true. Usage: ```gdscript Input.is_action_pressed(action_name: String, exact_match: bool) Input.is_action_pressed("my_action", true) InputMap.event_is_action(p_event, "my_action", true) func _input(event: InputEvent): event.is_action_pressed("my_action", false, true) # false = "allow_echo", true = "exact_match" event.is_action("my_action", true) ``` Co-authored-by: Eric M <[email protected]>
6b38857
to
0e5c6e0
Compare
Thanks! |
Backport of #44355
Backport of #51064