@wildshard/shard-format 0.63.0 → 0.65.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.65.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": {
@@ -401,6 +401,7 @@
401
401
  "./viewProgram": "./src/format/viewProgram.ts",
402
402
  "./voicePatches": "./src/format/voicePatches.ts",
403
403
  "./water": "./src/format/water.ts",
404
+ "./waterField": "./src/format/water-field.ts",
404
405
  "./waterWaves": "./src/format/waterWaves.ts",
405
406
  "./waterWorld": "./src/format/waterWorld.ts",
406
407
  "./weaponProfiles": "./src/format/weaponProfiles.ts",
@@ -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 }),
@@ -81,6 +81,7 @@ const DATA_SECTION_NAMES: Readonly<Record<keyof PlatformDataSections, true>> = {
81
81
  "world/scenes": true,
82
82
  "world/trees": true,
83
83
  "world/vehicles": true,
84
+ 'world/field': true,
84
85
  };
85
86
  /** Exact public platform names; schema implementations stay on the checked side. */
86
87
  export function isPlatformDataSection(name: string): name is keyof PlatformDataSections {
@@ -33,6 +33,8 @@ import { ReturnModulesSchema, type ReturnModuleRow, ViewModulesSchema, type View
33
33
  import { NativeRuntimePlanSchema, type NativeRuntimePlanData } from './nativeRuntimePlan.ts';
34
34
  import { TreeSetSchema, type TreeSetRows } from './treeSetRows.ts';
35
35
  import { VehiclesSchema } from './vehicles.ts';
36
+ import { WaterFieldSchema } from './water-field.ts';
37
+ import type { WaterFieldRows } from './water-field.ts';
36
38
  import type { Vehicles } from './vehicles.ts';
37
39
 
38
40
  /** New plain-value sections supplement the unchanged v1 model assembled from the older section envelopes. */
@@ -70,6 +72,8 @@ export interface PlatformDataSections {
70
72
  'world/scenes': WorldScenesSection;
71
73
  'world/trees': TreeSetRows;
72
74
  'world/vehicles': Vehicles;
75
+ /** ONE-FORMAT OF40b: the field water (a pond raster at a level). */
76
+ 'world/field': WaterFieldRows;
73
77
  }
74
78
 
75
79
  /** Defining parsers for the first independently authored platform sections. */
@@ -107,6 +111,7 @@ export const PLATFORM_DATA_SECTIONS: Readonly<{ [Name in keyof PlatformDataSecti
107
111
  'world/scenes': { schema: WorldScenesSchema },
108
112
  'world/trees': { schema: TreeSetSchema },
109
113
  'world/vehicles': { schema: VehiclesSchema },
114
+ 'world/field': { schema: WaterFieldSchema },
110
115
  } as const;
111
116
 
112
117
  /** Client feature inputs that remain legacy root envelopes. These defining
@@ -197,7 +197,12 @@ const TABLE: readonly Primitive[] = [
197
197
  },
198
198
  hosts: ['water.sea', 'world.water'],
199
199
  },
200
- { name: 'water.field', row: 'OF40', on: 'later', hosts: ['water.field'] },
200
+ {
201
+ name: 'water.field',
202
+ row: 'OF40',
203
+ on: { section: 'world/field', path: [] },
204
+ hosts: ['water.field'],
205
+ },
201
206
  {
202
207
  name: 'grapple',
203
208
  row: 'OF41',
@@ -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 };
@@ -15,6 +15,7 @@ import type { ReturnModuleRow, ViewModuleRow } from './scriptContract.ts';
15
15
  import type { WorldScenesSection } from './worldScenes.ts';
16
16
  import type { TreeSetRows } from './treeSetRows.ts';
17
17
  import type { Vehicles } from './vehicles.ts';
18
+ import type { WaterFieldRows } from './water-field.ts';
18
19
  import type { HeldArmsRows } from './heldArms.ts';
19
20
  import type { HeldGearRows } from './heldGear.ts';
20
21
  import type { HeldFinishesRows } from './heldFinishes.ts';
@@ -91,6 +92,7 @@ export interface PlatformSections {
91
92
  'world/trees': TreeSetRows;
92
93
  /** MIRROR-SALT-ZONE MSZ1: vehicle kinds (seats, hull, handling, sounds) and the docks they stand at. */
93
94
  'world/vehicles': Vehicles;
95
+ 'world/field': WaterFieldRows;
94
96
  'world/days': { readonly rows: Pick<Rows, 'days'> };
95
97
  'world/weather': { readonly rows: Pick<Rows, 'weather'> };
96
98
  'look/look': Pick<Shardfile, 'look' | 'presentation'>;
@@ -0,0 +1,45 @@
1
+ import {
2
+ finite,
3
+ integer,
4
+ maxValue,
5
+ minValue,
6
+ number,
7
+ pipe,
8
+ strictObject,
9
+ } from 'valibot'
10
+
11
+ import { ShardHashSchema } from './shardSections.ts'
12
+
13
+ import type { GenericSchema } from 'valibot'
14
+
15
+ const LIMIT = 250
16
+ const MIN_RES = 2
17
+ const MAX_RES = 2048
18
+ const MAX_SIZE = 1000
19
+
20
+ /**
21
+ * ONE-FORMAT OF40b: the `water.field` primitive from a plain upload. A square f32 pond raster (`pond`: the hash of its
22
+ * zlib block, `res` samples a side over `size` metres, centred on the cell) whose positive samples are water standing at
23
+ * `level`, as Nalati's grass field's pond is. The bilinear sampling is the baked-terrain law.
24
+ */
25
+ interface WaterFieldRows {
26
+ level: number
27
+ res: number
28
+ size: number
29
+ pond: string
30
+ }
31
+ const WaterFieldSchema: GenericSchema<WaterFieldRows, WaterFieldRows> =
32
+ strictObject({
33
+ level: pipe(number(), finite(), minValue(-LIMIT), maxValue(LIMIT)),
34
+ res: pipe(number(), integer(), minValue(MIN_RES), maxValue(MAX_RES)),
35
+ size: pipe(
36
+ number(),
37
+ finite(),
38
+ minValue(Number.MIN_VALUE),
39
+ maxValue(MAX_SIZE),
40
+ ),
41
+ pond: ShardHashSchema,
42
+ })
43
+
44
+ export { WaterFieldSchema }
45
+ export type { WaterFieldRows }
@@ -229,6 +229,10 @@
229
229
  "world/trees": {
230
230
  "hosts": ["page productTreeSet", "page placeForestPageModels"]
231
231
  },
232
+ "world/field": {
233
+ "hosts": ["server bindShardfileSim"],
234
+ "note": "ONE-FORMAT OF40b: the field water a plain upload's server host stands the player in (engine `fieldWater`)."
235
+ },
232
236
  "world/vehicles": {
233
237
  "hosts": [],
234
238
  "note": "Read by the vehicle runtime (meta MIRROR-SALT-ZONE MSZ6 to MSZ9); until then the engine runs each dock as its steer carry (`vehicleCarryMovers`)."