Add logbook catalog index filters

This commit is contained in:
Alexander Sellite 2026-08-29 20:19:47 -04:00
parent 4575830857
commit 81decf2b71
9 changed files with 1540 additions and 10 deletions

View file

@ -2,6 +2,7 @@ extends SceneTree
const MainScene = preload("res://main/main.tscn")
const FishCatchType = preload("res://fish/fish_catch.gd")
const MENU_TRANSITION_SETTLE_SECONDS := 3.0
func _initialize() -> void:
@ -36,12 +37,16 @@ func _run() -> void:
var logbook := player_menu.get_node("%CatalogLogbook") as LogbookPage
var backdrop := main.get_node("%PlayerMenuBackdrop") as ColorRect
var hotbar := game_ui.get_node("%Hotbar") as Control
var fishing_spot := main.get("_fishing_spot") as FishingSpot
assert(logbook.get("_fishing_spot") == fishing_spot)
assert(logbook.get("_world_time") == main.get("_world_time"))
assert(logbook.get("_world_weather") == main.get("_world_weather"))
var shortcut := InputEventKey.new()
shortcut.pressed = true
shortcut.physical_keycode = KEY_L
assert(bool(player_menu.call("_handle_direct_page_shortcut", shortcut)))
await create_timer(2.2).timeout
await create_timer(MENU_TRANSITION_SETTLE_SECONDS).timeout
assert(player_menu.visible)
assert(logbook.visible)
assert(backdrop.visible)
@ -51,6 +56,18 @@ func _run() -> void:
var entry_buttons: Dictionary = logbook.get("_entry_buttons")
assert(entry_buttons.size() == 108)
await _capture_if_requested("-unknown")
logbook.call("_set_index_open", true, false)
await process_frame
assert(bool(logbook.get("_index_open")))
assert((logbook.get("_index_body") as Control).visible)
await _capture_if_requested("-index")
logbook.set_compact_presentation(true)
await process_frame
await _capture_if_requested("-index-compact")
logbook.set_compact_presentation(false)
await process_frame
logbook.call("_set_index_open", false, false)
await process_frame
logbook.call(
"_select_category", WaterType.Type.FRESH_WATER
)
@ -68,13 +85,29 @@ func _run() -> void:
logbook.call("_select_entry", &"bluegill", &"bluegill")
await create_timer(0.2).timeout
await _capture_if_requested("-known")
var bluegill := (
main.get("fish_catalog") as FishPool
).get_fish_by_id(&"bluegill")
var bluegill_available_now := fishing_spot.is_species_available_now(bluegill)
var index_options := logbook.get("_index_options") as Dictionary
index_options["availability"] = (
LogbookCatalog.AvailabilityFilter.AVAILABLE_NOW
)
logbook.notify_availability_context_changed()
await process_frame
assert(
(logbook.get("_entry_buttons") as Dictionary).has(&"bluegill")
== bluegill_available_now
)
logbook.call("_reset_index")
await process_frame
assert(bool(player_menu.call("_handle_direct_page_shortcut", shortcut)))
await create_timer(2.2).timeout
await create_timer(MENU_TRANSITION_SETTLE_SECONDS).timeout
assert(not player_menu.visible)
assert(bool(player_menu.call("_handle_direct_page_shortcut", shortcut)))
await create_timer(2.2).timeout
await create_timer(MENU_TRANSITION_SETTLE_SECONDS).timeout
player_menu.call(
"_show_section_immediate", PlayerMenu.Section.PROFILE
)