Every table option is also a preference: the choice a new table starts with, shown in the panel
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
1 parent
3825dfb44c
commit
74df9a253a
2 files changed
+11
-4
No files matched your search
@@ -21,7 +21,16 @@ export const KIT_PREFERENCES: Preference[] = [
|
||||
{ key: 'confirmMoves', label: 'Confirm a move before it is sent', kind: 'toggle', default: false }
|
||||
];
|
||||
|
||||
export const PREFERENCES: Preference[] = [...KIT_PREFERENCES, ...(game.preferences ?? [])];
|
||||
/** Every table option is also a preference: the choice a new table starts with. The hall reads and writes the same keys. */
|
||||
const TABLE_DEFAULTS: Preference[] = (game.options ?? []).map((o) => ({
|
||||
key: `table.${o.key}`,
|
||||
label: `${o.label}, for a new table`,
|
||||
kind: 'choice',
|
||||
choices: o.choices.map((c) => ({ value: c.value, label: c.label })),
|
||||
default: o.default
|
||||
}));
|
||||
|
||||
export const PREFERENCES: Preference[] = [...KIT_PREFERENCES, ...TABLE_DEFAULTS, ...(game.preferences ?? [])];
|
||||
|
||||
const KEY = '__SLUG__:prefs';
|
||||
|
||||
@@ -38,8 +47,6 @@ function load(): Record<string, boolean | string> {
|
||||
if (p.kind === 'toggle' && typeof v === 'boolean') base[p.key] = v;
|
||||
if (p.kind === 'choice' && typeof v === 'string' && p.choices?.some((c) => c.value === v)) base[p.key] = v;
|
||||
}
|
||||
// The hall's last table options ride along under table.<key>, undeclared.
|
||||
for (const [k, v] of Object.entries(saved)) if (k.startsWith('table.') && typeof v === 'string') base[k] = v;
|
||||
} catch {
|
||||
// Without storage the defaults apply for this visit.
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user