Skip to content

Commit

Permalink
Merge pull request #87324 from jsjtxietian/action-exist
Browse files Browse the repository at this point in the history
Check action exists in `Input.action_press` and `action_release`
  • Loading branch information
YuriSizov committed Jan 18, 2024
2 parents 6fa577c + 4b3a12f commit 2ababdc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
}

void Input::action_press(const StringName &p_action, float p_strength) {
ERR_FAIL_COND_MSG(!InputMap::get_singleton()->has_action(p_action), InputMap::get_singleton()->suggest_actions(p_action));

// Create or retrieve existing action.
ActionState &action_state = action_states[p_action];

Expand All @@ -879,6 +881,8 @@ void Input::action_press(const StringName &p_action, float p_strength) {
}

void Input::action_release(const StringName &p_action) {
ERR_FAIL_COND_MSG(!InputMap::get_singleton()->has_action(p_action), InputMap::get_singleton()->suggest_actions(p_action));

// Create or retrieve existing action.
ActionState &action_state = action_states[p_action];
action_state.cache.pressed = 0;
Expand Down

0 comments on commit 2ababdc

Please sign in to comment.