feat: save games and edit scene darkness
Persist show state to local saves; author map darkness in scene editor with bake-to-scene and help updates. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -131,4 +131,29 @@ export class SceneTrapsStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exportByCard(): Record<string, Record<string, SceneTrapRuntime>> {
|
||||
if (this.currentKey !== null) {
|
||||
this.cache.set(this.currentKey, cloneById(this.state.byId));
|
||||
}
|
||||
const out: Record<string, Record<string, SceneTrapRuntime>> = {};
|
||||
for (const [key, byId] of this.cache) {
|
||||
const kept: Record<string, SceneTrapRuntime> = {};
|
||||
for (const [id, runtime] of Object.entries(byId)) {
|
||||
if (runtime.status === 'inactive' && !runtime.revealed) continue;
|
||||
kept[id] = { ...runtime };
|
||||
}
|
||||
if (Object.keys(kept).length > 0) out[key] = kept;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
importByCard(byCard: Record<string, Record<string, SceneTrapRuntime>>): void {
|
||||
this.cache.clear();
|
||||
this.currentKey = null;
|
||||
this.state = emptyState();
|
||||
for (const [key, byId] of Object.entries(byCard)) {
|
||||
this.cache.set(key, cloneById(byId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user