feat: complete playtest parity improvements
This commit is contained in:
@@ -20,6 +20,16 @@ func test_interact_and_move_northeast_have_distinct_physical_bindings() -> void:
|
||||
assert_false(InputMap.action_has_event(&"move_northeast", interact_e))
|
||||
assert_false(InputMap.action_has_event(&"interact", northeast_keypad_9))
|
||||
|
||||
func test_f_starts_ranged_targeting_and_ctrl_s_or_v_requests_a_manual_save() -> void:
|
||||
assert_true(InputMap.action_has_event(&"ranged", _key_event(KEY_F)))
|
||||
assert_true(InputMap.action_has_event(&"save", _key_event(KEY_S, true)))
|
||||
assert_true(InputMap.action_has_event(&"save", _key_event(KEY_V)))
|
||||
assert_false(InputMap.has_action(&"attack"), "Melee is resolved by moving into an adjacent enemy, not by a conflicting F action.")
|
||||
|
||||
var router := ActionRouter.new(null)
|
||||
assert_eq(router.action_from_input(_action_event(&"ranged")).kind, &"ranged")
|
||||
assert_eq(router.action_from_input(_action_event(&"save")).kind, &"save")
|
||||
|
||||
func test_action_from_input_maps_the_complete_command_vocabulary() -> void:
|
||||
var router := ActionRouter.new(null)
|
||||
var expected := {
|
||||
@@ -33,8 +43,8 @@ func test_action_from_input_maps_the_complete_command_vocabulary() -> void:
|
||||
&"move_southeast": [&"move", Vector2i(1, 1)],
|
||||
&"wait": [&"wait", Vector2i.ZERO],
|
||||
&"interact": [&"interact", Vector2i.ZERO],
|
||||
&"attack": [&"attack", Vector2i.ZERO],
|
||||
&"ranged": [&"ranged", Vector2i.ZERO],
|
||||
&"save": [&"save", Vector2i.ZERO],
|
||||
&"cast": [&"cast", Vector2i.ZERO],
|
||||
&"talk": [&"talk", Vector2i.ZERO],
|
||||
&"rest": [&"rest", Vector2i.ZERO],
|
||||
@@ -71,7 +81,7 @@ func test_submit_inventory_action_opens_the_inventory_panel() -> void:
|
||||
assert_eq(events[0].turn, 1)
|
||||
assert_eq(game.get_run_state().recent_events(1)[0], events[0])
|
||||
assert_true((game.get_node("HUD/InventoryPanel") as PanelContainer).visible)
|
||||
assert_eq(game.get_game_state().player.cell, Vector2i(4, 12))
|
||||
assert_eq(game.get_game_state().player.cell, Vector2i(4, 7))
|
||||
|
||||
func _action_event(input_action: StringName) -> InputEventAction:
|
||||
var event := InputEventAction.new()
|
||||
@@ -79,9 +89,11 @@ func _action_event(input_action: StringName) -> InputEventAction:
|
||||
event.pressed = true
|
||||
return event
|
||||
|
||||
func _key_event(keycode: Key) -> InputEventKey:
|
||||
func _key_event(keycode: Key, ctrl_pressed: bool = false) -> InputEventKey:
|
||||
var event := InputEventKey.new()
|
||||
event.device = 16
|
||||
event.keycode = keycode
|
||||
event.physical_keycode = keycode
|
||||
event.ctrl_pressed = ctrl_pressed
|
||||
event.pressed = true
|
||||
return event
|
||||
|
||||
Reference in New Issue
Block a user