@wildshard/shard-format 0.13.0 → 0.15.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.13.0",
3
+ "version": "0.15.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": {
@@ -398,6 +398,7 @@
398
398
  "./worldScenes": "./src/format/worldScenes.ts",
399
399
  "./worldTargets": "./src/format/worldTargets.ts",
400
400
  "./worldUpdates": "./src/format/worldUpdates.ts",
401
+ "./incomingCapPolicy": "./src/format/incoming-cap-policy.ts",
401
402
  "./strikeDebris": "./src/format/strike-debris.ts",
402
403
  "./harvestRows": "./src/format/harvest-rows.ts"
403
404
  },
@@ -59,7 +59,8 @@ const phase = v.pipe(finite, v.minValue(-2 * Math.PI), v.maxValue(2 * Math.PI));
59
59
  /** Seconds after its death that a spawn's body comes back at its `at` (TEMPLATE-E2E TC-E2); absent, it stays dead. */
60
60
  const RESPAWN_MAX = 3600, RESPAWN_MIN = 1;
61
61
  const respawn = v.pipe(finite, v.minValue(RESPAWN_MIN), v.maxValue(RESPAWN_MAX));
62
- const spawn = v.strictObject({ phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: id, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
62
+ /** Social membership names no controller; the species temperament owns assistance. */
63
+ const spawn = v.strictObject({ group: v.exactOptional(id), phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: id, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
63
64
  /** Pure-data creature archetypes and stable spawn layouts, expanded before the local sim boots. */
64
65
  export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
65
66
  v.check((c) => creatureRules(c).length === 0, 'creature reference rules'));
@@ -164,8 +165,8 @@ export interface CreatureMemoryActionsRows { stateKey: string; states: (string)[
164
165
  export interface CreatureBodyRecipeRowsInput { actions?: CreatureMemoryActionsRowsInput; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
165
166
  export interface CreatureBodyRecipeRows { actions?: CreatureMemoryActionsRows; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
166
167
  // oxlint-disable-next-line typescript/consistent-type-definitions -- Valibot's readonly defaults need the alias's implicit dictionary compatibility.
167
- export type ShardCreaturesInput = { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined; spawns: ({ phaseOffset?: number | undefined; respawn?: number | undefined; home?: ShardCreatureHomeInput | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; };
168
- export interface ShardCreatures { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[]; spawns: ({ phaseOffset?: number | undefined; respawn?: number | undefined; home?: ShardCreatureHome | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; }
168
+ export type ShardCreaturesInput = { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined; spawns: ({ group?: string; phaseOffset?: number | undefined; respawn?: number | undefined; home?: ShardCreatureHomeInput | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; };
169
+ export interface ShardCreatures { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[]; spawns: ({ group?: string; phaseOffset?: number | undefined; respawn?: number | undefined; home?: ShardCreatureHome | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; }
169
170
  export type CreatureStrikeRowsInput = CreatureStrikeRows;
170
171
  export interface CreatureStrikeRows { debris?: StrikeDebrisPolicy; id: string; shape: ({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }); windup: number; active: number; recover: number; cooldown: number; range: (number) | null; damage: number; tags: (`${string}.${string}`)[]; weight: ({ kind: 'constant'; value: number; }) | ({ kind: 'horizontal-distance'; above: number; far: number; near: number; }); units?: 'world' | 'actor'; alternatives?: (({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }))[]; motion?: { speed?: number; delay?: number; track?: 'none' | 'lead' | 'follow'; overshoot?: number; skid?: number; }; eligibility?: { maxDy?: number; jumpDodges?: boolean; }; }
171
172
  export type CreatureStrikesInput = unknown;
@@ -0,0 +1,101 @@
1
+ import {
2
+ array,
3
+ check,
4
+ exactOptional,
5
+ maxLength,
6
+ minLength,
7
+ parse,
8
+ pipe,
9
+ strictObject,
10
+ string,
11
+ } from 'valibot'
12
+
13
+ import type { GenericSchema } from 'valibot'
14
+
15
+ /** Exact source tags that bypass the incoming cap; never wildcard patterns. */
16
+ interface IncomingCapPolicy {
17
+ readonly capExempt?: readonly string[]
18
+ readonly capExemptTags?: readonly string[]
19
+ }
20
+ const MAX_ALIASES = 256
21
+ const MAX_ALIAS_LENGTH = 512
22
+ const TAGS_PER_ALIAS = 2
23
+ const MAX_TAGS = MAX_ALIASES * TAGS_PER_ALIAS
24
+ const CREATURE_PREFIX = 'creature.'
25
+ const MIN_ALIAS_LENGTH = 1
26
+ const alias = pipe(
27
+ string(),
28
+ minLength(MIN_ALIAS_LENGTH),
29
+ maxLength(MAX_ALIAS_LENGTH),
30
+ )
31
+ const aliases = pipe(array(alias), maxLength(MAX_ALIASES))
32
+ const exactTag = pipe(
33
+ string(),
34
+ maxLength(MAX_ALIAS_LENGTH + CREATURE_PREFIX.length),
35
+ check((tag: string): boolean => tag.includes('.'), 'exact dotted combat tag'),
36
+ )
37
+ const exactTags = array(exactTag)
38
+ const IncomingCapTagsSchema: GenericSchema<string[]> = pipe(
39
+ exactTags,
40
+ maxLength(MAX_TAGS),
41
+ check<string[], 'unique exact combat tags'>(
42
+ (tags: readonly string[]): boolean => new Set(tags).size === tags.length,
43
+ 'unique exact combat tags',
44
+ ),
45
+ )
46
+
47
+ function lowerAliases(values: readonly string[]): string[] {
48
+ const tags = new Set<string>()
49
+ for (const value of values) {
50
+ if (value.includes('.')) {
51
+ tags.add(value)
52
+ }
53
+ tags.add(`${CREATURE_PREFIX}${value}`)
54
+ }
55
+ return [...tags]
56
+ }
57
+
58
+ /** Both fields may travel to older readers, but must describe identical behavior. */
59
+ function incomingCapPolicyAgrees(policy: IncomingCapPolicy): boolean {
60
+ if (policy.capExempt === undefined || policy.capExemptTags === undefined) {
61
+ return true
62
+ }
63
+ const expected = new Set(lowerAliases(policy.capExempt))
64
+ return (
65
+ expected.size === policy.capExemptTags.length &&
66
+ policy.capExemptTags.every((tag: string): boolean => expected.has(tag))
67
+ )
68
+ }
69
+ interface AdmittedIncomingCapPolicy {
70
+ capExempt?: string[]
71
+ capExemptTags?: string[]
72
+ }
73
+ const policyFields = strictObject({
74
+ capExempt: exactOptional(aliases),
75
+ capExemptTags: exactOptional(IncomingCapTagsSchema),
76
+ })
77
+ const policySchema: GenericSchema<AdmittedIncomingCapPolicy> = pipe(
78
+ policyFields,
79
+ check<
80
+ AdmittedIncomingCapPolicy,
81
+ 'matching legacy and exact incoming-cap policy'
82
+ >(incomingCapPolicyAgrees, 'matching legacy and exact incoming-cap policy'),
83
+ )
84
+
85
+ /** Compile once at admission. Request/state/effect tags still match exactly at hit time. */
86
+ function compileIncomingCapPolicy(policy: IncomingCapPolicy): string[] {
87
+ const admitted = parse(policySchema, {
88
+ ...(policy.capExempt === undefined ? {} : { capExempt: policy.capExempt }),
89
+ ...(policy.capExemptTags === undefined
90
+ ? {}
91
+ : { capExemptTags: policy.capExemptTags }),
92
+ })
93
+ return admitted.capExemptTags ?? lowerAliases(admitted.capExempt ?? [])
94
+ }
95
+
96
+ export {
97
+ IncomingCapTagsSchema,
98
+ compileIncomingCapPolicy,
99
+ incomingCapPolicyAgrees,
100
+ }
101
+ export type { IncomingCapPolicy }
@@ -1,3 +1,4 @@
1
+ import { IncomingCapTagsSchema, incomingCapPolicyAgrees } from './incoming-cap-policy.ts';
1
2
  import * as v from 'valibot';
2
3
 
3
4
  /**
@@ -245,6 +246,8 @@ const tier = v.objectWithRest({aa: v.exactOptional(v.picklist(['fxaa', 'smaa', '
245
246
  const strings = v.pipe(v.array(text), v.maxLength(256));
246
247
  /** A POI's respawn opt-out (TEMPLATE-E2E): `false` is no respawn place. */
247
248
  const optionalFlag = v.exactOptional(v.boolean())
249
+ const manifestFightFields = v.strictObject({maxHitDamage: v.exactOptional(number), capExempt: v.exactOptional(strings), capExemptTags: v.exactOptional(IncomingCapTagsSchema), attackers: v.exactOptional(v.union([number, v.literal('unbounded')])), telegraphed: v.exactOptional(v.boolean()),
250
+ input: v.exactOptional(v.strictObject({bufferMs: number, coyoteMs: number}))});
248
251
  export const ManifestMetadataSchema: v.StrictObjectSchema<{ readonly bindings: v.GenericSchema<ManifestMetadataInput['bindings'], ManifestMetadata['bindings']>; readonly boot: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['boot'], undefined>, Exclude<ManifestMetadata['boot'], undefined>>, undefined>; readonly gridShardfile: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['gridShardfile'], undefined>, Exclude<ManifestMetadata['gridShardfile'], undefined>>, undefined>; readonly shardfile: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['shardfile'], undefined>, Exclude<ManifestMetadata['shardfile'], undefined>>, undefined>; readonly ground: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['ground'], undefined>, Exclude<ManifestMetadata['ground'], undefined>>, undefined>; readonly groundColour: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['groundColour'], undefined>, Exclude<ManifestMetadata['groundColour'], undefined>>, undefined>; readonly world: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['world'], undefined>, Exclude<ManifestMetadata['world'], undefined>>, undefined>; readonly boundary: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['boundary'], undefined>, Exclude<ManifestMetadata['boundary'], undefined>>, undefined>; readonly cellGround: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['cellGround'], undefined>, Exclude<ManifestMetadata['cellGround'], undefined>>, undefined>; readonly hoverSpeedClass: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['hoverSpeedClass'], undefined>, Exclude<ManifestMetadata['hoverSpeedClass'], undefined>>, undefined>; readonly uses: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['uses'], undefined>, Exclude<ManifestMetadata['uses'], undefined>>, undefined>; readonly loadout: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['loadout'], undefined>, Exclude<ManifestMetadata['loadout'], undefined>>, undefined>; readonly species: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['species'], undefined>, Exclude<ManifestMetadata['species'], undefined>>, undefined>; readonly encounters: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['encounters'], undefined>, Exclude<ManifestMetadata['encounters'], undefined>>, undefined>; readonly fight: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['fight'], undefined>, Exclude<ManifestMetadata['fight'], undefined>>, undefined>; readonly creatures: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['creatures'], undefined>, Exclude<ManifestMetadata['creatures'], undefined>>, undefined>; readonly tiers: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['tiers'], undefined>, Exclude<ManifestMetadata['tiers'], undefined>>, undefined>; readonly loot: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['loot'], undefined>, Exclude<ManifestMetadata['loot'], undefined>>, undefined>; readonly hud: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['hud'], undefined>, Exclude<ManifestMetadata['hud'], undefined>>, undefined>; readonly bag: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['bag'], undefined>, Exclude<ManifestMetadata['bag'], undefined>>, undefined>; readonly regionalSimCost: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['regionalSimCost'], undefined>, Exclude<ManifestMetadata['regionalSimCost'], undefined>>, undefined>; readonly spawns: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['spawns'], undefined>, Exclude<ManifestMetadata['spawns'], undefined>>, undefined>; readonly audio: v.GenericSchema<ManifestMetadataInput['audio'], ManifestMetadata['audio']>; readonly api: v.GenericSchema<ManifestMetadataInput['api'], ManifestMetadata['api']>; readonly slug: v.GenericSchema<ManifestMetadataInput['slug'], ManifestMetadata['slug']>; readonly order: v.GenericSchema<ManifestMetadataInput['order'], ManifestMetadata['order']>; readonly status: v.GenericSchema<ManifestMetadataInput['status'], ManifestMetadata['status']>; readonly shardSelect: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['shardSelect'], undefined>, Exclude<ManifestMetadata['shardSelect'], undefined>>, undefined>; readonly name: v.GenericSchema<ManifestMetadataInput['name'], ManifestMetadata['name']>; readonly label: v.GenericSchema<ManifestMetadataInput['label'], ManifestMetadata['label']>; readonly seed: v.GenericSchema<ManifestMetadataInput['seed'], ManifestMetadata['seed']>; readonly biome: v.GenericSchema<ManifestMetadataInput['biome'], ManifestMetadata['biome']>; readonly blurb: v.GenericSchema<ManifestMetadataInput['blurb'], ManifestMetadata['blurb']>; readonly card: v.GenericSchema<ManifestMetadataInput['card'], ManifestMetadata['card']>; readonly style: v.GenericSchema<ManifestMetadataInput['style'], ManifestMetadata['style']>; readonly kitLook: v.GenericSchema<ManifestMetadataInput['kitLook'], ManifestMetadata['kitLook']>; readonly hands: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['hands'], undefined>, Exclude<ManifestMetadata['hands'], undefined>>, undefined>; readonly camera: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['camera'], undefined>, Exclude<ManifestMetadata['camera'], undefined>>, undefined>; readonly weapon: v.GenericSchema<ManifestMetadataInput['weapon'], ManifestMetadata['weapon']>; readonly treeCount: v.GenericSchema<ManifestMetadataInput['treeCount'], ManifestMetadata['treeCount']>; readonly trees: v.GenericSchema<ManifestMetadataInput['trees'], ManifestMetadata['trees']>; readonly assetGlobs: v.GenericSchema<ManifestMetadataInput['assetGlobs'], ManifestMetadata['assetGlobs']>; readonly spawn: v.GenericSchema<ManifestMetadataInput['spawn'], ManifestMetadata['spawn']>; readonly bounds: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['bounds'], undefined>, Exclude<ManifestMetadata['bounds'], undefined>>, undefined>; readonly sky: v.GenericSchema<ManifestMetadataInput['sky'], ManifestMetadata['sky']>; readonly atmosphere: v.GenericSchema<ManifestMetadataInput['atmosphere'], ManifestMetadata['atmosphere']>; readonly grade: v.GenericSchema<ManifestMetadataInput['grade'], ManifestMetadata['grade']>; readonly horizon: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['horizon'], undefined>, Exclude<ManifestMetadata['horizon'], undefined>>, undefined>; readonly minimap: v.GenericSchema<ManifestMetadataInput['minimap'], ManifestMetadata['minimap']>; readonly pois: v.GenericSchema<ManifestMetadataInput['pois'], ManifestMetadata['pois']>; readonly explore: v.GenericSchema<ManifestMetadataInput['explore'], ManifestMetadata['explore']>; readonly captureProbes: v.ExactOptionalSchema<v.ArraySchema<v.GenericSchema<Exclude<ManifestMetadataInput['captureProbes'], undefined>[number], Exclude<ManifestMetadata['captureProbes'], undefined>[number]>, undefined>, undefined>; readonly next: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['next'], undefined>, Exclude<ManifestMetadata['next'], undefined>>, undefined>; readonly debugOptions: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['debugOptions'], undefined>, Exclude<ManifestMetadata['debugOptions'], undefined>>, undefined>; readonly bodyShadow: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['bodyShadow'], undefined>, Exclude<ManifestMetadata['bodyShadow'], undefined>>, undefined>; readonly ocean: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['ocean'], undefined>, Exclude<ManifestMetadata['ocean'], undefined>>, undefined>; readonly blender: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['blender'], undefined>, Exclude<ManifestMetadata['blender'], undefined>>, undefined>; readonly horizonStrips: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['horizonStrips'], undefined>, Exclude<ManifestMetadata['horizonStrips'], undefined>>, undefined>; readonly assets: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['assets'], undefined>, Exclude<ManifestMetadata['assets'], undefined>>, undefined>; readonly look: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['look'], undefined>, Exclude<ManifestMetadata['look'], undefined>>, undefined>; readonly pondLilyExclusions: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['pondLilyExclusions'], undefined>, Exclude<ManifestMetadata['pondLilyExclusions'], undefined>>, undefined>; readonly faunaTuning: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['faunaTuning'], undefined>, Exclude<ManifestMetadata['faunaTuning'], undefined>>, undefined>; readonly forest: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['forest'], undefined>, Exclude<ManifestMetadata['forest'], undefined>>, undefined>; }, undefined> = v.strictObject({
249
252
  bindings,
250
253
  boot: v.exactOptional(v.strictObject({barrier: v.exactOptional(v.boolean()), cullBeforeFirstDraw: v.exactOptional(v.boolean()),
@@ -261,8 +264,7 @@ export const ManifestMetadataSchema: v.StrictObjectSchema<{ readonly bindings: v
261
264
  uses: v.exactOptional(v.pipe(v.array(v.picklist(['weather', 'dayCycle', 'bosses', 'elites', 'spawns', 'quests', 'swim', 'hover', 'explore', 'practice', 'coins', 'loot', 'compendium', 'feats', 'bag.pack'])), v.maxLength(64))),
262
265
  loadout: v.exactOptional(v.strictObject({weapons: strings, tools: strings, start: strings, held: v.exactOptional(text), loans: v.exactOptional(v.pipe(v.array(v.strictObject({id: text, in: v.literal('practice')})), v.maxLength(256), v.check(rows => new Set(rows.map(row => row.id)).size === rows.length, 'Unique practice loans'))), pickups: v.exactOptional(v.array(v.strictObject({id: text, at: text})))})),
263
266
  species: v.exactOptional(strings), encounters: v.exactOptional(strings),
264
- fight: v.exactOptional(v.strictObject({maxHitDamage: v.exactOptional(number), capExempt: v.exactOptional(strings), attackers: v.exactOptional(v.union([number, v.literal('unbounded')])), telegraphed: v.exactOptional(v.boolean()),
265
- input: v.exactOptional(v.strictObject({bufferMs: number, coyoteMs: number}))})),
267
+ fight: v.exactOptional(v.pipe(manifestFightFields, v.check<NonNullable<ManifestMetadata['fight']>, 'matching legacy and exact incoming-cap policy'>(incomingCapPolicyAgrees, 'matching legacy and exact incoming-cap policy'))),
266
268
  creatures: v.exactOptional(v.strictObject({lowPoly: v.boolean(), waitForModels: v.boolean(), furRim: v.boolean(), tintRange: number, oneMaterial: v.boolean()})),
267
269
  // `grid`: rows laid over each tier's while the page is a grid cell (G4; read when the level applies its row)
268
270
  tiers: v.exactOptional(v.strictObject({phone: v.exactOptional(tier), desktop: v.exactOptional(tier),
@@ -533,6 +535,7 @@ export interface ManifestMetadataFields {
533
535
  fight?: {
534
536
  maxHitDamage?: number;
535
537
  capExempt?: (string)[];
538
+ capExemptTags?: (string)[];
536
539
  attackers?: (number) | ('unbounded');
537
540
  telegraphed?: boolean;
538
541
  input?: {
@@ -1,3 +1,4 @@
1
+ import { IncomingCapTagsSchema, incomingCapPolicyAgrees } from './incoming-cap-policy.ts';
1
2
  import type { StrikeDebrisCatalogue } from './strike-debris.ts';
2
3
  import { strikeDebrisCatalogueRules } from './strike-debris.ts';
3
4
  import type { HarvestDrop, HarvestSpecies } from './harvest-rows.ts';
@@ -78,12 +79,13 @@ function readSpeciesProgram(input: unknown): SpeciesProgramData { return v.parse
78
79
 
79
80
  const names = v.pipe(v.array(id), v.maxLength(64));
80
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));
82
+ const nativeFightFields = v.strictObject({ telegraphed: v.exactOptional(v.boolean()), attackers: v.exactOptional(v.pipe(positive, v.integer(), v.maxValue(1024))),
83
+ maxHitDamage: v.exactOptional(nonnegative), capExempt: v.exactOptional(names), capExemptTags: v.exactOptional(IncomingCapTagsSchema),
84
+ input: v.exactOptional(v.strictObject({ bufferMs: nonnegative, coyoteMs: nonnegative })) });
81
85
  /** Settings for the existing native hunt and continuation owners; no callbacks or replacement clock. */
82
86
  const NativeHuntSchema: v.GenericSchema<NativeHuntRowsInput, NativeHuntRows> = v.strictObject({
83
87
  limit: v.pipe(positive, v.integer(), v.maxValue(1024)), player: v.picklist(['host', 'origin']),
84
- fight: v.strictObject({ telegraphed: v.exactOptional(v.boolean()), attackers: v.exactOptional(v.pipe(positive, v.integer(), v.maxValue(1024))),
85
- maxHitDamage: v.exactOptional(nonnegative), capExempt: v.exactOptional(names),
86
- input: v.exactOptional(v.strictObject({ bufferMs: nonnegative, coyoteMs: nonnegative })) }),
88
+ fight: v.pipe(nativeFightFields, v.check<NativeHuntRows['fight'], 'matching legacy and exact incoming-cap policy'>(incomingCapPolicyAgrees, 'matching legacy and exact incoming-cap policy')),
87
89
  tuning: v.exactOptional(v.record(id, optionalTuning)),
88
90
  bands: v.strictObject({ states: names, scripted: v.exactOptional(v.boolean()), legacyKinds: names }),
89
91
  hit: v.strictObject({ namespace: id, tags: v.pipe(v.array(tag), v.maxLength(32)) }), memoryFields: v.exactOptional(names),
@@ -105,7 +107,7 @@ interface SpeciesData { capExempt?: boolean; harvest?: HarvestDrop[]; id: string
105
107
  type SpeciesProgramDataInput = unknown;
106
108
  interface SpeciesProgramData { species: ({ brain?: v.InferOutput<typeof SpeciesBrainSchema>; body?: v.InferOutput<typeof CreatureBodyRecipeSchema>; } & SpeciesData)[]; strikes: (v.InferOutput<typeof CreatureStrikeSchema>)[]; modules?: Record<string, string>; }
107
109
  type NativeHuntRowsInput = NativeHuntRows;
108
- interface NativeHuntRows { limit: number; player: 'host' | 'origin'; fight: { telegraphed?: boolean; attackers?: number; maxHitDamage?: number; capExempt?: (string)[]; input?: { bufferMs: number; coyoteMs: number; }; }; tuning?: Record<string, { hp?: number; sightRange?: number; sightRangeGraze?: number; sightCone?: number; hearStill?: number; hearCrouch?: number; hearWalk?: number; hearSprint?: number; noticeRate?: number; forgetRate?: number; alertAt?: number; boltAt?: number; freezeMin?: number; freezeMax?: number; relaxAfter?: number; panicDist?: number; runSpeed?: number; trotSpeed?: number; fleeMinTime?: number; fleeUntil?: number; fleeUntilMax?: number; fleeMaxTime?: number; lookBack?: number; waryTime?: number; waryBoost?: number; herdAlertRadius?: number; herdBoltDelayMin?: number; herdBoltDelayMax?: number; impactSpook?: number; impactAlert?: number; stalk?: { detect: number; speed: number; giveUp: number; rechargeCd: number; huffMin: number; huffMax: number; roar: string; fleeBelowHp: number; fleeChance: number; }; }>; bands: { states: (string)[]; scripted?: boolean; legacyKinds: (string)[]; }; hit: { namespace: string; tags: (`${string}.${string}`)[]; }; memoryFields?: (string)[]; }
110
+ interface NativeHuntRows { limit: number; player: 'host' | 'origin'; fight: { telegraphed?: boolean; attackers?: number; maxHitDamage?: number; capExempt?: (string)[]; capExemptTags?: (string)[]; input?: { bufferMs: number; coyoteMs: number; }; }; tuning?: Record<string, { hp?: number; sightRange?: number; sightRangeGraze?: number; sightCone?: number; hearStill?: number; hearCrouch?: number; hearWalk?: number; hearSprint?: number; noticeRate?: number; forgetRate?: number; alertAt?: number; boltAt?: number; freezeMin?: number; freezeMax?: number; relaxAfter?: number; panicDist?: number; runSpeed?: number; trotSpeed?: number; fleeMinTime?: number; fleeUntil?: number; fleeUntilMax?: number; fleeMaxTime?: number; lookBack?: number; waryTime?: number; waryBoost?: number; herdAlertRadius?: number; herdBoltDelayMin?: number; herdBoltDelayMax?: number; impactSpook?: number; impactAlert?: number; stalk?: { detect: number; speed: number; giveUp: number; rechargeCd: number; huffMin: number; huffMax: number; roar: string; fleeBelowHp: number; fleeChance: number; }; }>; bands: { states: (string)[]; scripted?: boolean; legacyKinds: (string)[]; }; hit: { namespace: string; tags: (`${string}.${string}`)[]; }; memoryFields?: (string)[]; }
109
111
  type SpeciesProgramsInput = unknown;
110
112
  interface SpeciesPrograms { page: (SpeciesData)[]; native: (SpeciesData)[]; program?: SpeciesProgramData; spawns?: v.InferOutput<typeof SpawnTablesSchema>; hunt?: NativeHuntRows; }
111
113