@wildshard/shard-format 0.66.0 → 0.66.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.66.0",
3
+ "version": "0.66.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": {
@@ -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 })) });