class_name DemoSnapshot extends RefCounted const SCHEMA := 1 const DEFAULT_PATH := "user://mana_foundry_slot1.json" static var path_override := "" static func slot_path() -> String: if not path_override.is_empty(): return path_override return DEFAULT_PATH static func exists() -> bool: return FileAccess.file_exists(slot_path()) static func save_payload(payload: Dictionary) -> bool: var path := slot_path() var file := FileAccess.open(path, FileAccess.WRITE) if file == null: return false file.store_string(JSON.stringify(payload, "\t")) return true static func load_payload() -> Dictionary: if not exists(): return {} var file := FileAccess.open(slot_path(), FileAccess.READ) if file == null: return {} var parsed: Variant = JSON.parse_string(file.get_as_text()) if typeof(parsed) != TYPE_DICTIONARY: return {} var payload: Dictionary = parsed if int(payload.get("schema", 0)) != SCHEMA: return {} return payload