@wildshard/shard-format 0.63.0 → 0.64.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.63.0",
3
+ "version": "0.64.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": {
@@ -20,7 +20,7 @@ export type NativeAssemblyFeature =
20
20
  | { host: 'ammunition'; step: string; refill: string } | { host: 'boss.ground'; encounter: NativeAssemblyRead; binding: unknown }
21
21
  | { host: 'quest.composition'; rows: NativeAssemblyRead; spots: NativeAssemblyRead; counters: NativeAssemblyRead; document?: NativeAssemblyRead; table?: NativeAssemblyRead;
22
22
  contracts?: NativeAssemblyRead; props?: NativeAssemblyRead; readSpots?: boolean; nativeFeats?: boolean; barter?: boolean; director?: boolean; restoring?: boolean }
23
- | { host: 'quest.chapter'; id: string; rows: NativeAssemblyRead; wake: NativeAssemblyRead; reward: unknown; population: string }
23
+ | { host: 'quest.chapter'; id: string; rows: NativeAssemblyRead; wake: NativeAssemblyRead; reward: unknown; population?: string }
24
24
  | { host: 'quest.kill-steps'; rows: NativeAssemblyRead; counters: NativeAssemblyRead }
25
25
  | { host: 'weather.program'; program: NativeAssemblyRead } | { host: 'weather.native'; program: NativeAssemblyRead; shelters: NativeAssemblyRead; rows: NativeAssemblyRead }
26
26
  | { host: 'population.environment' | 'population.shelter' | 'population.roster' | 'riding.groups'; rows: NativeAssemblyRead }
@@ -96,7 +96,9 @@ const feature = v.variant('host', [
96
96
  v.strictObject({ host: v.literal('ammunition'), step: key, refill: key }), v.strictObject({ host: v.literal('boss.ground'), encounter: read, binding: v.unknown() }),
97
97
  v.strictObject({ host: v.literal('quest.composition'), rows: read, spots: read, counters: read, document: v.exactOptional(read), table: v.exactOptional(read), contracts: v.exactOptional(read), props: v.exactOptional(read),
98
98
  readSpots: flag, nativeFeats: flag, barter: flag, director: flag, restoring: flag }),
99
- v.strictObject({ host: v.literal('quest.chapter'), id: key, rows: read, wake: read, reward: v.unknown(), population: key }),
99
+ // ONE-FORMAT OF22c3: a chapter's wake names a declared boss fight; `population` named the retired mixed population and
100
+ // stays optional only for writers that still send it
101
+ v.strictObject({ host: v.literal('quest.chapter'), id: key, rows: read, wake: read, reward: v.unknown(), population: v.exactOptional(key) }),
100
102
  v.strictObject({ host: v.literal('quest.kill-steps'), rows: read, counters: read }),
101
103
  v.strictObject({ host: v.literal('weather.program'), program: read }), v.strictObject({ host: v.literal('weather.native'), program: read, shelters: read, rows: read }),
102
104
  v.strictObject({ host: v.picklist(['population.environment', 'population.shelter', 'population.roster', 'riding.groups']), rows: read }),
@@ -58,8 +58,11 @@ const day = v.strictObject({ id, units: v.literal('hour'), start: hour,
58
58
  sun: v.strictObject({ maxElevation: v.pipe(finite, v.minValue(0), v.maxValue(90)), azimuthOffset: v.pipe(finite, v.minValue(-180), v.maxValue(180)) }),
59
59
  fixed: v.strictObject({ midday: hour, golden: hour, sunset: hour, night: hour }), presets: v.strictObject({ dawn: hour, noon: hour, dusk: hour, night: hour }) });
60
60
  const mods = v.strictObject({ speed: positive, chargeDist: positive, damageTaken: positive, chargeDamage: nonnegative, relentless: v.boolean() });
61
- const dims = v.strictObject({ bodyY: dimension, bodyHalfLen: dimension, bodyRadius: dimension, headRadius: dimension, legLen: legs,
62
- feet: v.pipe(v.array(v.tuple([finite, finite])), v.maxLength(16)), halfWidth: dimension });
61
+ // Body Y names the rig pivot. A flying hull can place it at zero.
62
+ const GROUND_PIVOT = 0;
63
+ const bodyPivot = v.union([v.literal(GROUND_PIVOT), dimension]);
64
+ const dims = v.strictObject({ bodyY: bodyPivot, bodyHalfLen: dimension, bodyRadius: dimension, headRadius: dimension, legLen: legs,
65
+ feet: v.pipe(v.array(v.tuple([finite, finite])), v.maxLength(16)), halfWidth: dimension, capsuleAxis: v.exactOptional(v.picklist(['y', 'z'])) });
63
66
  const variant = v.strictObject({ id, label: text, rarity: v.picklist(['common', 'uncommon', 'rare', 'legendary']), weight: nonnegative, scale: ordered, hp: positive, mods });
64
67
  const flight = v.strictObject({ altitude: v.pipe(finite, v.minValue(-250), v.maxValue(250)),
65
68
  above: v.exactOptional(v.picklist(['ground', 'world'])), climbRate: v.pipe(positive, v.maxValue(30)), diveRate: v.pipe(positive, v.maxValue(30)),
@@ -150,7 +153,7 @@ type ShardRows = { strikes: (StrikeRows)[]; weather: (({ id: string; states: ({
150
153
  type SpeciesRowInput = Omit<SpeciesRow, "abilities"> & { abilities?: CreatureAbilityInput[] };
151
154
 
152
155
  /** A species keeps its old fields, with optional explicit creature layers. */
153
- interface SpeciesRow extends CreatureLayers { capExempt?: boolean; harvest?: HarvestDrop[]; id: string; kind: string; label: string; aggressive: boolean; lockable: boolean; dims: { bodyY: number; bodyHalfLen: number; bodyRadius: number; headRadius: number; legLen: number; feet: ([number, number])[]; halfWidth: number; }; flight?: { altitude: number; above?: 'ground' | 'world'; climbRate: number; diveRate: number; lockRange?: number; bank?: number; }; variants: ({ id: string; label: string; rarity: 'common' | 'uncommon' | 'rare' | 'legendary'; weight: number; scale: [number, number]; hp: number; mods: { speed: number; chargeDist: number; damageTaken: number; chargeDamage: number; relentless: boolean; }; })[]; }
156
+ interface SpeciesRow extends CreatureLayers { capExempt?: boolean; harvest?: HarvestDrop[]; id: string; kind: string; label: string; aggressive: boolean; lockable: boolean; dims: { bodyY: number; bodyHalfLen: number; bodyRadius: number; headRadius: number; legLen: number; feet: ([number, number])[]; halfWidth: number; capsuleAxis?: 'y' | 'z'; }; flight?: { altitude: number; above?: 'ground' | 'world'; climbRate: number; diveRate: number; lockRange?: number; bank?: number; }; variants: ({ id: string; label: string; rarity: 'common' | 'uncommon' | 'rare' | 'legendary'; weight: number; scale: [number, number]; hp: number; mods: { speed: number; chargeDist: number; damageTaken: number; chargeDamage: number; relentless: boolean; }; })[]; }
154
157
 
155
158
  export { rowRules, RowsSchema, parseRows };
156
159
  export type { StrikeRowsInput, StrikeRows, ShardRowsInput, ShardRows, SpeciesRow };