@wildshard/shard-format 0.79.3 → 0.80.0

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.
@@ -1,6 +1,3 @@
1
- import * as schema from 'valibot';
2
- import { isJsonData } from './json.ts';
3
-
4
1
  /** A generator flap: the back plane z(y) = z0 + (y - y0) · slope; every vertex above `yMin` behind it is pressed onto it,
5
2
  * keeping `keep` of its depth; `bulge` (m) rounds the pressed patch out into a dome (0 at its rim). */
6
3
  export interface RiggedHullFlap {
@@ -57,104 +54,11 @@ export interface RiggedHullUrls {
57
54
  readonly parts?: { readonly file: string; readonly nodes: Readonly<Record<string, string>> };
58
55
  }
59
56
 
60
- /** A generated tier book. Product references are logical blob names; coats keep
61
- * their original KTX2 cache keys and image URLs. */
57
+ /** A generated tier book, a shard generator's own data (its section and schema are deleted,
58
+ * FORMAT-PRUNE FP20). Product references are logical blob names; coats keep their original KTX2 cache keys and image
59
+ * URLs. */
62
60
  export interface RiggedHullBook {
63
61
  readonly family: RiggedHullFamilyRow;
64
62
  readonly tiers: Readonly<Record<'phone' | 'desktop', RiggedHullUrls>>;
65
63
  readonly productFiles: boolean;
66
64
  }
67
-
68
- const text = schema.pipe(schema.string(), schema.minLength(1), schema.maxLength(512)), num = schema.pipe(schema.number(), schema.finite());
69
- const rgbSchema = schema.tuple([num, num, num]);
70
- const resourcesSchema = schema.strictObject({
71
- files: schema.record(text, schema.union([text, schema.strictObject({ rig: text, base: text, normal: text })])),
72
- coats: schema.record(text, schema.strictObject({ key: text, image: text })),
73
- coatDecode: schema.exactOptional(schema.literal('bitmap')), vertexColours: schema.exactOptional(schema.boolean()),
74
- doubleSided: schema.exactOptional(schema.array(text)), parts: schema.exactOptional(schema.strictObject({ file: text, nodes: schema.record(text, text) })),
75
- });
76
- const bookSchema = schema.strictObject({ productFiles: schema.boolean(),
77
- family: schema.strictObject({ label: text, rigs: schema.pipe(schema.array(text), schema.maxLength(128)), hulls: schema.record(text, text),
78
- flaps: schema.exactOptional(schema.record(text, schema.strictObject({ yMin: num, y0: num, z0: num, slope: num, keep: num, bulge: num }))),
79
- fur: schema.exactOptional(schema.record(text, schema.record(text, schema.strictObject({ rim: rgbSchema, sheenColor: rgbSchema })))) }),
80
- tiers: schema.strictObject({ phone: resourcesSchema, desktop: resourcesSchema }),
81
- });
82
- /** Build-time and product admission share the same complete resource contract. */
83
- export const RiggedHullBookSchema: schema.GenericSchema<RiggedHullBookRowsInput, RiggedHullBookRows> = schema.pipe(bookSchema, schema.check(book => Object.values(book.tiers).every(source =>
84
- [...book.family.rigs, ...Object.values(book.family.hulls)].every(hull => source.files[hull] !== undefined)), 'Missing hull resource'));
85
- /** Admit a complete immutable book before any loader starts. */
86
- export function parseRiggedHullBook(input: unknown): RiggedHullBook {
87
- if (!isJsonData(input)) throw new Error('Rigged hull book requires plain data');
88
- const book = schema.parse(RiggedHullBookSchema, input);
89
- return book;
90
- }
91
-
92
- /** Admitted data contracts, independent of validator implementation metadata. */
93
- export type RiggedHullBookRowsInput = RiggedHullBookRows;
94
- interface RiggedHullBookRowsFields {
95
- productFiles: boolean;
96
- family: {
97
- label: string;
98
- rigs: (string)[];
99
- hulls: Record<string, string>;
100
- flaps?: Record<string, {
101
- yMin: number;
102
- y0: number;
103
- z0: number;
104
- slope: number;
105
- keep: number;
106
- bulge: number;
107
- }>;
108
- fur?: Record<string, Record<string, {
109
- rim: [
110
- number,
111
- number,
112
- number
113
- ];
114
- sheenColor: [
115
- number,
116
- number,
117
- number
118
- ];
119
- }>>;
120
- };
121
- tiers: {
122
- phone: {
123
- files: Record<string, (string) | ({
124
- rig: string;
125
- base: string;
126
- normal: string;
127
- })>;
128
- coats: Record<string, {
129
- key: string;
130
- image: string;
131
- }>;
132
- coatDecode?: 'bitmap';
133
- vertexColours?: boolean;
134
- doubleSided?: (string)[];
135
- parts?: {
136
- file: string;
137
- nodes: Record<string, string>;
138
- };
139
- };
140
- desktop: {
141
- files: Record<string, (string) | ({
142
- rig: string;
143
- base: string;
144
- normal: string;
145
- })>;
146
- coats: Record<string, {
147
- key: string;
148
- image: string;
149
- }>;
150
- coatDecode?: 'bitmap';
151
- vertexColours?: boolean;
152
- doubleSided?: (string)[];
153
- parts?: {
154
- file: string;
155
- nodes: Record<string, string>;
156
- };
157
- };
158
- };
159
- }
160
- export type RiggedHullBookRows = { [Key in keyof RiggedHullBookRowsFields]: RiggedHullBookRowsFields[Key] };
@@ -4,8 +4,6 @@ import type {StealthRows} from './stealth.ts';
4
4
  import type { ColourFunctionBook } from './colourFunction.ts';
5
5
  import type { PaintedLookRow } from './paintedLook.ts';
6
6
  import type { ExplorerCatalogue } from './explorerCatalogue.ts';
7
- import type { RiggedHullBook } from './riggedHulls.ts';
8
- import type { HullLookBookRows } from './speciesLooks.ts';
9
7
  import type { ToonLookRow } from './toonLook.ts';
10
8
  import type { KeyedSkyStyle } from './keyedSky.ts';
11
9
  import type { SpawnScriptRows } from './spawnScripts.ts';
@@ -58,8 +56,6 @@ export interface PlatformSections {
58
56
  'view/modules': ViewModuleRow[];
59
57
  /** Client-only ordered model references, ignored by simulation. */
60
58
  'explore/catalogue': ExplorerCatalogue;
61
- 'look/rigged-hulls': RiggedHullBook;
62
- 'look/hull-book': HullLookBookRows;
63
59
  'look/toon': ToonLookRow;
64
60
  'look/painted': PaintedLookRow;
65
61
  'look/colour-functions': ColourFunctionBook;
@@ -111,8 +107,6 @@ export interface PlatformSections {
111
107
  'look/look': Pick<Shardfile, 'look' | 'presentation'>;
112
108
  'look/map': Pick<Shardfile, 'map'>;
113
109
  'look/materials': { readonly rows: Pick<Rows, 'looks'> };
114
- /** ONE-FORMAT OF30: retired; an older product may carry it, nothing reads it. */
115
- 'actors/species-programs': unknown;
116
110
  /** new (KA5): sim-side steering mechanics, independently selected by decisions. */
117
111
  'actors/moves': ActorMoves;
118
112
  'actors/spawn-scripts': SpawnScriptRows[];
@@ -1,5 +1,4 @@
1
1
  import { creatureSizeRules, spawnCapacity } from './creature-sizes.ts';
2
- import { readSpeciesPrograms } from './speciesPrograms.ts';
3
2
  import type { StrikeDebrisPolicy } from './strike-debris.ts';
4
3
  import { strikeDebrisCatalogueRules } from './strike-debris.ts';
5
4
  import { harvestSpeciesRules } from './harvest-rows.ts';
@@ -332,10 +331,7 @@ export function shardfileRules(s: Shardfile, sections?: ReadonlyMap<string, unkn
332
331
  const parsed = v.safeParse(VehiclesSchema, vehicles);
333
332
  errors.push(...parsed.success ? vehicleRules(parsed.output, s) : ['world/vehicles parses']);
334
333
  }
335
- const metadata = sections?.get('actors/species-programs');
336
- const roster = metadata === undefined ? undefined : readSpeciesPrograms(metadata);
337
- const targets = [...s.rows.species, ...roster?.page ?? [], ...roster?.native ?? [], ...roster?.program?.species ?? []];
338
- errors.push(...strikeDebrisCatalogueRules({ strikes: debrisStrikes, species: targets }));
334
+ errors.push(...strikeDebrisCatalogueRules({ strikes: debrisStrikes, species: s.rows.species }));
339
335
  const harvestItems = new Set((s.items.catalogue ?? []).map((row: Readonly<{ id: string }>): string => row.id));
340
336
  errors.push(...harvestSpeciesRules(s.rows.species, harvestItems));
341
337
  if (s.migrations.some(step => step.equipmentSlots?.some(rename => !s.items.rows.some(row => row.kind === 'weapon' && row.slot === rename.to)))) errors.push('migration equipment slots resolve declared weapons');