extends Node ## Autoload "Session" -- carries the "which world am I joining" handoff from ## the world browser to the game scene. ## ## world_list.gd calls begin() with the address returned by ## POST /api/worlds/{id}/join; game.gd reads it in _ready() to decide whether ## to run networked or fall back to local single-player (e.g. game.tscn opened ## directly, or the backend has no orchestration). ## ## world_list.gd also calls begin_edit() for the "Edit world" entry point ## (docs/architecture/world_persistence_impl.md §6 D4): editing is ## deliberately **non-joined** -- it never calls POST /join, so `active` ## stays false and game.gd never opens an ENet connection for it. `editing` ## is the separate signal game.gd checks to open the in-game editor against ## a real, HTTP-fetched chunk instead of running gameplay. var world_id: int = 0 var host: String = "" var port: int = 0 var active: bool = false var editing: bool = false func begin(p_world_id: int, p_host: String, p_port: int) -> void: world_id = p_world_id host = p_host port = p_port active = true editing = false ## Enter "Edit world" (world_persistence_impl.md §6 D4): non-joined, no ## ENet connection, no dedicated server. game.gd loads/saves chunks over ## HTTP instead. func begin_edit(p_world_id: int) -> void: world_id = p_world_id host = "" port = 0 active = false editing = true func clear() -> void: world_id = 0 host = "" port = 0 active = false editing = false