@wildshard/shard-format 0.66.0 → 0.67.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/shard-format",
3
- "version": "0.66.0",
3
+ "version": "0.67.0",
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": {
@@ -7,6 +7,18 @@ import type { LevelLoadout } from './level-start-rows.ts';
7
7
  import { MeleeContactsSchema, NativeMeleeRowSchema, WeaponProfileSchema, type MeleeContactRow } from './weaponProfiles.ts';
8
8
  import { isJsonData } from './json.ts';
9
9
 
10
+ interface KeptItemRowsInput { id: ItemFamilyNameRowsInput; kind: 'upgrade' | 'cosmetic' | 'charm' | 'trophy' | 'gear'; label: string; gauge?: { name: 'sharpen' | 'hearts' | 'charms'; level: number; }; }
11
+ interface KeptItemRows { id: ItemFamilyNameRows; kind: 'upgrade' | 'cosmetic' | 'charm' | 'trophy' | 'gear'; label: string; gauge?: { name: 'sharpen' | 'hearts' | 'charms'; level: number; }; }
12
+ /** OF31f1: kept ids are unique, and so is each gauge level (ids never hold a colon). */
13
+ function keptUnique(rows: readonly { readonly id: string; readonly gauge?: { readonly name: string; readonly level: number } }[]): boolean {
14
+ const seen = new Set<string>();
15
+ for (const row of rows) {
16
+ const keys = row.gauge === undefined ? [row.id] : [row.id, `gauge:${row.gauge.name}.${String(row.gauge.level)}`];
17
+ for (const key of keys) { if (seen.has(key)) { return false; } seen.add(key); }
18
+ }
19
+ return true;
20
+ }
21
+
10
22
  /** The bounded authored family/context name, also checked by the native family installer. */
11
23
  export const ItemFamilyNameSchema: v.GenericSchema<ItemFamilyNameRowsInput, ItemFamilyNameRows> = v.pipe(v.string(), v.regex(/^[a-z][a-zA-Z0-9.-]*$/u), v.maxLength(128));
12
24
  const name = ItemFamilyNameSchema;
@@ -72,8 +84,14 @@ const inventory = v.pipe(v.strictObject({ kinds: v.pipe(v.array(name), v.minLeng
72
84
  quantity: v.picklist(['unchecked', 'positive-safe-integer']), snapshot: v.picklist(['order', 'roster']),
73
85
  stackLimit: v.exactOptional(v.pipe(finite, v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER))), restoreError: text }),
74
86
  v.check(row => new Set(row.kinds).size === row.kinds.length && row.counts.min <= row.counts.max, 'Unique inventory kinds and ordered count bounds'));
87
+ /** ONE-FORMAT OF31f1 (Q37): what a player keeps for good in this shard: upgrades, looks, charms, trophies and found gear.
88
+ * A save keeps exactly these ids; `gauge` feeds the Bag's sharpening, sturdy-heart and charm pips (the highest level owned). */
89
+ const GAUGE_MAX = 8, GAUGE_MIN = 1, KEPT_MAX = 256;
90
+ const gauge = v.strictObject({ name: v.picklist(['sharpen', 'hearts', 'charms']), level: v.pipe(finite, v.integer(), v.minValue(GAUGE_MIN), v.maxValue(GAUGE_MAX)) });
91
+ const keptItem: v.GenericSchema<KeptItemRowsInput, KeptItemRows> = v.strictObject({ id: name, kind: v.picklist(['upgrade', 'cosmetic', 'charm', 'trophy', 'gear']), label: text, gauge: v.exactOptional(gauge) });
92
+ const kept = v.pipe(v.array(keptItem), v.maxLength(KEPT_MAX), v.check<KeptItemRows[], 'unique kept ids and gauge levels'>(keptUnique, 'unique kept ids and gauge levels'));
75
93
  const catalogue = v.pipe(v.array(v.strictObject({ id: name, label: text, icon: CatalogueIconSchema, travels: v.boolean() })), v.maxLength(256));
76
- const raw: v.StrictObjectSchema<{ readonly version: v.GenericSchema<ShardItemsInput['version'], ShardItems['version']>; readonly catalogue: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['catalogue'], undefined>, Exclude<ShardItems['catalogue'], undefined>>, undefined>; readonly rows: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<'kind', readonly [typeof weapon, typeof tool], undefined>, undefined>, v.MaxLengthAction<(WeaponItemRows | ToolItemRows)[], 64, undefined>]>; readonly launches: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['launches'], undefined>, Exclude<ShardItems['launches'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['pickups'], undefined>, Exclude<ShardItems['pickups'], undefined>>, undefined>; readonly contexts: v.GenericSchema<ShardItemsInput['contexts'], ShardItems['contexts']>; readonly runtimeContexts: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['runtimeContexts'], undefined>, Exclude<ShardItems['runtimeContexts'], undefined>>, undefined>; readonly loadout: v.GenericSchema<ShardItemsInput['loadout'], ShardItems['loadout']>; }, undefined> = v.strictObject({ version: v.literal(1), catalogue: v.exactOptional(catalogue), rows: v.pipe(v.array(v.variant('kind', [weapon, tool])), v.maxLength(64)),
94
+ const raw: v.StrictObjectSchema<{ readonly version: v.GenericSchema<ShardItemsInput['version'], ShardItems['version']>; readonly catalogue: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['catalogue'], undefined>, Exclude<ShardItems['catalogue'], undefined>>, undefined>; readonly kept: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['kept'], undefined>, Exclude<ShardItems['kept'], undefined>>, undefined>; readonly rows: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<'kind', readonly [typeof weapon, typeof tool], undefined>, undefined>, v.MaxLengthAction<(WeaponItemRows | ToolItemRows)[], 64, undefined>]>; readonly launches: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['launches'], undefined>, Exclude<ShardItems['launches'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['pickups'], undefined>, Exclude<ShardItems['pickups'], undefined>>, undefined>; readonly contexts: v.GenericSchema<ShardItemsInput['contexts'], ShardItems['contexts']>; readonly runtimeContexts: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['runtimeContexts'], undefined>, Exclude<ShardItems['runtimeContexts'], undefined>>, undefined>; readonly loadout: v.GenericSchema<ShardItemsInput['loadout'], ShardItems['loadout']>; }, undefined> = v.strictObject({ version: v.literal(1), catalogue: v.exactOptional(catalogue), kept: v.exactOptional(kept), rows: v.pipe(v.array(v.variant('kind', [weapon, tool])), v.maxLength(64)),
77
95
  launches: v.exactOptional(v.pipe(v.record(name, BodyLaunchSchema), v.maxEntries(64))),
78
96
  pickups: v.exactOptional(v.pipe(v.record(name, ClaimedPickupSchema), v.maxEntries(128))),
79
97
  contexts: v.pipe(v.array(ItemContextSchema), v.maxLength(64)),
@@ -227,8 +245,8 @@ export interface ToolItemRowsInput { id: `tool.${string}`; kind: 'tool'; family:
227
245
  export interface ToolItemRows { id: `tool.${string}`; kind: 'tool'; family: ItemFamilyNameRows; ui: { name: string; icon: ItemFamilyNameRows; swapIcon: string; blurb: string; }; view: { asset?: string; recipe: ItemFamilyNameRows; colour: string; position: [number, number, number]; rotation: [number, number, number]; }; hook: ({ module: string; entity: number; event: number; }) | null; equipment?: { id: `tool.${string}`; meta: { category: string; } & Omit<v.InferOutput<typeof equipment.entries.meta>, "category">; } & Omit<ItemEquipmentRows, "id" | "meta">; action: (`${string}.${string}`) | null; fuelSeconds: number; intensity: number; }
228
246
  export interface ItemAttackRowsInput { id: ItemFamilyNameRowsInput; damage: number; cooldown: number; range: number; width: number; tags: (`${string}.${string}`)[]; effect: (`effect.${string}`) | null; }
229
247
  export interface ItemAttackRows { id: ItemFamilyNameRows; damage: number; cooldown: number; range: number; width: number; tags: (`${string}.${string}`)[]; effect: (`effect.${string}`) | null; }
230
- export interface ShardItemsInput { version: 1; catalogue?: ({ id: ItemFamilyNameRowsInput; label: string; icon: CatalogueIconNameInput; travels: boolean; })[]; rows: ((WeaponItemRowsInput) | (ToolItemRowsInput))[]; launches?: Record<string, v.InferInput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferInput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRowsInput)[]; runtimeContexts?: (ItemFamilyNameRowsInput)[]; loadout: { effects?: { statuses: boolean; player: v.InferInput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferInput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferInput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferInput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRowsInput)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
231
- export interface ShardItems { version: 1; catalogue?: ({ id: ItemFamilyNameRows; label: string; icon: CatalogueIconName; travels: boolean; })[]; rows: ((WeaponItemRows) | (ToolItemRows))[]; launches?: Record<string, v.InferOutput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferOutput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRows)[]; runtimeContexts?: (ItemFamilyNameRows)[]; loadout: { effects?: { statuses: boolean; player: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferOutput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRows)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
248
+ export interface ShardItemsInput { version: 1; catalogue?: ({ id: ItemFamilyNameRowsInput; label: string; icon: CatalogueIconNameInput; travels: boolean; })[]; kept?: KeptItemRowsInput[]; rows: ((WeaponItemRowsInput) | (ToolItemRowsInput))[]; launches?: Record<string, v.InferInput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferInput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRowsInput)[]; runtimeContexts?: (ItemFamilyNameRowsInput)[]; loadout: { effects?: { statuses: boolean; player: v.InferInput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferInput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferInput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferInput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRowsInput)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
249
+ export interface ShardItems { version: 1; catalogue?: ({ id: ItemFamilyNameRows; label: string; icon: CatalogueIconName; travels: boolean; })[]; kept?: KeptItemRows[]; rows: ((WeaponItemRows) | (ToolItemRows))[]; launches?: Record<string, v.InferOutput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferOutput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRows)[]; runtimeContexts?: (ItemFamilyNameRows)[]; loadout: { effects?: { statuses: boolean; player: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferOutput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRows)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
232
250
  export interface NativeSweptPolicyRowsInput { kind: 'swept'; step: ItemFamilyNameRowsInput; selection?: v.InferInput<typeof NativeLoadoutRowSchema>; eye: number; initial: number; source: 'env' | 'owner'; slots: ({ item: `weapon.${string}`; weapon: `weapon.${string}`; tags: (`${string}.${string}`)[]; combo: (ItemFamilyNameRowsInput)[]; heavy: ItemFamilyNameRowsInput; })[]; contact: { slack: number; direction: [number, number, number]; push: [number, number]; running: number; }; lunge: { maxHeight: number; minDistance: number; minRadius: number; lengthScale: number; }; }
233
251
  export interface NativeSweptPolicyRows { kind: 'swept'; step: ItemFamilyNameRows; selection?: v.InferOutput<typeof NativeLoadoutRowSchema>; eye: number; initial: number; source: 'env' | 'owner'; slots: ({ item: `weapon.${string}`; weapon: `weapon.${string}`; tags: (`${string}.${string}`)[]; combo: (ItemFamilyNameRows)[]; heavy: ItemFamilyNameRows; })[]; contact: { slack: number; direction: [number, number, number]; push: [number, number]; running: number; }; lunge: { maxHeight: number; minDistance: number; minRadius: number; lengthScale: number; }; }
234
252
  export interface ItemEquipmentRowsInput { id: string; legacySlot?: 'crossbow' | 'sword' | 'rifle' | 'sword-iron' | 'bow' | 'sabre' | 'spear' | 'empty'; ui: { name: string; icon: CatalogueIconNameInput; swapIcon: string; touch: 'melee' | 'bow' | 'ranged' | 'throwing'; lockOn: boolean; melee: boolean; tracers: boolean; inputContext?: ItemFamilyNameRowsInput; swapName?: string; huntersEye?: boolean; ammo?: { label: string; segments: number; magazine?: boolean; bagLabel?: string; bagLabelFor?: string; }; }; meta: { name: string; icon: CatalogueIconNameInput; blurb: string; category: ItemFamilyNameRowsInput; }; cues?: { fire: string; reload: string; impact: string; dry?: string; hit?: string; heavy?: string; charge?: Record<string, string>; }; hitStop?: { body: number; head: number; kill: number; }; rangedFeel?: { kick: { body: number; head: number; kill: number; side: number; killSide: number; }; trauma: { kill: number; head: number; killKinds: (ItemFamilyNameRowsInput)[]; headKinds: (ItemFamilyNameRowsInput)[]; }; }; tags?: (`${string}.${string}`)[]; }
@@ -19,6 +19,9 @@ export const ClaimedPickupSchema: v.GenericSchema<ClaimedPickupRowsInput, Claime
19
19
  towardPlayer: v.exactOptional(v.strictObject({ distance: v.pipe(finite, v.minValue(0)), epsilon: v.pipe(finite, v.minValue(0)) })) })),
20
20
  toast: v.exactOptional(text),
21
21
  });
22
+ /** ONE-FORMAT OF31g1 (Q37): the shard's one currency: what its coin is called, the pickup model a kill bursts and the Bag icon. */
23
+ const currency: v.GenericSchema<CurrencyRowsInput, CurrencyRows> = v.strictObject({ id: key, name: v.pipe(text, v.nonEmpty()),
24
+ model: v.pipe(v.string(), v.regex(/^(?=.{1,128}$)[a-z][a-z0-9-]*(?:\/[a-z0-9][a-z0-9-]*)*$/u)), icon: key });
22
25
  const grantSchema = v.strictObject({ id: effectId, key, unless: v.exactOptional(v.pipe(v.array(key), v.maxLength(32))), stacks: v.exactOptional(v.pipe(positive, v.maxValue(1024))) });
23
26
  const grants = v.pipe(v.array(grantSchema), v.maxLength(128));
24
27
  /** Bounded data selectors lower to the existing weighted-table predicate and count laws. */
@@ -42,7 +45,8 @@ export function parseLootTables(input: unknown): v.InferOutput<typeof LootTables
42
45
  return rows;
43
46
  }
44
47
  /** Inert economy content; ownership, transactions, attributes and menu lifetimes stay with their existing services. */
45
- export const LootEconomySchema: v.StrictObjectSchema<{ readonly presentation: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['presentation'], undefined>, Exclude<LootEconomy['presentation'], undefined>>, undefined>; readonly exchange: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['exchange'], undefined>, Exclude<LootEconomy['exchange'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['pickups'], undefined>, Exclude<LootEconomy['pickups'], undefined>>, undefined>; readonly tables: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['tables'], undefined>, Exclude<LootEconomy['tables'], undefined>>, undefined>; readonly progression: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['progression'], undefined>, Exclude<LootEconomy['progression'], undefined>>, undefined>; readonly effects: v.GenericSchema<LootEconomyInput['effects'], LootEconomy['effects']>; readonly goods: v.GenericSchema<LootEconomyInput['goods'], LootEconomy['goods']>; readonly grants: v.StrictObjectSchema<{ readonly player: v.GenericSchema<LootEconomyInput['grants']['player'], LootEconomy['grants']['player']>; readonly worn: v.GenericSchema<LootEconomyInput['grants']['worn'], LootEconomy['grants']['worn']>; readonly weapons: v.GenericSchema<LootEconomyInput['grants']['weapons'], LootEconomy['grants']['weapons']>; }, undefined>; readonly finds: v.GenericSchema<LootEconomyInput['finds'], LootEconomy['finds']>; readonly marks: v.GenericSchema<LootEconomyInput['marks'], LootEconomy['marks']>; }, undefined> = v.strictObject({
48
+ export const LootEconomySchema: v.StrictObjectSchema<{ readonly currency: v.ExactOptionalSchema<v.GenericSchema<CurrencyRowsInput, CurrencyRows>, undefined>; readonly presentation: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['presentation'], undefined>, Exclude<LootEconomy['presentation'], undefined>>, undefined>; readonly exchange: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['exchange'], undefined>, Exclude<LootEconomy['exchange'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['pickups'], undefined>, Exclude<LootEconomy['pickups'], undefined>>, undefined>; readonly tables: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['tables'], undefined>, Exclude<LootEconomy['tables'], undefined>>, undefined>; readonly progression: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['progression'], undefined>, Exclude<LootEconomy['progression'], undefined>>, undefined>; readonly effects: v.GenericSchema<LootEconomyInput['effects'], LootEconomy['effects']>; readonly goods: v.GenericSchema<LootEconomyInput['goods'], LootEconomy['goods']>; readonly grants: v.StrictObjectSchema<{ readonly player: v.GenericSchema<LootEconomyInput['grants']['player'], LootEconomy['grants']['player']>; readonly worn: v.GenericSchema<LootEconomyInput['grants']['worn'], LootEconomy['grants']['worn']>; readonly weapons: v.GenericSchema<LootEconomyInput['grants']['weapons'], LootEconomy['grants']['weapons']>; }, undefined>; readonly finds: v.GenericSchema<LootEconomyInput['finds'], LootEconomy['finds']>; readonly marks: v.GenericSchema<LootEconomyInput['marks'], LootEconomy['marks']>; }, undefined> = v.strictObject({
49
+ currency: v.exactOptional(currency),
46
50
  presentation:v.exactOptional(LootPresentationSchema),
47
51
  exchange: v.exactOptional(ExchangeSchema),
48
52
  pickups: v.exactOptional(v.pipe(v.record(key, ClaimedPickupSchema), v.maxEntries(128))),
@@ -141,7 +145,10 @@ export type LootTablesRows = ({
141
145
  })[];
142
146
  };
143
147
  })[];
148
+ interface CurrencyRowsInput { id: string; name: string; model: string; icon: string; }
149
+ interface CurrencyRows { id: string; name: string; model: string; icon: string; }
144
150
  interface LootEconomyInputFields {
151
+ currency?: CurrencyRowsInput;
145
152
  presentation?: v.InferInput<typeof LootPresentationSchema>;
146
153
  exchange?: v.InferInput<typeof ExchangeSchema>;
147
154
  pickups?: Record<string, ClaimedPickupRowsInput>;
@@ -174,6 +181,7 @@ interface LootEconomyInputFields {
174
181
  }
175
182
  export type LootEconomyInput = { [Key in keyof LootEconomyInputFields]: LootEconomyInputFields[Key] };
176
183
  interface LootEconomyFields {
184
+ currency?: CurrencyRows;
177
185
  presentation?: v.InferOutput<typeof LootPresentationSchema>;
178
186
  exchange?: v.InferOutput<typeof ExchangeSchema>;
179
187
  pickups?: Record<string, ClaimedPickupRows>;
@@ -20,9 +20,11 @@ const variant = v.objectWithRest({ id: key, label: key, weight: number,
20
20
  const species = v.objectWithRest({ id: key, kind: key, label: key,
21
21
  variants: v.pipe(v.array(variant), v.minLength(1), v.maxLength(64)),
22
22
  brain: v.exactOptional(SpeciesBrainSchema), body: v.exactOptional(CreatureBodyRecipeSchema) }, v.unknown());
23
- const population = v.objectWithRest({ program: v.strictObject({
23
+ const keeperProgram = v.strictObject({
24
24
  species: v.pipe(v.array(species), v.maxLength(256)), strikes: v.pipe(v.array(CreatureStrikeSchema), v.maxLength(256)),
25
- modules: v.exactOptional(v.record(key, v.pipe(v.string(), v.maxLength(400000)))) }),
25
+ modules: v.exactOptional(v.record(key, v.pipe(v.string(), v.maxLength(400000)))) });
26
+ // ONE-FORMAT OF30: a keeper whose creatures are all declared rows names no programme
27
+ const population = v.objectWithRest({ program: v.exactOptional(keeperProgram),
26
28
  step: key, seed: number, homes: v.pipe(v.array(v.strictObject({ id: key, kind: key, at: pair, yaw: number,
27
29
  respawn: number, look: v.exactOptional(key), late: v.exactOptional(v.union([v.boolean(), v.literal('ground')])) })), v.maxLength(4096)),
28
30
  boss: v.exactOptional(v.strictObject({ id: key, kind: key, at: pair, yaw: number, look: v.exactOptional(key) })),
@@ -93,4 +95,4 @@ export function nativeRuntimeActorIds(input: unknown): readonly string[] {
93
95
  }
94
96
 
95
97
  /** Admitted native recipe data; owner input ordering remains validated by the root schema. */
96
- export interface NativeRuntimeRecipeData { population: { rows: { program: { species: ({ id: string; kind: string; label: string; variants: ({ id: string; label: string; weight: number; rarity: 'common' | 'uncommon' | 'rare' | 'legendary'; scale: [number, number]; } & Record<string, unknown>)[]; brain?: v.InferOutput<typeof SpeciesBrainSchema>; body?: v.InferOutput<typeof CreatureBodyRecipeSchema>; } & Record<string, unknown>)[]; strikes: (v.InferOutput<typeof CreatureStrikeSchema>)[]; modules?: Record<string, string>; }; step: string; seed: number; homes: ({ id: string; kind: string; at: [number, number]; yaw: number; respawn: number; look?: string; late?: (boolean) | ('ground'); })[]; boss?: { id: string; kind: string; at: [number, number]; yaw: number; look?: string; }; attackers: (number) | null; think: ('legacy') | ({ every: number; dt: number; }); killY?: number; admission: 'prepare' | 'install'; placement?: { fallback: number; rows: ({ id: string; fromY: number; home: { x: number; z: number; r: number; y: number; }; })[]; }; holds?: ({ home: number; field: string; until: string; })[]; } & Record<string, unknown>; sources: 'actors' | 'actors+bosses'; seed: 'identity' | 'declared'; owner?: v.InferOutput<typeof BossOwnerRowSchema>; }; terrain: 'none' | 'collider'; floor?: 'solids'; ground: { size: number; height: number; }; player: { speed: number; lift?: number; at?: [number, number, number]; yaw?: number; }; motion?: { systemId: string; skipPrefix?: string; composition: { sim: { bindings: v.InferOutput<typeof ScriptBindingsSchema>; scriptTickDivisor: number; }; state: Pick<v.InferOutput<(typeof StateSchema.pipe)[0]>, 'shared' | 'player'>; }; rules: { fields: Record<string, [number, number]>; archetypes: (number)[]; events: (number)[]; maxEntities: number; }; permissions: ({ mover: string; flags: ({ name: string; bit: number; })[]; })[]; } & Record<string, unknown>; runtime: { weapon: { id: string; stowOnBoard?: boolean; questWorld?: boolean; worldReactionAction?: number; }; quest: { spots: ('metadata') | ({ interact: ({ id: string; x: number; y: number; z: number; radius: number; })[]; crack: ({ id: string; x: number; y: number; z: number; radius: number; })[]; }); crack?: boolean; }; columns?: boolean; entries?: { lanes: number; walk: number; start: number; maxTicks: number; ramp?: { at: number; run: number; height: number; stride: number; look: number; halfWidths: { north: number; east: number; south: number; west: number; }; }; }; }; }
98
+ export interface NativeRuntimeRecipeData { population: { rows: { program?: { species: ({ id: string; kind: string; label: string; variants: ({ id: string; label: string; weight: number; rarity: 'common' | 'uncommon' | 'rare' | 'legendary'; scale: [number, number]; } & Record<string, unknown>)[]; brain?: v.InferOutput<typeof SpeciesBrainSchema>; body?: v.InferOutput<typeof CreatureBodyRecipeSchema>; } & Record<string, unknown>)[]; strikes: (v.InferOutput<typeof CreatureStrikeSchema>)[]; modules?: Record<string, string>; }; step: string; seed: number; homes: ({ id: string; kind: string; at: [number, number]; yaw: number; respawn: number; look?: string; late?: (boolean) | ('ground'); })[]; boss?: { id: string; kind: string; at: [number, number]; yaw: number; look?: string; }; attackers: (number) | null; think: ('legacy') | ({ every: number; dt: number; }); killY?: number; admission: 'prepare' | 'install'; placement?: { fallback: number; rows: ({ id: string; fromY: number; home: { x: number; z: number; r: number; y: number; }; })[]; }; holds?: ({ home: number; field: string; until: string; })[]; } & Record<string, unknown>; sources: 'actors' | 'actors+bosses'; seed: 'identity' | 'declared'; owner?: v.InferOutput<typeof BossOwnerRowSchema>; }; terrain: 'none' | 'collider'; floor?: 'solids'; ground: { size: number; height: number; }; player: { speed: number; lift?: number; at?: [number, number, number]; yaw?: number; }; motion?: { systemId: string; skipPrefix?: string; composition: { sim: { bindings: v.InferOutput<typeof ScriptBindingsSchema>; scriptTickDivisor: number; }; state: Pick<v.InferOutput<(typeof StateSchema.pipe)[0]>, 'shared' | 'player'>; }; rules: { fields: Record<string, [number, number]>; archetypes: (number)[]; events: (number)[]; maxEntities: number; }; permissions: ({ mover: string; flags: ({ name: string; bit: number; })[]; })[]; } & Record<string, unknown>; runtime: { weapon: { id: string; stowOnBoard?: boolean; questWorld?: boolean; worldReactionAction?: number; }; quest: { spots: ('metadata') | ({ interact: ({ id: string; x: number; y: number; z: number; radius: number; })[]; crack: ({ id: string; x: number; y: number; z: number; radius: number; })[]; }); crack?: boolean; }; columns?: boolean; entries?: { lanes: number; walk: number; start: number; maxTicks: number; ramp?: { at: number; run: number; height: number; stride: number; look: number; halfWidths: { north: number; east: number; south: number; west: number; }; }; }; }; }
@@ -78,7 +78,9 @@ const SpeciesProgramSchema: v.GenericSchema<SpeciesProgramDataInput, SpeciesProg
78
78
  function readSpeciesProgram(input: unknown): SpeciesProgramData { return v.parse(SpeciesProgramSchema, input); }
79
79
 
80
80
  const names = v.pipe(v.array(id), v.maxLength(64));
81
- const tag = v.custom<`${string}.${string}`>(value => typeof value === 'string' && value.length <= 128 && /^[a-z][a-zA-Z0-9.-]*\.[a-zA-Z0-9.-]+$/u.test(value));
81
+ // A regex, not v.custom: a roster's hunt (actors/roster.json) projects to JSON Schema (ONE-FORMAT OF23e4).
82
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the regex is the template's law, as catalogueEconomy's tag
83
+ const tag = v.pipe(v.string(), v.maxLength(128), v.regex(/^[a-z][a-zA-Z0-9.-]*\.[a-zA-Z0-9.-]+$/u)) as v.GenericSchema<`${string}.${string}`>;
82
84
  const nativeFightFields = v.strictObject({ telegraphed: v.exactOptional(v.boolean()), attackers: v.exactOptional(v.pipe(positive, v.integer(), v.maxValue(1024))),
83
85
  maxHitDamage: v.exactOptional(nonnegative), capExempt: v.exactOptional(names), capExemptTags: v.exactOptional(IncomingCapTagsSchema),
84
86
  input: v.exactOptional(v.strictObject({ bufferMs: nonnegative, coyoteMs: nonnegative })) });