fix: harden recovery flow and clean diagnostics

This commit is contained in:
Alexander Sellite 2026-09-01 07:44:01 -04:00
parent 0158b0215f
commit ff78710303
64 changed files with 1163 additions and 418 deletions

View file

@ -19,15 +19,15 @@ func _initialize() -> void:
func _run() -> void:
var root := Node.new()
get_root().add_child(root)
var scene_root := Node.new()
get_root().add_child(scene_root)
var bag := PlayerBag.new()
var catches := FishInventory.new()
var capacity := PlayerCoolerCapacity.new()
var layout := PlayerInventoryLayout.new()
var hotbar := PlayerHotbar.new()
for node: Node in [bag, catches, capacity, layout, hotbar]:
root.add_child(node)
scene_root.add_child(node)
bag.setup(ItemCatalogResource)
layout.setup(bag, catches, ItemCatalogResource, capacity)
bag.set_inventory_layout(layout)
@ -109,7 +109,7 @@ func _run() -> void:
assert(layout.get_storage_count() == 1)
assert(layout.get_storage_capacity() == 9)
var inventory_grid := GeneralInventoryGrid.new()
root.add_child(inventory_grid)
scene_root.add_child(inventory_grid)
inventory_grid.set_slot_presentation(Vector2(78.0, 78.0), 10)
inventory_grid.setup(
layout,
@ -143,7 +143,7 @@ func _run() -> void:
)
staged_slot.set_staged(false)
var quality_slot := GeneralInventorySlot.new()
root.add_child(quality_slot)
scene_root.add_child(quality_slot)
quality_slot.set_presentation_size(Vector2(78.0, 78.0))
quality_slot.configure(
0,
@ -181,7 +181,7 @@ func _run() -> void:
distinct_quality_colors[quality_color] = true
assert(distinct_quality_colors.size() == FishQuality.TIER_COUNT)
var sale_tray_slot := ShopSaleTraySlot.new()
root.add_child(sale_tray_slot)
scene_root.add_child(sale_tray_slot)
sale_tray_slot.configure(
"catch:%s" % fish_catch.catch_id,
fish_catch.fish.display_texture,
@ -207,7 +207,7 @@ func _run() -> void:
expected_tray_quality_color.a = 0.96
assert(sale_tray_style.bg_color == expected_tray_quality_color)
var wallet := PlayerWallet.new()
root.add_child(wallet)
scene_root.add_child(wallet)
assert(wallet.restore_balance(15000))
assert(layout.get_next_backpack_cost() == 1500)
assert(layout.purchase_backpack(wallet))
@ -223,7 +223,7 @@ func _run() -> void:
assert(inventory_grid.get_slots().size() == 36)
assert(layout.get_next_backpack_cost() == -1)
var storage_grid := GeneralInventoryGrid.new()
root.add_child(storage_grid)
scene_root.add_child(storage_grid)
storage_grid.setup(
layout,
bag,
@ -240,7 +240,7 @@ func _run() -> void:
== "locked storage slot 10"
)
var storage_wallet := PlayerWallet.new()
root.add_child(storage_wallet)
scene_root.add_child(storage_wallet)
assert(storage_wallet.restore_balance(9500))
for expected_capacity: int in [18, 27, 36, 45, 54, 63, 72]:
assert(capacity.purchase(storage_wallet))
@ -266,8 +266,8 @@ func _run() -> void:
var network_sale := NetworkSaleService.new()
var session := NetworkSession.new()
root.add_child(session)
root.add_child(network_sale)
scene_root.add_child(session)
scene_root.add_child(network_sale)
network_sale.set("_session", session)
network_sale.set("_item_catalog", ItemCatalogResource)
network_sale.set("_fish_catalog", FishCatalogResource)
@ -284,5 +284,5 @@ func _run() -> void:
assert((result.get("items", []) as Array).size() == 1)
print("Unified inventory validation: PASS")
root.free()
scene_root.free()
quit()