23 lines
722 B
GDScript
23 lines
722 B
GDScript
# scripts/game_state.gd — autoloaded as "GameState"
|
|
extends Node
|
|
|
|
const HUB_SCENE := "res://hub.tscn"
|
|
|
|
# Written by the hub before starting a mission, read by the mission in _ready().
|
|
# Later this becomes a MissionDef reference; a Dictionary is the v1 stand-in.
|
|
var mission_params: Dictionary = {}
|
|
|
|
# Written by the mission before returning, read by the hub.
|
|
var last_mission_result: Dictionary = {}
|
|
|
|
|
|
func start_mission(scene_path: String, params: Dictionary = {}) -> void:
|
|
mission_params = params
|
|
last_mission_result = {}
|
|
get_tree().change_scene_to_file(scene_path)
|
|
|
|
func return_to_hub(result: Dictionary = {}) -> void:
|
|
last_mission_result = result
|
|
mission_params = {}
|
|
get_tree().change_scene_to_file(HUB_SCENE)
|