Player preferences: art set, auto-grab, flourishes
A ⚙ preferences slip in the masthead, saved to this device: - Token art, all or nothing: the photographed cardboard or the hand-drawn vectors (the workshop's per-category query params stay as the undocumented editing override). - Ending a turn on a lone grabbable treasure picks it up on the way out — never on your own home, never when two share the square. - Spell flourishes on or off, honored by the live board and the replay reel alike (trap notices still fire; they are information). Preferences change what you see or what routine commands the client sends for you — never what is legal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0138A8CjeQRpvzKxuMfz1Bqc
This commit is contained in:
co-authored by
Claude Fable 5
parent
5310fbdca9
commit
6aae40ad5f
+10
-10
@@ -1,19 +1,19 @@
|
||||
// The art workshop's side door (deliberately undocumented): query params
|
||||
// like ?svgPlayers=true&svgTerrain=true swap token categories to the
|
||||
// hand-drawn SVG set in public/tokens-svg. Under `npm run dev`, editing
|
||||
// those files shows on the next refresh.
|
||||
// Which art set a token draws from: the player's preference, with the
|
||||
// workshop's per-category query params (?svgPlayers=true, ...) as a
|
||||
// deliberate override for editing sessions under `npm run dev`.
|
||||
import { prefs } from "./prefs.svelte";
|
||||
|
||||
export type ArtCategory = "players" | "creatures" | "terrain" | "objects";
|
||||
|
||||
const q = new URLSearchParams(typeof location === "undefined" ? "" : location.search);
|
||||
const SVG_ART: Record<ArtCategory, boolean> = {
|
||||
players: q.get("svgPlayers") === "true",
|
||||
creatures: q.get("svgCreatures") === "true",
|
||||
terrain: q.get("svgTerrain") === "true",
|
||||
objects: q.get("svgObjects") === "true",
|
||||
const PARAM: Record<ArtCategory, string> = {
|
||||
players: "svgPlayers", creatures: "svgCreatures", terrain: "svgTerrain", objects: "svgObjects",
|
||||
};
|
||||
|
||||
export function tokenArt(file: string, cat: ArtCategory): string {
|
||||
return SVG_ART[cat] ? `/tokens-svg/${file}.svg` : `/tokens/${file}.png`;
|
||||
const override = q.get(PARAM[cat]);
|
||||
const drawn = override !== null ? override === "true" : prefs.art === "drawn";
|
||||
return drawn ? `/tokens-svg/${file}.svg` : `/tokens/${file}.png`;
|
||||
}
|
||||
|
||||
// Which token file depicts each board thing (shared by the board renderer
|
||||
|
||||
Reference in New Issue
Block a user