/** * World Persistence System * Provides save/load functionality for complete world state */ import { ECSContext } from './ecs'; import { WorldDefinition } from './worldSchema'; /** * Save world state to a JSON file * * @param ctx - ECS context * @param filename - Name of the file to save (default: world-save-{timestamp}.json) * @returns The serialized world definition * * @example * ```typescript * const worldData = saveWorldToFile(engine.ecsWorld, 'my-world.json'); * ``` */ export declare function saveWorldToFile(ctx: ECSContext, filename?: string): WorldDefinition; /** * Load world state from a file * Opens a file picker and loads the selected world definition * Returns the loaded world definition as a string that can be passed to loadWorld() * * @param onLoad - Callback when world is loaded with the world script string * @param onError - Callback when loading fails * * @example * ```typescript * loadWorldFromFile( * (worldScript) => engine.loadWorld(worldScript), * (error) => console.error('Failed to load:', error) * ); * ``` */ export declare function loadWorldFromFile(onLoad: (worldScript: string) => void, onError?: (error: Error) => void): void; /** * Create a save file from world definition (without triggering download) * Useful for programmatic access to save data * * @param ctx - ECS context * @returns JSON string of the world definition */ export declare function serializeWorldToJSON(ctx: ECSContext): string; /** * Load world from JSON string * Returns a world script that can be passed to loadWorld() * * @param json - JSON string containing world definition * @returns World script string */ export declare function loadWorldFromJSON(json: string): string; //# sourceMappingURL=worldPersistence.d.ts.map