From 47ddb86bbbb2c808680150f2d4cf00c8e9f0a808 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Tue, 11 Apr 2023 22:39:39 +0200 Subject: [PATCH] Improve Remap Controller Axis Detection --- Scripts/UI/Remaping/RemapController.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/UI/Remaping/RemapController.gd b/Scripts/UI/Remaping/RemapController.gd index 0c38369..a5e6fa5 100644 --- a/Scripts/UI/Remaping/RemapController.gd +++ b/Scripts/UI/Remaping/RemapController.gd @@ -50,20 +50,20 @@ func start_remap(button : Button, action : String): pass func remap_key(event): - set_process_unhandled_key_input(false) - for key in InputMap.action_get_events(remap_action): - InputMap.action_erase_event(remap_action, key) - InputMap.action_add_event(remap_action, event) - match str(event.get_class()): "InputEventJoypadButton": Save.game_data["%s" % [remap_action]] = "b" + str(event.button_index) "InputEventJoypadMotion": + if abs(event.axis_value) < 0.5: return Save.game_data["%s" % [remap_action]] = "j" + str(event.axis) + str("/1.00" if event.axis_value > 0 else "/-1.00") "InputEventMouseButton": Save.game_data["%s" % [remap_action]] = "m" + str(event.button_index) "InputEventKey": Save.game_data["%s" % [remap_action]] = event.keycode + set_process_unhandled_key_input(false) + for key in InputMap.action_get_events(remap_action): + InputMap.action_erase_event(remap_action, key) + InputMap.action_add_event(remap_action, event) remap_button.display_key() remap_button.grab_focus() remap_button.disabled = false