Skip to content

Commit

Permalink
only change actions on TransformedInput if the new one exists on the …
Browse files Browse the repository at this point in the history
…project InputMap
  • Loading branch information
ninetailsrabbit committed Dec 20, 2024
1 parent 28af922 commit 328d300
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions utilities/input/transformed_input.gd
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,37 @@ func _update_previous_directions():

#region Action setters
func change_move_right_action(new_action: StringName) -> TransformedInput:
move_right_action = new_action
if InputMap.has_action(new_action):
move_right_action = new_action
else:
push_error("TransformedInput: The new move right action %s does not exist in the InputMap, create the action and then reassign it again" % new_action)

return self


func change_move_left_action(new_action: StringName) -> TransformedInput:
move_left_action = new_action
if InputMap.has_action(new_action):
move_left_action = new_action
else:
push_error("TransformedInput: The new move left action %s does not exist in the InputMap, create the action and then reassign it again" % new_action)

return self


func change_move_forward_action(new_action: StringName) -> TransformedInput:
move_forward_action = new_action
if InputMap.has_action(new_action):
move_forward_action = new_action
else:
push_error("TransformedInput: The new move forward action %s does not exist in the InputMap, create the action and then reassign it again" % new_action)

return self


func change_move_back_action(new_action: StringName) -> TransformedInput:
move_back_action = new_action
if InputMap.has_action(new_action):
move_back_action = new_action
else:
push_error("TransformedInput: The new move back action %s does not exist in the InputMap, create the action and then reassign it again" % new_action)

return self
#endregion
Expand Down

0 comments on commit 328d300

Please sign in to comment.