feat: port item instances and inventory

This commit is contained in:
goose
2026-10-03 13:16:00 -04:00
parent 391e95f6f4
commit f9e68e6110
16 changed files with 417 additions and 7 deletions
+4 -3
View File
@@ -57,7 +57,7 @@ func test_unmapped_input_returns_no_player_action() -> void:
var router := ActionRouter.new(null)
assert_null(router.action_from_input(_action_event(&"not_a_game_action")))
func test_submit_unimplemented_action_records_action_unavailable_event() -> void:
func test_submit_inventory_action_opens_the_inventory_panel() -> void:
var game := GameScene.instantiate() as Game
add_child_autofree(game)
await get_tree().process_frame
@@ -66,10 +66,11 @@ func test_submit_unimplemented_action_records_action_unavailable_event() -> void
var events: Array[GameEvent] = router.submit(PlayerAction.new(&"inventory"))
assert_eq(events.size(), 1)
assert_eq(events[0].kind, &"action_unavailable")
assert_eq(events[0].payload, {"action": &"inventory"})
assert_eq(events[0].kind, &"inventory_opened")
assert_eq(events[0].payload, {"item_count": 0})
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))
func _action_event(input_action: StringName) -> InputEventAction: