This commit is contained in:
Forrest 2026-10-04 17:30:48 -04:00
parent 4298caf5cb
commit 2e6638b744
19 changed files with 484 additions and 185 deletions

View file

@ -20,8 +20,13 @@ extends SceneTree
## | toggle_mic | M | - | Co-op |
## | sprint (hold)| Shift | L3 (stick) | Sprint |
## | weapon_next | Tab | D-pad down | Weapons |
## | weapon_1..3 | 1, 2, 3 | - | Weapons |
## The weapon keys are build mode's (build_next, build_1..3): outside build mode they pick weapons.
## | weapon_1..2 | 1, 2 | - | Weapons |
## | offhand | Right mouse | LT | Off-hand |
## The weapon keys are build mode's (build_next, build_1..2): outside build mode they pick the
## main weapon. offhand shares the right mouse button with cancel: in build mode it dismantles.
## STALE actions, from earlier versions of this table, are removed.
const STALE: Array[String] = ["weapon_3"]
func _initialize() -> void:
@ -41,8 +46,11 @@ func _initialize() -> void:
_action("toggle_mic", [_key(KEY_M)])
_action("sprint", [_key(KEY_SHIFT), _joy(JOY_BUTTON_LEFT_STICK)])
_action("weapon_next", [_key(KEY_TAB), _joy(JOY_BUTTON_DPAD_DOWN)])
for i in 3:
for i in 2:
_action("weapon_%d" % (i + 1), [_key(number_keys[i])])
_action("offhand", [_mouse(MOUSE_BUTTON_RIGHT), _axis(JOY_AXIS_TRIGGER_LEFT)])
for a in STALE:
ProjectSettings.clear("input/" + a)
var err := ProjectSettings.save()
print("configure_input: save -> %s" % error_string(err))
quit(0 if err == OK else 1)
@ -70,3 +78,10 @@ func _joy(button: JoyButton) -> InputEventJoypadButton:
var e := InputEventJoypadButton.new()
e.button_index = button
return e
func _axis(axis: JoyAxis) -> InputEventJoypadMotion:
var e := InputEventJoypadMotion.new()
e.axis = axis
e.axis_value = 1.0
return e