@wildshard/shard-format 0.40.0 → 0.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/shard-format",
3
- "version": "0.40.0",
3
+ "version": "0.41.1",
4
4
  "description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -125,6 +125,7 @@
125
125
  "./director": "./src/format/director.ts",
126
126
  "./detail-layer": "./src/format/detail-layer.ts",
127
127
  "./pbr-emissive": "./src/format/pbr-emissive.ts",
128
+ "./pbr-fur": "./src/format/pbr-fur.ts",
128
129
  "./scene-render": "./src/format/scene-render.ts",
129
130
  "./look-sky": "./src/format/look-sky.ts",
130
131
  "./directorDocument": "./src/format/directorDocument.ts",
@@ -348,6 +349,7 @@
348
349
  "./shardSections": "./src/format/shardSections.ts",
349
350
  "./sketch": "./src/format/sketch.ts",
350
351
  "./skinAssets": "./src/format/skinAssets.ts",
352
+ "./skinTextures": "./src/format/skin-textures.ts",
351
353
  "./skinData": "./src/format/skinData.ts",
352
354
  "./skinLayers": "./src/format/skinLayers.ts",
353
355
  "./skins": "./src/format/skins.ts",
@@ -14,7 +14,10 @@ import { DiverSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema } fr
14
14
  /** One creature spawn row; input and output differ only in the home they carry. */
15
15
  interface CreatureSpawnRow<Home> { perchBody?: string; group?: string; rank?: 'veteran' | 'elite' | 'champion' | 'legendary'; count?: { per: number; max: number }; when?: { quest?: { id: string; stage: number }; time?: 'day' | 'night'; wave?: { set: string; index: number } }; phaseOffset?: number | undefined; respawn?: number | undefined; home?: Home | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; }
16
16
 
17
- const id = v.pipe(v.string(), v.regex(/^[a-z][a-z0-9.:-]*$/u), v.maxLength(128));
17
+ const ID_LENGTH = 128;
18
+ const id = v.pipe(v.string(), v.regex(/^[a-z][a-z0-9.:-]*$/u), v.maxLength(ID_LENGTH));
19
+ /** A species row id may carry capitals (OF11a): the spawn that places it names it the same way. */
20
+ const speciesId = v.pipe(v.string(), v.regex(/^[a-z][a-zA-Z0-9.:-]*$/u), v.maxLength(ID_LENGTH));
18
21
  const finite = v.pipe(v.number(), v.finite());
19
22
  const radius = v.pipe(finite, v.minValue(0), v.maxValue(500));
20
23
  const speed = v.pipe(finite, v.minValue(0), v.maxValue(15));
@@ -82,7 +85,7 @@ const questWhen = v.strictObject({ id, stage });
82
85
  const waveWhen = v.strictObject({ set: id, index: countPart });
83
86
  const timeWhen = v.picklist(['day', 'night'], 'unknown spawn time');
84
87
  const when = v.strictObject({ quest: v.exactOptional(questWhen), time: v.exactOptional(timeWhen), wave: v.exactOptional(waveWhen) }, 'unknown spawn condition');
85
- const spawn = v.strictObject({ perchBody: v.exactOptional(id), group: v.exactOptional(id), rank: v.exactOptional(rank), count: v.exactOptional(count), when: v.exactOptional(when), phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: id, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
88
+ const spawn = v.strictObject({ perchBody: v.exactOptional(id), group: v.exactOptional(id), rank: v.exactOptional(rank), count: v.exactOptional(count), when: v.exactOptional(when), phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: speciesId, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
86
89
  /** Pure-data creature archetypes and stable spawn layouts, expanded before the local sim boots. */
87
90
  export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ perchBodies: v.exactOptional(CreaturePerchBodiesSchema), brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), patrols: v.exactOptional(CreaturePatrolsSchema), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
88
91
  v.check((c) => creatureRules(c).length === 0 && patrolsAdmitted(c.patrols ?? [], c.spawns, c.groups), 'creature reference rules'));
@@ -18,6 +18,8 @@
18
18
  import { detailLayer } from './detail-layer.ts';
19
19
  import type { DetailLayer } from './detail-layer.ts';
20
20
  import { pbrEmissive, pbrEmissiveIntensity } from './pbr-emissive.ts';
21
+ import { pbrRim, pbrSheen } from './pbr-fur.ts';
22
+ import type { PbrSheen } from './pbr-fur.ts';
21
23
  import { emissiveCard, emissiveMotion, surfaceBlend, surfaceDepthOffset, surfaceOpacity, surfaceSway, surfaceSwing, surfaceUvScroll } from './scene-render.ts';
22
24
  import type { CardMotion, SurfaceSway } from './scene-render.ts';
23
25
  import * as v from 'valibot';
@@ -212,7 +214,7 @@ export function measureUv(role: MeasureRole, u: number, up: number, w: number, h
212
214
  }
213
215
 
214
216
  /** One PBR surface: metal / rough with colour, normal and packed ORM maps (occlusion r, roughness g, metalness b). */
215
- export const PbrMaterialSchema: v.StrictObjectSchema<{ readonly family: v.GenericSchema<PbrMaterialParamsInput['family'], PbrMaterialParams['family']>; readonly colour: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['colour'], undefined>, PbrMaterialParams['colour']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['colour'], undefined>>>; readonly roughness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['roughness'], undefined>, PbrMaterialParams['roughness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['roughness'], undefined>>>; readonly metalness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['metalness'], undefined>, PbrMaterialParams['metalness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['metalness'], undefined>>>; readonly maps: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['maps'], undefined>, PbrMaterialParams['maps']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['maps'], undefined>>>; readonly normalScale: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['normalScale'], undefined>, PbrMaterialParams['normalScale']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['normalScale'], undefined>>>; readonly occlusion: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['occlusion'], undefined>, PbrMaterialParams['occlusion']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['occlusion'], undefined>>>; readonly envStrength: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['envStrength'], undefined>, PbrMaterialParams['envStrength']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['envStrength'], undefined>>>; readonly vertexColours: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>, PbrMaterialParams['vertexColours']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>>>; readonly faceted: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['faceted'], undefined>, PbrMaterialParams['faceted']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['faceted'], undefined>>>; readonly doubleSided: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>, PbrMaterialParams['doubleSided']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>>>; readonly alphaCutoff: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>, PbrMaterialParams['alphaCutoff']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>>>; readonly ground: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['ground'], undefined>, PbrMaterialParams['ground']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['ground'], undefined>>>; readonly measure: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['measure'], undefined>, PbrMaterialParams['measure']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['measure'], undefined>>>; readonly detail: typeof detailLayer; readonly emissive: typeof pbrEmissive; readonly emissiveIntensity: typeof pbrEmissiveIntensity; readonly blend: typeof surfaceBlend; readonly opacity: typeof surfaceOpacity; readonly depthOffset: typeof surfaceDepthOffset; readonly sway: typeof surfaceSway; readonly uvScroll: typeof surfaceUvScroll; readonly swing: typeof surfaceSwing; }, undefined> = v.strictObject({
217
+ export const PbrMaterialSchema: v.StrictObjectSchema<{ readonly family: v.GenericSchema<PbrMaterialParamsInput['family'], PbrMaterialParams['family']>; readonly colour: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['colour'], undefined>, PbrMaterialParams['colour']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['colour'], undefined>>>; readonly roughness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['roughness'], undefined>, PbrMaterialParams['roughness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['roughness'], undefined>>>; readonly metalness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['metalness'], undefined>, PbrMaterialParams['metalness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['metalness'], undefined>>>; readonly maps: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['maps'], undefined>, PbrMaterialParams['maps']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['maps'], undefined>>>; readonly normalScale: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['normalScale'], undefined>, PbrMaterialParams['normalScale']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['normalScale'], undefined>>>; readonly occlusion: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['occlusion'], undefined>, PbrMaterialParams['occlusion']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['occlusion'], undefined>>>; readonly envStrength: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['envStrength'], undefined>, PbrMaterialParams['envStrength']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['envStrength'], undefined>>>; readonly vertexColours: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>, PbrMaterialParams['vertexColours']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>>>; readonly faceted: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['faceted'], undefined>, PbrMaterialParams['faceted']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['faceted'], undefined>>>; readonly doubleSided: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>, PbrMaterialParams['doubleSided']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>>>; readonly alphaCutoff: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>, PbrMaterialParams['alphaCutoff']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>>>; readonly ground: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['ground'], undefined>, PbrMaterialParams['ground']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['ground'], undefined>>>; readonly measure: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['measure'], undefined>, PbrMaterialParams['measure']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['measure'], undefined>>>; readonly detail: typeof detailLayer; readonly emissive: typeof pbrEmissive; readonly emissiveIntensity: typeof pbrEmissiveIntensity; readonly sheen: typeof pbrSheen; readonly rim: typeof pbrRim; readonly blend: typeof surfaceBlend; readonly opacity: typeof surfaceOpacity; readonly depthOffset: typeof surfaceDepthOffset; readonly sway: typeof surfaceSway; readonly uvScroll: typeof surfaceUvScroll; readonly swing: typeof surfaceSwing; }, undefined> = v.strictObject({
216
218
  family: v.literal('pbr'),
217
219
  /** sRGB, multiplies the colour map */
218
220
  colour: v.optional(srgb, [1, 1, 1]),
@@ -242,6 +244,10 @@ export const PbrMaterialSchema: v.StrictObjectSchema<{ readonly family: v.Generi
242
244
  emissive: pbrEmissive,
243
245
  /** M4.3: the glow's linear gain (HDR); absent = 1 */
244
246
  emissiveIntensity: pbrEmissiveIntensity,
247
+ /** OF27b: a fur's velvet sheen (`amount` of linear `colour` at `roughness`); absent = none */
248
+ sheen: pbrSheen,
249
+ /** OF27b: a fur's backlit rim colour (linear); absent = none */
250
+ rim: pbrRim,
245
251
  /** AP10: 'alpha' draws it see-through after the opaque world (a stencil, a decal); absent = opaque */
246
252
  blend: surfaceBlend,
247
253
  /** AP10: the alpha blend's scale; absent = 1 */
@@ -570,9 +576,9 @@ export interface GroundLayerParamsInput { wind?: [number, number] | undefined; w
570
576
  export interface GroundLayerParams { wind: [number, number]; wavelength: [number, number]; lump: number; depth: [number, number]; relief: [number, number, number]; contrast: { near: number; far: number; window: [number, number]; strength: number; }; fade: [number, number]; slip: [number, number]; flat: [number, number]; patches: { floor: number; near: number; window: [number, number]; }; grain: { map: (string) | null; mean: number; glintMean: number; strength: number; }; macro: [[number, number, number], [number, number, number]]; albedo: number; streaks: { tint: [number, number, number]; amount: number; }; trail: ({ map: string; rect: [number, number, number, number]; ripples: number; tint: [number, number, number]; amount: number; }) | null; keyShadow: ({ map: string; rect: [number, number, number, number]; edge: [number, number]; floor: number; }) | null; terminator: number; crest: { band: [number, number]; gain: number; }; sheen: number; shade: { tint: [number, number, number]; gain: number; lift: [number, number, number]; amount: number; edge: number; floor: [number, number, number]; }; saturation: { flat: number; facing: number; coolTint: [number, number, number]; keep: number; }; away: { from: [number, number]; amount: number; }; pools: ({ low: [number, number, number]; high: [number, number, number]; split: number; radius: number; gain: number; source?: string; }) | null; }
571
577
  export interface MeasureLayerParamsInput { structure?: [number, number, number] | undefined; trim?: [number, number, number] | undefined; floor?: [number, number, number] | undefined; line?: { colour: [number, number, number]; alpha: number; floorAlpha: number; width: number; } | undefined; sub?: { step: number; alpha: number; } | undefined; label?: { colour: [number, number, number]; height: number; } | undefined; lift?: number | undefined; tint?: [number, number, number]; grain?: { amount: [number, number, number]; size: number; }; grid?: [number, number, number]; }
572
578
  export interface MeasureLayerParams { structure: [number, number, number]; trim: [number, number, number]; floor: [number, number, number]; line: { colour: [number, number, number]; alpha: number; floorAlpha: number; width: number; }; sub: { step: number; alpha: number; }; label: { colour: [number, number, number]; height: number; }; lift: number; tint?: [number, number, number]; grain?: { amount: [number, number, number]; size: number; }; grid?: [number, number, number]; }
573
- export interface PbrMaterialParamsInput { family: 'pbr'; colour?: [number, number, number] | undefined; roughness?: number | undefined; metalness?: number | undefined; maps?: { colour: (string) | null; normal: (string) | null; orm: (string) | null; } | undefined; normalScale?: number | undefined; occlusion?: number | undefined; envStrength?: number | undefined; vertexColours?: boolean | undefined; faceted?: boolean | undefined; doubleSided?: boolean | undefined; alphaCutoff?: number | undefined; ground?: (GroundLayerParamsInput) | null | undefined; measure?: (MeasureLayerParamsInput) | null | undefined; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; blend?: 'opaque' | 'alpha'; opacity?: number; depthOffset?: number; sway?: SurfaceSway; uvScroll?: [number, number]; swing?: true; }
579
+ export interface PbrMaterialParamsInput { family: 'pbr'; colour?: [number, number, number] | undefined; roughness?: number | undefined; metalness?: number | undefined; maps?: { colour: (string) | null; normal: (string) | null; orm: (string) | null; } | undefined; normalScale?: number | undefined; occlusion?: number | undefined; envStrength?: number | undefined; vertexColours?: boolean | undefined; faceted?: boolean | undefined; doubleSided?: boolean | undefined; alphaCutoff?: number | undefined; ground?: (GroundLayerParamsInput) | null | undefined; measure?: (MeasureLayerParamsInput) | null | undefined; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; sheen?: PbrSheen; rim?: [number, number, number]; blend?: 'opaque' | 'alpha'; opacity?: number; depthOffset?: number; sway?: SurfaceSway; uvScroll?: [number, number]; swing?: true; }
574
580
  // oxlint-disable-next-line typescript/consistent-type-definitions -- Graph admission requires the material alias's implicit dictionary compatibility.
575
- export type PbrMaterialParams = { family: 'pbr'; colour: [number, number, number]; roughness: number; metalness: number; maps: { colour: (string) | null; normal: (string) | null; orm: (string) | null; }; normalScale: number; occlusion: number; envStrength: number; vertexColours: boolean; faceted: boolean; doubleSided: boolean; alphaCutoff: number; ground: (GroundLayerParams) | null; measure: (MeasureLayerParams) | null; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; blend?: 'opaque' | 'alpha'; opacity?: number; depthOffset?: number; sway?: SurfaceSway; uvScroll?: [number, number]; swing?: true; };
581
+ export type PbrMaterialParams = { family: 'pbr'; colour: [number, number, number]; roughness: number; metalness: number; maps: { colour: (string) | null; normal: (string) | null; orm: (string) | null; }; normalScale: number; occlusion: number; envStrength: number; vertexColours: boolean; faceted: boolean; doubleSided: boolean; alphaCutoff: number; ground: (GroundLayerParams) | null; measure: (MeasureLayerParams) | null; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; sheen?: PbrSheen; rim?: [number, number, number]; blend?: 'opaque' | 'alpha'; opacity?: number; depthOffset?: number; sway?: SurfaceSway; uvScroll?: [number, number]; swing?: true; };
576
582
  export interface GradeParamsInput { exposure?: number | undefined; gain?: number | undefined; shoulder?: number | undefined; saturation?: number | undefined; shadowTint?: [number, number, number] | undefined; lightTint?: [number, number, number] | undefined; split?: [number, number] | undefined; contrast?: number | undefined; lookSaturation?: number | undefined; }
577
583
  export interface GradeParams { exposure: number; gain: number; shoulder: number; saturation: number; shadowTint: [number, number, number]; lightTint: [number, number, number]; split: [number, number]; contrast: number; lookSaturation: number; }
578
584
  export interface PainterlyLookParamsInput { shade?: [number, number, number] | undefined; rim?: [number, number, number] | undefined; warm?: number | undefined; floor?: number | undefined; wet?: number | undefined; wind?: { direction: [number, number]; strength: number; } | undefined; grade?: (GradeParamsInput) | null | undefined; }
@@ -97,9 +97,10 @@ export const TextureSamplersSchema: v.GenericSchema<TextureSamplersInput, Textur
97
97
  wrap: v.exactOptional(v.picklist(['repeat', 'clamp', 'mirror'])), anisotropy: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(16))),
98
98
  filter: v.exactOptional(v.picklist(['linear', 'nearest'])), mips: v.exactOptional(v.picklist(['file', 'gpu'])),
99
99
  })), v.check((rows) => Object.keys(rows).length <= 256, 'bounded texture samplers'));
100
- /** Each sampler row names a texture of the look's material catalogue (a graph file's are its row's dependencies). */
101
- export function textureSamplerRules(look: Pick<Shardfile['look'], 'materials' | 'samplers'>, files: readonly { readonly hash: string; readonly dependencies: readonly string[] }[] = []): string[] {
102
- const rows = new Map(files.map((file) => [file.hash, file])), refs = new Set(materialTextureRefs(look.materials));
100
+ /** Each sampler row names a texture of the look's material catalogue (a graph file's are its row's dependencies) or of a skin. */
101
+ export function textureSamplerRules(look: Pick<Shardfile['look'], 'materials' | 'samplers'>, files: readonly { readonly hash: string; readonly dependencies: readonly string[] }[] = [], skinTextures: readonly string[] = []): string[] {
102
+ // OF27b: a skin's material textures (`skinLookTextureRefs`) take a sampler too (the hull book's repeat, anisotropy 4)
103
+ const rows = new Map(files.map((file) => [file.hash, file])), refs = new Set([...materialTextureRefs(look.materials), ...skinTextures]);
103
104
  for (const material of Object.values(look.materials)) if (material.family === 'graph' && 'file' in material) for (const ref of rows.get(material.file)?.dependencies ?? []) refs.add(ref);
104
105
  return Object.keys(look.samplers ?? {}).flatMap((ref) => (refs.has(ref) ? [] : [`samplers ${ref}: not a texture of the look's material catalogue`]));
105
106
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`); the offline estimate refuses over the larger of the line and that reading plus 0.5% (memory-armed.ts ARMED_ALLOWANCE), so a zone EM11 measured under the line whose conservative estimate reads over it (Nine's playing) is locked at its armed state. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json.",
2
+ "$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`); the offline estimate refuses over the larger of the line and that reading plus 0.5% (memory-armed.ts ARMED_ALLOWANCE), so a zone EM11 measured under the line whose conservative estimate reads over it (Nine's playing) is locked at its armed state. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json. `held` (J424): zones armed once but moved out of `zones` because engine pins an older product of theirs that reads over the line; a held zone reports only, and moves back to `zones` (re-armed) when its engine re-pin lands. Its readings stay so re-arming changes nothing else.",
3
3
  "lines": {
4
4
  "playingBytes": 1000000000,
5
5
  "loadingBytes": 1500000000
@@ -13,14 +13,6 @@
13
13
  "loadingBytes": 984731013,
14
14
  "evidence": "engine-pinned product revision 6 (tar f42fe0449a93), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
15
15
  },
16
- "driftwood-isle": {
17
- "armed": "2026-11-18",
18
- "by": "mini-pinemem5",
19
- "epoch": 8,
20
- "playingBytes": 820905616,
21
- "loadingBytes": 1157545785,
22
- "evidence": "shard-driftwood e736730 built with format 0.37 (epoch 8); codex-nalati locked pairs on the EM11 upper read 990.5 / 1,344.7 MB (meta MEMORY-GATES)"
23
- },
24
16
  "far-reach": {
25
17
  "armed": "2026-11-18",
26
18
  "by": "mini-pinemem5",
@@ -37,22 +29,6 @@
37
29
  "loadingBytes": 925290035,
38
30
  "evidence": "engine-pinned product revision 1 (tar 5764c86a258a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
39
31
  },
40
- "nalati-grasslands": {
41
- "armed": "2026-11-18",
42
- "by": "mini-pinemem5",
43
- "epoch": 8,
44
- "playingBytes": 945736154,
45
- "loadingBytes": 1328901899,
46
- "evidence": "shard-nalati 1d5014e8 built with format 0.37 (epoch 8); mini-resweep EM11 upper on the J420 stand-in: playing 0.940 GB less the worker, loading 1.470 GB (meta MEMORY-GATES)"
47
- },
48
- "nine-dragon-stack": {
49
- "armed": "2026-11-18",
50
- "by": "mini-pinemem5",
51
- "epoch": 8,
52
- "playingBytes": 1023504847,
53
- "loadingBytes": 1434692360,
54
- "evidence": "shard-nine-dragon 8779b872 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine d0fd6e62, 9 pairs: playing upper 0.938 GB, loading upper 1.435 GB (meta 1677f091). The estimate's playing (1,023.5 MB) is over the 1.0 GB line, so it locks at that reading"
55
- },
56
32
  "open-plot-alien-plain": {
57
33
  "armed": "2026-11-18",
58
34
  "by": "mini-pinemem5",
@@ -197,14 +173,6 @@
197
173
  "loadingBytes": 925256481,
198
174
  "evidence": "engine-pinned product revision 1 (tar e42e2f5f5793), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
199
175
  },
200
- "pine-hollow": {
201
- "armed": "2026-11-18",
202
- "by": "mini-pinemem5",
203
- "epoch": 8,
204
- "playingBytes": 920666659,
205
- "loadingBytes": 1298769921,
206
- "evidence": "shard-pine-hollow 400ed4b7 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine f0a96518, 9 pairs: playing upper 0.969 GB, loading upper 1.407 GB (meta 118a2b13)"
207
- },
208
176
  "sunscar-dunes": {
209
177
  "armed": "2026-11-18",
210
178
  "by": "mini-pinemem5",
@@ -213,5 +181,43 @@
213
181
  "loadingBytes": 1108011593,
214
182
  "evidence": "engine-pinned product revision 2 (tar f4a1d611cccc), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
215
183
  }
184
+ },
185
+ "held": {
186
+ "driftwood-isle": {
187
+ "armed": "2026-11-18",
188
+ "by": "mini-pinemem5",
189
+ "epoch": 8,
190
+ "playingBytes": 820905616,
191
+ "loadingBytes": 1157545785,
192
+ "evidence": "shard-driftwood e736730 built with format 0.37 (epoch 8); codex-nalati locked pairs on the EM11 upper read 990.5 / 1,344.7 MB (meta MEMORY-GATES)",
193
+ "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
194
+ },
195
+ "nalati-grasslands": {
196
+ "armed": "2026-11-18",
197
+ "by": "mini-pinemem5",
198
+ "epoch": 8,
199
+ "playingBytes": 945736154,
200
+ "loadingBytes": 1328901899,
201
+ "evidence": "shard-nalati 1d5014e8 built with format 0.37 (epoch 8); mini-resweep EM11 upper on the J420 stand-in: playing 0.940 GB less the worker, loading 1.470 GB (meta MEMORY-GATES)",
202
+ "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
203
+ },
204
+ "nine-dragon-stack": {
205
+ "armed": "2026-11-18",
206
+ "by": "mini-pinemem5",
207
+ "epoch": 8,
208
+ "playingBytes": 1023504847,
209
+ "loadingBytes": 1434692360,
210
+ "evidence": "shard-nine-dragon 8779b872 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine d0fd6e62, 9 pairs: playing upper 0.938 GB, loading upper 1.435 GB (meta 1677f091). The estimate's playing (1,023.5 MB) is over the 1.0 GB line, so it locks at that reading",
211
+ "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
212
+ },
213
+ "pine-hollow": {
214
+ "armed": "2026-11-18",
215
+ "by": "mini-pinemem5",
216
+ "epoch": 8,
217
+ "playingBytes": 920666659,
218
+ "loadingBytes": 1298769921,
219
+ "evidence": "shard-pine-hollow 400ed4b7 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine f0a96518, 9 pairs: playing upper 0.969 GB, loading upper 1.407 GB (meta 118a2b13)",
220
+ "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
221
+ }
216
222
  }
217
223
  }
@@ -26,6 +26,14 @@ const ARMED_ZONES: Readonly<Record<string, ArmedZone>> = Object.freeze(
26
26
  armed.zones,
27
27
  )
28
28
 
29
+ /** J424 (QA 11-18 row 29): a zone armed once but held out of `ARMED_ZONES` while engine pins an older product of it
30
+ * that reads over its line. It reports only; it moves back to `zones` (re-armed) when its engine re-pin lands. */
31
+ interface HeldZone extends ArmedZone {
32
+ readonly held: string
33
+ }
34
+
35
+ const HELD_ZONES: Readonly<Record<string, HeldZone>> = Object.freeze(armed.held)
36
+
29
37
  /** True when `slug` is in the armed list (J426). */
30
38
  function zoneArmed(slug?: string): boolean {
31
39
  return slug !== undefined && Object.hasOwn(ARMED_ZONES, slug)
@@ -34,6 +42,15 @@ function zoneArmed(slug?: string): boolean {
34
42
  /** A rebuild of the same source moves the computed estimate by packing and compression drift only. */
35
43
  const ARMED_ALLOWANCE = 0.005
36
44
 
45
+ /** The line a zone's entry locks at: the J410 line, or its reading at arming plus the allowance when that is higher. */
46
+ function zoneLine(zone: ArmedZone, kind: ArmedKind): number {
47
+ const armedBytes = kind === 'playing' ? zone.playingBytes : zone.loadingBytes
48
+ return Math.max(
49
+ ARMED_LINES[kind],
50
+ armedBytes + Math.floor(armedBytes * ARMED_ALLOWANCE),
51
+ )
52
+ }
53
+
37
54
  /** What an armed zone's offline estimate refuses over: the J410 line, or, when the conservative estimate of a source
38
55
  * that EM11 measured under the line already reads over it (Nine's playing), that reading at arming plus the
39
56
  * allowance, so the gate locks in the measured state and refuses any growth. Undefined for a zone that only reports. */
@@ -43,14 +60,7 @@ function armedLine(
43
60
  ): number | undefined {
44
61
  const zone =
45
62
  slug === undefined || !zoneArmed(slug) ? undefined : ARMED_ZONES[slug]
46
- if (zone === undefined) {
47
- return undefined
48
- }
49
- const armedBytes = kind === 'playing' ? zone.playingBytes : zone.loadingBytes
50
- return Math.max(
51
- ARMED_LINES[kind],
52
- armedBytes + Math.floor(armedBytes * ARMED_ALLOWANCE),
53
- )
63
+ return zone === undefined ? undefined : zoneLine(zone, kind)
54
64
  }
55
65
 
56
66
  export {
@@ -60,5 +70,8 @@ export {
60
70
  type ArmedKind,
61
71
  type ArmedZone,
62
72
  armedLine,
73
+ HELD_ZONES,
74
+ type HeldZone,
63
75
  zoneArmed,
76
+ zoneLine,
64
77
  }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * A PBR surface's fur (meta ONE-FORMAT OF27b, the hull-book look as a skin): the velvet sheen and the backlit rim that
3
+ * a rigged hull's coat drew with (engine `AnimalFactory`'s hull material and its fur rim), so a `platform.skin` look
4
+ * draws as the hull book did.
5
+ *
6
+ * - `sheen`: three's `MeshPhysicalMaterial` sheen, `amount` (0..1) of `colour` (linear, a light term) at `roughness`.
7
+ * - `rim`: the backlit Fresnel rim's colour (linear, HDR allowed): strongest looking toward the sun, fading past 10 m.
8
+ *
9
+ * Absent: none, as before (no default is filled, so older shard files keep their bytes). A skin variant may wear its
10
+ * own sheen and rim with its coat (`skin-variants.ts`). Plain data and checks, no three.js.
11
+ */
12
+ import {
13
+ exactOptional,
14
+ finite,
15
+ maxValue,
16
+ minValue,
17
+ number,
18
+ pipe,
19
+ strictObject,
20
+ tuple,
21
+ } from 'valibot'
22
+
23
+ import type { ExactOptionalSchema, GenericSchema } from 'valibot'
24
+
25
+ type Rgb = [number, number, number]
26
+ interface PbrSheen {
27
+ amount: number
28
+ colour: Rgb
29
+ roughness: number
30
+ }
31
+
32
+ const NONE = 0
33
+ const FULL = 1
34
+ const LIGHT_MAX = 16
35
+
36
+ const real = pipe(number(), finite())
37
+ const unit = pipe(real, minValue(NONE), maxValue(FULL))
38
+ const light = pipe(real, minValue(NONE), maxValue(LIGHT_MAX))
39
+ const linear: GenericSchema<Rgb, Rgb> = tuple([light, light, light])
40
+ const PbrSheenSchema: GenericSchema<PbrSheen, PbrSheen> = strictObject({
41
+ amount: unit,
42
+ colour: linear,
43
+ roughness: unit,
44
+ })
45
+ /** The PBR family's optional `sheen` key. */
46
+ const pbrSheen: ExactOptionalSchema<
47
+ GenericSchema<PbrSheen, PbrSheen>,
48
+ undefined
49
+ > = exactOptional(PbrSheenSchema)
50
+ /** The PBR family's optional `rim` key. */
51
+ const pbrRim: ExactOptionalSchema<
52
+ GenericSchema<Rgb, Rgb>,
53
+ undefined
54
+ > = exactOptional(linear)
55
+
56
+ export { PbrSheenSchema, pbrRim, pbrSheen, type PbrSheen }
@@ -20,6 +20,9 @@ const positive = v.pipe(finite, v.minValue(0.000001), v.maxValue(10000000));
20
20
  const nonnegative = v.pipe(finite, v.minValue(0), v.maxValue(10000000));
21
21
  const unit = v.pipe(finite, v.minValue(0), v.maxValue(1));
22
22
  const dimension = v.pipe(positive, v.maxValue(20));
23
+ /** A flyer's bake has no legs (OF11a): legs are nonnegative, the body stays positive. */
24
+ const NO_LEGS = 0;
25
+ const legs = v.union([v.literal(NO_LEGS), dimension]);
23
26
  const duration = v.pipe(positive, v.maxValue(86400));
24
27
  const ordered = v.pipe(v.tuple([positive, positive]), v.check(([a, b]) => a <= b, 'ordered range'));
25
28
  const shape = v.variant('kind', [
@@ -40,7 +43,7 @@ const day = v.strictObject({ id, units: v.literal('hour'), start: hour,
40
43
  sun: v.strictObject({ maxElevation: v.pipe(finite, v.minValue(0), v.maxValue(90)), azimuthOffset: v.pipe(finite, v.minValue(-180), v.maxValue(180)) }),
41
44
  fixed: v.strictObject({ midday: hour, golden: hour, sunset: hour, night: hour }), presets: v.strictObject({ dawn: hour, noon: hour, dusk: hour, night: hour }) });
42
45
  const mods = v.strictObject({ speed: positive, chargeDist: positive, damageTaken: positive, chargeDamage: nonnegative, relentless: v.boolean() });
43
- const dims = v.strictObject({ bodyY: dimension, bodyHalfLen: dimension, bodyRadius: dimension, headRadius: dimension, legLen: dimension,
46
+ const dims = v.strictObject({ bodyY: dimension, bodyHalfLen: dimension, bodyRadius: dimension, headRadius: dimension, legLen: legs,
44
47
  feet: v.pipe(v.array(v.tuple([finite, finite])), v.maxLength(16)), halfWidth: dimension });
45
48
  const variant = v.strictObject({ id, label: text, rarity: v.picklist(['common', 'uncommon', 'rare', 'legendary']), weight: nonnegative, scale: ordered, hp: positive, mods });
46
49
  const flight = v.strictObject({ altitude: v.pipe(finite, v.minValue(-250), v.maxValue(250)),
@@ -58,6 +58,7 @@ import { AccentSchema } from './accent.ts';
58
58
  import { MapSchema, PresentationSchema } from './presentation.ts';
59
59
  import { MigrationsSchema, migrationRules } from './migrations.ts';
60
60
  import { skinLookRules } from './skinAssets.ts';
61
+ import { skinLookTextureRefs } from './skin-textures.ts';
61
62
  import { attachmentFileRules } from './creature-attachments.ts';
62
63
  import { MaterialsSchema, FamilyLooksSchema, MaterialCurvesSchema, TextureSamplersSchema, materialExists, materialTextureRefs, materialGraphRules, materialCurveRules, textureSamplerRules, graphBindingSources } from './materials.ts';
63
64
  import { PostStackSchema, postStackRules } from './postStack.ts';
@@ -266,7 +267,7 @@ export function shardfileRules(s: Shardfile, sections?: ReadonlyMap<string, unkn
266
267
  errors.push(...stateRules(s.state));
267
268
  if ((s.clientChannels?.length ?? 0) > 0 && !pageOwner && s.runtime?.binds?.includes('clientChannels') !== true) errors.push('native visual channels require their declared page or runtime owner');
268
269
  if (s.runtime?.binds?.includes('state') === true && (s.state.player.length > 0 || s.state.shared.some((field) => field.privacy !== 'host' && !(field.privacy === 'public' && field.type !== 'string' && (s.runtime?.spawns?.bosses.length ?? 0) > 0)))) errors.push('runtime-bound state supports host fields and retained-actor numeric fields');
269
- errors.push(...materialGraphRules(s), ...materialCurveRules(s), ...textureSamplerRules(s.look, s.files), ...postStackRules(s), ...lookSkyRules(s.look.sky?.graph, graphBindingSources(s)));
270
+ errors.push(...materialGraphRules(s), ...materialCurveRules(s), ...textureSamplerRules(s.look, s.files, skinLookTextureRefs(s)), ...postStackRules(s), ...lookSkyRules(s.look.sky?.graph, graphBindingSources(s)));
270
271
  const materialRefs = materialTextureRefs(s.look.materials), libraryClosure = new Set<string>();
271
272
  const libraryPending = [...s.library];
272
273
  while (libraryPending.length > 0) {
@@ -0,0 +1,53 @@
1
+ // Validator output rows retain the format's mutable public data types.
2
+ /* oxlint-disable typescript/prefer-readonly-parameter-types */
3
+ import { skinLookParameters } from './skin-file.ts'
4
+ /**
5
+ * The textures a shard's skin looks draw (ONE-FORMAT OF27b): each skin, variant and phone skin file's dependencies after
6
+ * its GLB, so a texture sampler row may name them as it names the look's material catalogue textures.
7
+ */
8
+ import { SKIN_LOOK_RECIPE } from './skins.ts'
9
+
10
+ import type { ShardRows } from './rows.ts'
11
+ import type { Shardfile } from './shardSchema.ts'
12
+
13
+ type Source = Readonly<Pick<Shardfile, 'rows' | 'files'>>
14
+ type Look = Readonly<ShardRows['looks'][number]>
15
+ type Files = ReadonlyMap<string, Readonly<Shardfile['files'][number]>>
16
+ /** A skin file's dependencies after its GLB. */
17
+ const AFTER_GLB = 1
18
+
19
+ /** The skin files a skin look names: its skin, its variant table's skins and its phone skin. */
20
+ function lookSkinFiles(look: Look, files: Files): readonly string[] {
21
+ if (look.recipe !== SKIN_LOOK_RECIPE) {
22
+ return []
23
+ }
24
+ try {
25
+ const { skin, variants, phone } = skinLookParameters(look)
26
+ const table =
27
+ variants === undefined ? [] : (files.get(variants)?.dependencies ?? [])
28
+ return [skin, ...table, ...(phone === undefined ? [] : [phone])]
29
+ } catch {
30
+ return []
31
+ }
32
+ }
33
+
34
+ /** Every texture a skin look of `source` names, once each. */
35
+ function skinLookTextureRefs(source: Source): string[] {
36
+ const files: Files = new Map(
37
+ source.files.map(
38
+ (
39
+ file: Readonly<Shardfile['files'][number]>,
40
+ ): [string, Readonly<Shardfile['files'][number]>] => [file.hash, file],
41
+ ),
42
+ )
43
+ const textures = (hash: string): readonly string[] =>
44
+ files.get(hash)?.dependencies.slice(AFTER_GLB) ?? []
45
+ const refs = source.rows.looks.flatMap((look: Look): readonly string[] =>
46
+ lookSkinFiles(look, files).flatMap((hash: string): readonly string[] =>
47
+ textures(hash),
48
+ ),
49
+ )
50
+ return [...new Set(refs)]
51
+ }
52
+
53
+ export { skinLookTextureRefs }
@@ -4,6 +4,7 @@
4
4
  /* oxlint-disable unicorn/no-array-sort */
5
5
  import { parse } from 'valibot'
6
6
 
7
+ import { MaterialsSchema, materialTextureRefs } from './materials.ts'
7
8
  import { parseSkinFile, skinLookParameters } from './skin-file.ts'
8
9
  import { SkinVariantsSchema } from './skins.ts'
9
10
  import { validationSourceBytes } from './validationReceipt.ts'
@@ -26,7 +27,32 @@ interface SkinLookFiles {
26
27
  type Source = Pick<Shardfile, 'rows' | 'files'>
27
28
  type Look = ShardRows['looks'][number]
28
29
  const FIRST = 0
29
- const SINGLE = 1
30
+ const REST = 1
31
+ /** A coat: what a variant or phone skin may wear of its own (OF27b), its maps (a painterly `map`), its fur's sheen and rim, and its glow. */
32
+ const COAT: ReadonlySet<string> = new Set([
33
+ 'map',
34
+ 'maps',
35
+ 'sheen',
36
+ 'rim',
37
+ 'emissive',
38
+ 'emissiveIntensity',
39
+ ])
40
+
41
+ /** A skin file's exact dependencies: its GLB, then its material's textures, sorted and once each (OF27b). */
42
+ function skinFileDependencies(row: SkinRow, binding: SkinBinding): string[] {
43
+ const textures = materialTextureRefs(
44
+ parse(MaterialsSchema, { skin: binding.material }),
45
+ )
46
+ return [row.file, ...[...new Set(textures)].sort()]
47
+ }
48
+
49
+ function sharedMaterial(
50
+ material: Readonly<Record<string, unknown>>,
51
+ ): Record<string, unknown> {
52
+ return Object.fromEntries(
53
+ Object.entries(material).filter(([key]): boolean => !COAT.has(key)),
54
+ )
55
+ }
30
56
 
31
57
  function skinContract({ row, binding }: ResolvedSkinFile): string {
32
58
  return new TextDecoder().decode(
@@ -36,7 +62,7 @@ function skinContract({ row, binding }: ResolvedSkinFile): string {
36
62
  joints: [...(row.rig.joints[FIRST] ?? [])].sort(),
37
63
  clips: [...row.rig.clips].sort(),
38
64
  sockets: [...row.rig.sockets].sort(),
39
- material: binding.material,
65
+ material: sharedMaterial(binding.material),
40
66
  materials: binding.materials ?? {},
41
67
  }),
42
68
  )
@@ -53,10 +79,14 @@ function readSkinFile(
53
79
  throw new Error('skin file missing')
54
80
  }
55
81
  const skin = { hash, ...parseSkinFile(bytes) }
82
+ const expected = skinFileDependencies(skin.row, skin.binding)
83
+ const texture = (ref: string): boolean =>
84
+ ref.startsWith('commons:') || files.get(ref)?.kind === 'ktx2'
56
85
  if (
57
- file.dependencies.length !== SINGLE ||
58
- file.dependencies[FIRST] !== skin.row.file ||
59
- files.get(skin.row.file)?.kind !== 'glb'
86
+ file.dependencies.length !== expected.length ||
87
+ file.dependencies.some((ref, index): boolean => ref !== expected[index]) ||
88
+ files.get(skin.row.file)?.kind !== 'glb' ||
89
+ !expected.slice(REST).every((ref): boolean => texture(ref))
60
90
  ) {
61
91
  throw new Error('skin rig dependency mismatch')
62
92
  }
@@ -232,5 +262,5 @@ function lookSkins(resolved: SkinLookFiles): ResolvedSkinFile[] {
232
262
  ]
233
263
  }
234
264
 
235
- export { lookSkins, resolveSkinLookFiles }
265
+ export { lookSkins, resolveSkinLookFiles, skinFileDependencies }
236
266
  export type { ResolvedSkinFile, SkinLookFiles }
@@ -36,8 +36,11 @@ function skinLookRules(source: Pick<Shardfile, 'rows' | 'files' | 'library'>): s
36
36
  for (const row of source.rows.looks) {
37
37
  if (row.recipe !== SKIN_LOOK_RECIPE) { if (row.animation.recipe === SKIN_CLIPS_RECIPE) {errors.push('skin clips without a skin look');} continue; }
38
38
  let parameters: SkinLookParameters; try { parameters = skinLookParameters(row); } catch { errors.push('skin look parameters'); continue; }
39
- const { skin, variants, phone } = parameters, file = files.get(skin), glb = file?.dependencies.length === 1 ? files.get(file.dependencies[0] ?? '') : undefined;
40
- if (file?.kind !== 'json' || glb?.kind !== 'glb' || !source.library.includes(skin)) {errors.push('skin look file references');}
39
+ const { skin, variants, phone } = parameters, file = files.get(skin), glb = files.get(file?.dependencies[0] ?? '');
40
+ // OF27b: a skin file depends on its GLB, then its material's textures (KTX2 files or commons)
41
+ const textures = file?.dependencies.slice(1) ?? [];
42
+ if (file?.kind !== 'json' || glb?.kind !== 'glb' || !source.library.includes(skin)
43
+ || textures.some((ref): boolean => !ref.startsWith('commons:') && files.get(ref)?.kind !== 'ktx2')) {errors.push('skin look file references');}
41
44
  if (!libraryJson(source.library, kinds, variants)) {errors.push('skin variant table references');}
42
45
  if (!libraryJson(source.library, kinds, phone)) {errors.push('skin phone file references');}
43
46
  }
@@ -104,5 +107,6 @@ function validateSkinAssets(source: Pick<Shardfile, 'rows' | 'files'> & { readon
104
107
  }
105
108
 
106
109
  export { parseSkinFile, skinLookParameters } from './skin-file.ts';
107
- export { resolveSkinLookFiles } from './skin-variants.ts';
110
+ export { resolveSkinLookFiles, skinFileDependencies } from './skin-variants.ts';
108
111
  export { skinLookRules, validateSkinAssets };
112
+ export { skinLookTextureRefs } from './skin-textures.ts';