extends Node2D ## Bootstrap. Mounts the world view + UI overlay. ## ## Once we add menus / continue-game / new-game flows this will branch ## on game state. For Phase 1 it just instances the World and TopBar, ## which are children placed in main.tscn. ## ## Phase 15 — StorytellerBanner and StorytellerModal are runtime-instantiated ## here (same pattern as world.gd's BeautySystem / DirtinessSystem). Both are ## CanvasLayer nodes so they draw above the world regardless of scene-tree order. ## ## Phase 16 — LoadMenu (layer 25) and ResumeToast (layer 22) are runtime- ## instantiated here. LoadMenu ref is injected into TopBar so the Load button ## can call open() without a get_node("/root/…") call. const STORYTELLER_BANNER_SCRIPT: Script = preload("res://scenes/ui/storyteller_banner.gd") const STORYTELLER_MODAL_SCRIPT: Script = preload("res://scenes/ui/storyteller_modal.gd") const LOAD_MENU_SCRIPT: Script = preload("res://scenes/ui/load_menu.gd") const RESUME_TOAST_SCRIPT: Script = preload("res://scenes/ui/resume_toast.gd") func _ready() -> void: Audit.log("main", "Phase 3 — world + AI (Decision + JobRunner + RestProvider) online.") # Autoloads — keep these asserts; cheap and catch a renamed-autoload # regression instantly. assert(World != null, "World autoload missing") assert(Sim != null, "Sim autoload missing") assert(GameState != null, "GameState autoload missing") assert(EventBus != null, "EventBus autoload missing") assert(Strings != null, "Strings autoload missing") assert(SaveSystem != null, "SaveSystem autoload missing") assert(Autosave != null, "Autosave autoload missing") # Phase 15 — Storyteller UI layers. Runtime-instantiated so no .tscn edit is # needed. CanvasLayer ensures correct draw order above World/TopBar regardless # of parent-node position. var banner := CanvasLayer.new() banner.set_script(STORYTELLER_BANNER_SCRIPT) banner.name = "StorytellerBanner" add_child(banner) var modal := CanvasLayer.new() modal.set_script(STORYTELLER_MODAL_SCRIPT) modal.name = "StorytellerModal" add_child(modal) Audit.log("main", "Phase 15 — StorytellerBanner + StorytellerModal mounted.") # Phase 16 — Save/Load UI layers. var resume_toast := CanvasLayer.new() resume_toast.set_script(RESUME_TOAST_SCRIPT) resume_toast.name = "ResumeToast" add_child(resume_toast) var load_menu := CanvasLayer.new() load_menu.set_script(LOAD_MENU_SCRIPT) load_menu.name = "LoadMenu" add_child(load_menu) # Inject LoadMenu ref into TopBar so the Load button can call open() # without reaching into the scene tree by path. var top_bar = get_node_or_null("TopBar") if top_bar != null and top_bar.has_method("_ready"): top_bar.load_menu = load_menu elif top_bar != null: top_bar.load_menu = load_menu Audit.log("main", "Phase 16 — LoadMenu + ResumeToast mounted.")