From 8b3383c968b45020f654dedc2b0fcfa3df01b69d Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 13 Oct 2025 11:06:37 +0100 Subject: [PATCH] Set last_known_joypad_device to "" when no joypad initially connected The docstring for last_known_joypad_device claims that its value is "" if no joypad is detected, but previously its value in this case was "generic", because it is defined to be the result of get_simplified_device_name() on the 0th joypad's name. If there is no joypad connected, Input.get_joy_name(0) returns "", but get_simplified_device_name() returns "generic" in the case where it can't figure out what a joypad is (such as when it is passed ""). When initialising the variable, check whether any joypads are connected, and special-case the default as "" if not. This matches how the default value of last_known_joypad_index below it is set. --- addons/input_helper/input_helper.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/input_helper/input_helper.gd b/addons/input_helper/input_helper.gd index 06d70d3..4842fa9 100644 --- a/addons/input_helper/input_helper.gd +++ b/addons/input_helper/input_helper.gd @@ -46,7 +46,7 @@ var deadzone: float = 0.5 ## The mouse distance to ignore before movement is assumed var mouse_motion_threshold: int = 100 ## The last known joypad device name (or "" if no joypad detected) -var last_known_joypad_device: String = get_simplified_device_name(Input.get_joy_name(0)) +var last_known_joypad_device: String = get_simplified_device_name(Input.get_joy_name(0)) if Input.get_connected_joypads().size() > 0 else "" ## The last known joypad index var last_known_joypad_index: int = 0 if Input.get_connected_joypads().size() > 0 else -1