[ui] accent: read MachineDef.accent first
Order 5, and the half that actually matters — the precedence comment landed in the research commit but the lookup itself didn't get staged. Precedence now matches LANE-RENDER exactly: art-directed accent wins, else the first-output derivation, else the codex id/kind tables for machines that output nothing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
edca93f298
commit
a48d45b4df
@ -52,7 +52,10 @@ export function machineChassis(def: MachineDef): string {
|
|||||||
export type AccentFn = (def: MachineDef) => string;
|
export type AccentFn = (def: MachineDef) => string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accent lookup: the colour of the first thing the machine makes, else the codex table.
|
* Accent lookup, in the precedence LANE-RENDER uses (v4 — confirmed identical in NOTES):
|
||||||
|
* 1. `MachineDef.accent` — art direction wins outright.
|
||||||
|
* 2. the colour of the first item the machine outputs — the documented derivation.
|
||||||
|
* 3. the codex id/kind tables below, for machines that output nothing.
|
||||||
* Curried over GameData because the derivation needs recipes + items.
|
* Curried over GameData because the derivation needs recipes + items.
|
||||||
*/
|
*/
|
||||||
export function createAccentLookup(data: GameData): AccentFn {
|
export function createAccentLookup(data: GameData): AccentFn {
|
||||||
@ -60,6 +63,8 @@ export function createAccentLookup(data: GameData): AccentFn {
|
|||||||
const items = new Map<string, ItemDef>(data.items.map((i) => [i.id, i]));
|
const items = new Map<string, ItemDef>(data.items.map((i) => [i.id, i]));
|
||||||
|
|
||||||
return (def) => {
|
return (def) => {
|
||||||
|
if (def.accent) return def.accent;
|
||||||
|
|
||||||
for (const rid of def.recipes) {
|
for (const rid of def.recipes) {
|
||||||
const r = recipes.get(rid);
|
const r = recipes.get(rid);
|
||||||
if (!r) continue;
|
if (!r) continue;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user