A13: Gamepad and accessibility

Gamepad: PadInput reads pad events in one fixed layout (sticks move and
look, triggers aim and fire, bumpers step slots and build pieces, Start
pauses), fed through ClientInput alongside the keys and mouse. Menus take
South to choose and East or Start to go back. The tutorial names pad
buttons once the pad is used.

Aim assist (option, on by default, pad only): friction across an
opponent in plain sight near the look, and a pull of at most 9 deg/s
while aiming. Client look only; never through cover.

Accessibility (new Access tab): colour-vision sets for the signal colours
(red-green, blue-yellow), checked by simulated colour vision in
test_palette; interface size 90-130%, with the HUD hotbar refitting at the
larger sizes; captions for key sounds with direction; reduce motion
(calmer aim zoom and hurt flash).

Tests for the pad, aim assist, captions, palettes, settings, the menus
driven from a pad, and a pad playing through a real offline session.
make access-captures renders the new screens and options.

Closes #53

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 08:53:30 -05:00
co-authored by Claude Opus 5.5
parent dbe1ef923a
commit 8142e39ab3
48 changed files with 1627 additions and 49 deletions
+47
View File
@@ -269,3 +269,50 @@ func test_browse_options() -> void:
assert_eq(ClientConfig.parse(PackedStringArray(["--browse"])).lan_port, ServerConfig.DEFAULT_PORT)
assert_false(ClientConfig.parse(PackedStringArray(["--browse", "--lan-target=somewhere"])).is_valid())
assert_false(ClientConfig.parse(PackedStringArray(["--browse", "--connect=192.0.2.7"])).is_valid())
static func _pad_button(index: JoyButton, pressed: bool) -> InputEventJoypadButton:
var event: InputEventJoypadButton = InputEventJoypadButton.new()
event.button_index = index
event.pressed = pressed
return event
static func _pad_axis(which: JoyAxis, value: float) -> InputEventJoypadMotion:
var event: InputEventJoypadMotion = InputEventJoypadMotion.new()
event.axis = which
event.axis_value = value
return event
func test_a_gamepad_plays_through_the_session() -> void:
# A13: the script lands the player; then a simulated pad takes over.
session.play_offline(4, 3)
for frame: int in 60 * 150:
session.pump(FRAME)
if session.game.playing() and _own().drop_state == Drop.NONE and _own().on_ground:
break
assert_true(session.game.playing() and _own().drop_state == Drop.NONE, "landed")
session.input.autoplay = false
session.input.yaw = 0.0
var start: Vector3 = _own().position
session.input.handle(_pad_axis(JOY_AXIS_LEFT_Y, -1.0), false)
for frame: int in 60 * 2:
session.pump(FRAME)
var walked: float = Vector2(_own().position.x - start.x, _own().position.z - start.z).length()
assert_true(walked > 3.0, "the left stick walked the player %.1f m" % walked)
assert_false(session.input.targets.is_empty(), "aim assist sees the bots as opponents")
session.input.handle(_pad_axis(JOY_AXIS_LEFT_Y, 0.0), false)
session.input.handle(_pad_button(JOY_BUTTON_RIGHT_SHOULDER, true), false)
session.input.handle(_pad_button(JOY_BUTTON_RIGHT_SHOULDER, false), false)
for frame: int in 10:
session.pump(FRAME)
assert_eq(_own().selected, 1, "the right bumper picked the first slot")
# Start asks for the pause menu, as Escape does.
var asked: Array[bool] = [false]
session.pause_requested.connect(func() -> void: asked[0] = true)
var tree: SceneTree = Engine.get_main_loop() as SceneTree
tree.root.add_child(session)
session._unhandled_input(_pad_button(JOY_BUTTON_START, true))
assert_true(asked[0], "Start asked for the pause menu")
tree.root.remove_child(session)