class_name LoadingTools ## Utilities for loading game states const WORLD_SCENE := "res://src/world/world.tscn" static func _load_world(level: PackedScene, save: SaveState = null) -> void: var finish_load := func(world: World) -> void: world.save_state = save world.initial_level = level print_debug("Loading world") Game.instance.queue_scene(WORLD_SCENE).then(finish_load) static func load_level(level_path: String, save: SaveState = null) -> void: print_debug("Loading level from ", level_path) var chain_load := func(level: PackedScene) -> void: LoadingTools._load_world(level, save) Game.instance.queue_load(level_path).then(chain_load) static func load_save(save_path: String) -> void: print_debug("Loading save from ", save_path) var chain_load := func(save: SaveState) -> void: load_level(save.level_path, save) Game.instance.queue_load(save_path, ResourceLoader.CACHE_MODE_REPLACE_DEEP).then(chain_load)