@wildshard/shard-format 0.65.0 → 0.66.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 +3 -1
- package/src/format/audio.ts +7 -1
- package/src/format/bossEncounter.ts +8 -0
- package/src/format/headless-sections.ts +2 -0
- package/src/format/items.ts +5 -3
- package/src/format/level-start-rows.ts +23 -0
- package/src/format/level-start.ts +195 -0
- package/src/format/minimap.ts +14 -9
- package/src/format/populationRoster.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.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": {
|
|
@@ -128,6 +128,8 @@
|
|
|
128
128
|
"./fur-strands": "./src/format/fur-strands.ts",
|
|
129
129
|
"./scene-render": "./src/format/scene-render.ts",
|
|
130
130
|
"./look-level": "./src/format/look-level.ts",
|
|
131
|
+
"./level-start": "./src/format/level-start.ts",
|
|
132
|
+
"./level-start-rows": "./src/format/level-start-rows.ts",
|
|
131
133
|
"./look-sky": "./src/format/look-sky.ts",
|
|
132
134
|
"./directorDocument": "./src/format/directorDocument.ts",
|
|
133
135
|
"./directorStages": "./src/format/directorStages.ts",
|
package/src/format/audio.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
import { LevelAudioSchema } from './level-start-rows.ts';
|
|
3
|
+
import type { LevelAudio } from './level-start-rows.ts';
|
|
2
4
|
import { VoicePatchesSchema, type VoicePatches } from './voicePatches.ts';
|
|
3
5
|
import { AudioSceneSchema, SampledAudioSceneSchema, type SampledAudioScene, type AudioScene } from './audioScene.ts';
|
|
4
6
|
import { isJsonData } from './json.ts';
|
|
@@ -62,7 +64,7 @@ const gameplay: v.GenericSchema<AudioGameplayInput, AudioGameplay> = v.pipe(v.st
|
|
|
62
64
|
|
|
63
65
|
const rawAudioSchema: v.GenericSchema<RawAudioRowsInput, RawAudioRows> = v.pipe(v.strictObject({ cues: v.pipe(v.array(v.strictObject({ id, voice: id })), v.maxLength(64), v.check((rows) => new Set(rows.map((row) => row.id)).size === rows.length, 'unique cue ids')),
|
|
64
66
|
sampledScene:v.exactOptional(SampledAudioSceneSchema),patches:v.exactOptional(VoicePatchesSchema),scene:v.exactOptional(AudioSceneSchema),sceneFile:v.exactOptional(id),entry:v.exactOptional(v.pipe(v.record(id,v.strictObject({wind:v.boolean(),score:v.boolean(),scene:v.exactOptional(v.boolean())})),v.check(rows=>Object.keys(rows).length<=4))), gameplay:v.exactOptional(gameplay), bank:v.exactOptional(AudioBankSchema), emitters:v.exactOptional(v.pipe(v.record(id,AudioLoopEmitterSchema),v.check(rows=>Object.keys(rows).length<=32))), playback:v.exactOptional(AudioPlaybackSchema), surfaces:v.exactOptional(AudioSurfaceSchema), loopGraphs:v.exactOptional(v.pipe(v.record(id,AudioLoopGraphSchema),v.check(rows=>Object.keys(rows).length<=32))), observations:v.exactOptional(v.pipe(v.array(AudioObservationSystemSchema),v.maxLength(16),v.check(rows=>new Set(rows.map(row=>row.id)).size===rows.length))), pcm:v.exactOptional(v.pipe(v.record(id,AudioPcmProgramSchema),v.check(rows=>Object.keys(rows).length<=64))), synth:v.exactOptional(v.pipe(v.record(id,AudioPhraseProgramSchema),v.check(rows=>Object.keys(rows).length<=32))), recordings: v.optional(recordings), music: v.optional(AudioMusicSchema), samples: v.optional(AudioSamplesSchema), zones: v.optional(AudioZonesSchema),
|
|
65
|
-
voiceBindings:v.exactOptional(AudioVoiceBindingsSchema), routing: v.optional(AudioRoutingSchema, []), ambience: v.nullable(v.strictObject({ phrases:v.exactOptional(v.pipe(v.array(AudioPhraseScheduleSchema),v.maxLength(8))), gust: v.exactOptional(gust), bed: id, winds: v.pipe(v.array(wind), v.minLength(1), v.maxLength(4)) })), score: v.picklist(['silent', 'default']) }),v.check(audio=>Object.values(audio.emitters??{}).every(row=>audio.loopGraphs?.[row.graph]!==undefined),'declared loop emitter graph'),v.check(audio=>Object.values(audio.bank?.families??{}).every(row=>row.source.kind!=='pcm'||audio.pcm?.[row.source.id]!==undefined)&&Object.values(audio.bank?.spatial??{}).every(row=>audio.synth?.[row.phrase]!==undefined),'declared voice bank programs'),v.check(audio=>audio.bank===undefined||(audio.playback!==undefined&&(audio.bank.barks===undefined||audio.bank.catalogue!==undefined)),'declared bank playback/catalogue'),v.check(audio=>audio.scene===undefined||audio.sceneFile===undefined,'Exclusive audio scene source'));
|
|
67
|
+
voiceBindings:v.exactOptional(AudioVoiceBindingsSchema), routing: v.optional(AudioRoutingSchema, []), ambience: v.nullable(v.strictObject({ phrases:v.exactOptional(v.pipe(v.array(AudioPhraseScheduleSchema),v.maxLength(8))), gust: v.exactOptional(gust), bed: id, winds: v.pipe(v.array(wind), v.minLength(1), v.maxLength(4)) })), score: v.picklist(['silent', 'default']), level: v.exactOptional(LevelAudioSchema) }),v.check(audio=>Object.values(audio.emitters??{}).every(row=>audio.loopGraphs?.[row.graph]!==undefined),'declared loop emitter graph'),v.check(audio=>Object.values(audio.bank?.families??{}).every(row=>row.source.kind!=='pcm'||audio.pcm?.[row.source.id]!==undefined)&&Object.values(audio.bank?.spatial??{}).every(row=>audio.synth?.[row.phrase]!==undefined),'declared voice bank programs'),v.check(audio=>audio.bank===undefined||(audio.playback!==undefined&&(audio.bank.barks===undefined||audio.bank.catalogue!==undefined)),'declared bank playback/catalogue'),v.check(audio=>audio.scene===undefined||audio.sceneFile===undefined,'Exclusive audio scene source'));
|
|
66
68
|
/** Validated audio data; voice ids are resolved only through the platform's admitted catalogue. */
|
|
67
69
|
export interface AudioData {
|
|
68
70
|
sampledScene?:SampledAudioScene;
|
|
@@ -93,6 +95,8 @@ export interface AudioData {
|
|
|
93
95
|
winds: v.InferOutput<typeof wind>[];
|
|
94
96
|
} | null;
|
|
95
97
|
score: 'silent' | 'default';
|
|
98
|
+
/** ONE-FORMAT OF9b3: the page's ambience, score and sample policy, as the level manifest carried them (`level-start.ts`). */
|
|
99
|
+
level?: LevelAudio;
|
|
96
100
|
}
|
|
97
101
|
/** The defining validator is unchanged; its public output is independently named. */
|
|
98
102
|
export const AudioDataSchema: v.GenericSchema<unknown, AudioData> = rawAudioSchema;
|
|
@@ -421,6 +425,7 @@ interface RawAudioRowsInputFields {
|
|
|
421
425
|
winds: (AudioWindRowsInput)[];
|
|
422
426
|
}) | null;
|
|
423
427
|
score: 'silent' | 'default';
|
|
428
|
+
level?: LevelAudio;
|
|
424
429
|
}
|
|
425
430
|
export type RawAudioRowsInput = { [Key in keyof RawAudioRowsInputFields]: RawAudioRowsInputFields[Key] };
|
|
426
431
|
interface RawAudioRowsFields {
|
|
@@ -459,5 +464,6 @@ interface RawAudioRowsFields {
|
|
|
459
464
|
winds: (AudioWindRows)[];
|
|
460
465
|
}) | null;
|
|
461
466
|
score: 'silent' | 'default';
|
|
467
|
+
level?: LevelAudio;
|
|
462
468
|
}
|
|
463
469
|
export type RawAudioRows = { [Key in keyof RawAudioRowsFields]: RawAudioRowsFields[Key] };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import { RoamingBossProfileSchema } from './bossProfiles.ts';
|
|
3
|
+
import { BorrowedDecisionSchema } from './decisionScripts.ts';
|
|
4
|
+
import type { BorrowedDecisionRows } from './decisionScripts.ts';
|
|
5
|
+
import { CreatureBodyRecipeSchema } from './creatures.ts';
|
|
6
|
+
import type { CreatureBodyRecipeRows } from './creatures.ts';
|
|
3
7
|
|
|
4
8
|
const finite = v.pipe(v.number(), v.minValue(-Number.MAX_VALUE), v.maxValue(Number.MAX_VALUE));
|
|
5
9
|
const positive = v.pipe(finite, v.minValue(Number.MIN_VALUE));
|
|
@@ -81,6 +85,8 @@ export function bossEncounterPresentation(input: unknown, encounter: { readonly
|
|
|
81
85
|
export const NativeBossBindingSchema: v.GenericSchema<NativeBossBindingInput, NativeBossBinding> = v.strictObject({ population: key,
|
|
82
86
|
weakPoint: v.strictObject({ radius: positive }),
|
|
83
87
|
reward: v.strictObject({ inventory: key, grants: v.pipe(v.array(v.strictObject({ item: key, count: v.pipe(finite, v.integer(), v.minValue(1)) })), v.maxLength(64)) }),
|
|
88
|
+
// ONE-FORMAT OF30: on a product with no species programme the boss's own decision brain and body recipe
|
|
89
|
+
decision: v.exactOptional(BorrowedDecisionSchema), body: v.exactOptional(CreatureBodyRecipeSchema),
|
|
84
90
|
});
|
|
85
91
|
|
|
86
92
|
|
|
@@ -350,5 +356,7 @@ interface NativeBossBindingFields {
|
|
|
350
356
|
count: number;
|
|
351
357
|
})[];
|
|
352
358
|
};
|
|
359
|
+
decision?: BorrowedDecisionRows;
|
|
360
|
+
body?: CreatureBodyRecipeRows;
|
|
353
361
|
}
|
|
354
362
|
export type NativeBossBinding = { [Key in keyof NativeBossBindingFields]: NativeBossBindingFields[Key] };
|
|
@@ -12,6 +12,8 @@ export const HEADLESS_CONTEXT_SECTIONS = [
|
|
|
12
12
|
'actors/moves',
|
|
13
13
|
'actors/strikes',
|
|
14
14
|
'world/targets',
|
|
15
|
+
// Races and personal vehicle locks need their docks in the worker too.
|
|
16
|
+
'world/vehicles',
|
|
15
17
|
'sim/runtime-plan',
|
|
16
18
|
'sim/bodies',
|
|
17
19
|
// The offline simulation reads the ordinary portal ride from this plan.
|
package/src/format/items.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { InputExtraSchema, inputExtraRules } from './inputDeclarations.ts';
|
|
|
2
2
|
import { BodyLaunchSchema, NativeLoadoutRowSchema, NativeRangedRowSchema } from './nativeItems.ts';
|
|
3
3
|
import { ClaimedPickupSchema, LootEconomySchema } from './lootEconomy.ts';
|
|
4
4
|
import * as v from 'valibot';
|
|
5
|
+
import { LevelLoadoutSchema } from './level-start-rows.ts';
|
|
6
|
+
import type { LevelLoadout } from './level-start-rows.ts';
|
|
5
7
|
import { MeleeContactsSchema, NativeMeleeRowSchema, WeaponProfileSchema, type MeleeContactRow } from './weaponProfiles.ts';
|
|
6
8
|
import { isJsonData } from './json.ts';
|
|
7
9
|
|
|
@@ -84,7 +86,7 @@ const raw: v.StrictObjectSchema<{ readonly version: v.GenericSchema<ShardItemsIn
|
|
|
84
86
|
pause: v.boolean(), sliceMs: v.exactOptional(v.pipe(finite, v.minValue(1), v.maxValue(1000))),
|
|
85
87
|
owners: v.pipe(v.array(v.strictObject({ item: weaponId, slot: v.picklist(['primary', 'rifle', 'secondary', 'extra']),
|
|
86
88
|
row: v.picklist(['native', 'declared']), presentation: v.exactOptional(v.boolean()) })), v.minLength(1), v.maxLength(16)),
|
|
87
|
-
})), native: v.exactOptional(NativeLoadoutRowSchema), inventory: v.exactOptional(inventory), primary: v.nullable(weaponId), secondary: v.nullable(weaponId), tools: v.pipe(v.array(toolId), v.maxLength(16)) }) });
|
|
89
|
+
})), native: v.exactOptional(NativeLoadoutRowSchema), inventory: v.exactOptional(inventory), primary: v.nullable(weaponId), secondary: v.nullable(weaponId), tools: v.pipe(v.array(toolId), v.maxLength(16)), level: v.exactOptional(LevelLoadoutSchema) }) });
|
|
88
90
|
/** Admit an item's JSON-only contacts without copying its original event-lifetime tag arrays. */
|
|
89
91
|
export function parseMeleeContacts(input: unknown): readonly MeleeContactRow[] {
|
|
90
92
|
v.assert(v.custom(isJsonData, 'JSON-only melee contacts'), input);
|
|
@@ -225,8 +227,8 @@ export interface ToolItemRowsInput { id: `tool.${string}`; kind: 'tool'; family:
|
|
|
225
227
|
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; }
|
|
226
228
|
export interface ItemAttackRowsInput { id: ItemFamilyNameRowsInput; damage: number; cooldown: number; range: number; width: number; tags: (`${string}.${string}`)[]; effect: (`effect.${string}`) | null; }
|
|
227
229
|
export interface ItemAttackRows { id: ItemFamilyNameRows; damage: number; cooldown: number; range: number; width: number; tags: (`${string}.${string}`)[]; effect: (`effect.${string}`) | null; }
|
|
228
|
-
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}`)[]; }; }
|
|
229
|
-
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}`)[]; }; }
|
|
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; }; }
|
|
230
232
|
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; }; }
|
|
231
233
|
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; }; }
|
|
232
234
|
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}`)[]; }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE-FORMAT OF9b3 (J365 (7)): the shapes of the page-start words the level manifest carried, for the sections they move
|
|
3
|
+
* to. `audio.level` takes the manifest's `audio` and `items.loadout.level` its `loadout`, each with the schema it had in
|
|
4
|
+
* the manifest (`ManifestMetadataSchema.entries`), so a value moves byte for byte. `level-start.ts` reads and lifts them.
|
|
5
|
+
*/
|
|
6
|
+
import { ManifestMetadataSchema } from './minimap.ts'
|
|
7
|
+
|
|
8
|
+
import type { ManifestMetadata } from './minimap.ts'
|
|
9
|
+
import type { GenericSchema } from 'valibot'
|
|
10
|
+
|
|
11
|
+
/** The page's ambience and score names, its catalogue flag, its alert rule and sample policy. */
|
|
12
|
+
type LevelAudio = NonNullable<ManifestMetadata['audio']>
|
|
13
|
+
/** The page's weapons, tools, the ones it starts holding, its held weapon and practice loans. */
|
|
14
|
+
type LevelLoadout = NonNullable<ManifestMetadata['loadout']>
|
|
15
|
+
|
|
16
|
+
const { entries } = ManifestMetadataSchema
|
|
17
|
+
const LevelAudioSchema: GenericSchema<LevelAudio, LevelAudio> =
|
|
18
|
+
entries.audio.wrapped
|
|
19
|
+
const LevelLoadoutSchema: GenericSchema<LevelLoadout, LevelLoadout> =
|
|
20
|
+
entries.loadout.wrapped
|
|
21
|
+
|
|
22
|
+
export { LevelAudioSchema, LevelLoadoutSchema }
|
|
23
|
+
export type { LevelAudio, LevelLoadout }
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/* oxlint-disable eslint/id-length, typescript/prefer-readonly-parameter-types -- a spawn's coordinates are x, y and z, as world/spawn and the manifest name them; plain JSON rows the caller owns */
|
|
2
|
+
/**
|
|
3
|
+
* The page-start words (ONE-FORMAT OF9b3, J365 (7)): where a page stands its player, what it arms and what it plays.
|
|
4
|
+
* The level manifest carried them (`spawn`, `loadout`, `weapon`, `audio`, `minimap.image`); since OF9b3 each lives in
|
|
5
|
+
* its section and a product's `ui/level` manifest has none of them:
|
|
6
|
+
*
|
|
7
|
+
* - `spawn` is `world/spawn`, the place the server already stands the player. A manifest spawn with no height (a page on
|
|
8
|
+
* terrain) keeps the section's height.
|
|
9
|
+
* - `loadout` is `combat/items`' `loadout.level`, and `audio` is `audio/audio`'s `level`, each in the manifest's own
|
|
10
|
+
* shape (`level-start-rows.ts`), byte for byte.
|
|
11
|
+
* - `weapon` (the old crossbow, sword or custom picker) and `minimap.image` have no reader left: `combat/items` arms the
|
|
12
|
+
* player and `look/map` carries the map image, so a lift drops them.
|
|
13
|
+
*
|
|
14
|
+
* `levelStart` reads the sections first and lifts an older manifest's words at the door; `liftLevelStart` moves them
|
|
15
|
+
* into the sections (a section's own value wins when both are present). Plain data, no three.js.
|
|
16
|
+
*/
|
|
17
|
+
import type { LevelAudio, LevelLoadout } from './level-start-rows.ts'
|
|
18
|
+
import type { ManifestMetadata } from './minimap.ts'
|
|
19
|
+
|
|
20
|
+
/** The five words a manifest carried before OF9b3. */
|
|
21
|
+
type StartField = 'spawn' | 'loadout' | 'weapon' | 'audio'
|
|
22
|
+
/** A manifest as the page start reads it: any of the words, or none. */
|
|
23
|
+
type StartManifest = Readonly<
|
|
24
|
+
Partial<Pick<ManifestMetadata, StartField>> & {
|
|
25
|
+
readonly minimap?: Readonly<Partial<ManifestMetadata['minimap']>>
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
/** A world spawn: the server's standing place. */
|
|
29
|
+
interface StartSpawn {
|
|
30
|
+
readonly x: number
|
|
31
|
+
readonly y: number
|
|
32
|
+
readonly z: number
|
|
33
|
+
readonly yaw: number
|
|
34
|
+
}
|
|
35
|
+
/** What the page start is read from: the three sections, and an optional manifest. */
|
|
36
|
+
interface LevelStartSource {
|
|
37
|
+
readonly spawn: StartSpawn
|
|
38
|
+
readonly audio: { readonly level?: LevelAudio }
|
|
39
|
+
readonly items: { readonly loadout: { readonly level?: LevelLoadout } }
|
|
40
|
+
readonly manifest?: StartManifest
|
|
41
|
+
}
|
|
42
|
+
/** A page's start: its spawn (no height on terrain), and its loadout and audio when it declares them. */
|
|
43
|
+
interface LevelStart {
|
|
44
|
+
readonly spawn: { x: number; y?: number; z: number; yaw: number }
|
|
45
|
+
readonly loadout?: LevelLoadout
|
|
46
|
+
readonly audio?: LevelAudio
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const START_FIELDS: readonly StartField[] = [
|
|
50
|
+
'spawn',
|
|
51
|
+
'loadout',
|
|
52
|
+
'weapon',
|
|
53
|
+
'audio',
|
|
54
|
+
]
|
|
55
|
+
/** `world/spawn`'s default, the value a shard that never set one carries. */
|
|
56
|
+
const DEFAULT_SPAWN: StartSpawn = Object.freeze({ x: 0, y: 2, z: 0, yaw: 0 })
|
|
57
|
+
|
|
58
|
+
/** Whether a world spawn is the default one (a shard that never declared `world/spawn`). */
|
|
59
|
+
function defaultSpawn(spawn: StartSpawn): boolean {
|
|
60
|
+
return (
|
|
61
|
+
spawn.x === DEFAULT_SPAWN.x &&
|
|
62
|
+
spawn.y === DEFAULT_SPAWN.y &&
|
|
63
|
+
spawn.z === DEFAULT_SPAWN.z &&
|
|
64
|
+
spawn.yaw === DEFAULT_SPAWN.yaw
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Whether a manifest still carries any page-start word (a product built before OF9b3). */
|
|
69
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
70
|
+
function manifestCarriesStart(manifest: StartManifest): boolean {
|
|
71
|
+
return (
|
|
72
|
+
START_FIELDS.some((field: StartField): boolean =>
|
|
73
|
+
Object.hasOwn(manifest, field),
|
|
74
|
+
) ||
|
|
75
|
+
(manifest.minimap !== undefined && Object.hasOwn(manifest.minimap, 'image'))
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The world spawn a manifest spawn stands on: its height when it has one, else the section's. */
|
|
80
|
+
function spawnFrom(
|
|
81
|
+
manifest: NonNullable<ManifestMetadata['spawn']>,
|
|
82
|
+
section: StartSpawn,
|
|
83
|
+
): StartSpawn {
|
|
84
|
+
return { ...manifest, y: manifest.y ?? section.y }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A world spawn with no height: a page on terrain stands the player on the ground. */
|
|
88
|
+
function groundSpawn(spawn: StartSpawn): LevelStart['spawn'] {
|
|
89
|
+
const { y: _height, ...ground } = spawn
|
|
90
|
+
return ground
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* A page's start: the manifest's words where an older product still carries them, else its sections'. `terrain` drops
|
|
95
|
+
* the section spawn's height, as a manifest spawn on terrain had none (the page stands the player on the ground there).
|
|
96
|
+
*/
|
|
97
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
98
|
+
function levelStart(source: LevelStartSource, terrain: boolean): LevelStart {
|
|
99
|
+
const manifest = source.manifest ?? {}
|
|
100
|
+
const spawn =
|
|
101
|
+
manifest.spawn ??
|
|
102
|
+
(terrain ? groundSpawn(source.spawn) : { ...source.spawn })
|
|
103
|
+
const loadout = source.items.loadout.level ?? manifest.loadout
|
|
104
|
+
const audio = source.audio.level ?? manifest.audio
|
|
105
|
+
return {
|
|
106
|
+
spawn,
|
|
107
|
+
...(loadout === undefined ? {} : { loadout }),
|
|
108
|
+
...(audio === undefined ? {} : { audio }),
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** A manifest without the page-start words. */
|
|
113
|
+
function withoutStart<Manifest extends StartManifest>(
|
|
114
|
+
manifest: Manifest,
|
|
115
|
+
): Omit<Manifest, StartField> {
|
|
116
|
+
const {
|
|
117
|
+
spawn: _spawn,
|
|
118
|
+
loadout: _loadout,
|
|
119
|
+
weapon: _weapon,
|
|
120
|
+
audio: _audio,
|
|
121
|
+
...rest
|
|
122
|
+
} = manifest
|
|
123
|
+
if (rest.minimap === undefined || !Object.hasOwn(rest.minimap, 'image')) {
|
|
124
|
+
return rest
|
|
125
|
+
}
|
|
126
|
+
const { image: _image, ...minimap } = rest.minimap
|
|
127
|
+
return { ...rest, minimap }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The door for a product built before OF9b3: the manifest's spawn moves into `world/spawn` (when the shard never set
|
|
132
|
+
* one), its loadout into `items.loadout.level` and its audio into `audio.level` (a section's own value wins), and its
|
|
133
|
+
* weapon and map image leave. A source with none of them comes back as it is (the same object).
|
|
134
|
+
*/
|
|
135
|
+
function liftLevelStart<Source extends LevelStartSource>(
|
|
136
|
+
source: Source,
|
|
137
|
+
): Source {
|
|
138
|
+
const { manifest } = source
|
|
139
|
+
if (manifest === undefined || !manifestCarriesStart(manifest)) {
|
|
140
|
+
return source
|
|
141
|
+
}
|
|
142
|
+
const spawn =
|
|
143
|
+
manifest.spawn !== undefined && defaultSpawn(source.spawn)
|
|
144
|
+
? spawnFrom(manifest.spawn, source.spawn)
|
|
145
|
+
: source.spawn
|
|
146
|
+
const loadout = source.items.loadout.level ?? manifest.loadout
|
|
147
|
+
const audio = source.audio.level ?? manifest.audio
|
|
148
|
+
return {
|
|
149
|
+
...source,
|
|
150
|
+
manifest: withoutStart(manifest),
|
|
151
|
+
spawn,
|
|
152
|
+
items:
|
|
153
|
+
loadout === undefined
|
|
154
|
+
? source.items
|
|
155
|
+
: {
|
|
156
|
+
...source.items,
|
|
157
|
+
loadout: { ...source.items.loadout, level: loadout },
|
|
158
|
+
},
|
|
159
|
+
audio:
|
|
160
|
+
audio === undefined ? source.audio : { ...source.audio, level: audio },
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** OF9b3's rule: a page-start word lives in its section or the manifest, never both. */
|
|
165
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
166
|
+
function levelStartRules(source: LevelStartSource): readonly string[] {
|
|
167
|
+
const { manifest } = source
|
|
168
|
+
if (manifest === undefined) {
|
|
169
|
+
return []
|
|
170
|
+
}
|
|
171
|
+
const rules: string[] = []
|
|
172
|
+
if (
|
|
173
|
+
source.items.loadout.level !== undefined &&
|
|
174
|
+
manifest.loadout !== undefined
|
|
175
|
+
) {
|
|
176
|
+
rules.push(
|
|
177
|
+
'items.loadout.level: the loadout lives in combat/items or the manifest, not both',
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
if (source.audio.level !== undefined && manifest.audio !== undefined) {
|
|
181
|
+
rules.push(
|
|
182
|
+
'audio.level: the audio lives in audio/audio or the manifest, not both',
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
return rules
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
DEFAULT_SPAWN,
|
|
190
|
+
levelStart,
|
|
191
|
+
levelStartRules,
|
|
192
|
+
liftLevelStart,
|
|
193
|
+
manifestCarriesStart,
|
|
194
|
+
}
|
|
195
|
+
export type { LevelStart, LevelStartSource, StartManifest, StartSpawn }
|
package/src/format/minimap.ts
CHANGED
|
@@ -268,7 +268,12 @@ const strings = v.pipe(v.array(text), v.maxLength(256));
|
|
|
268
268
|
const optionalFlag = v.exactOptional(v.boolean())
|
|
269
269
|
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()),
|
|
270
270
|
input: v.exactOptional(v.strictObject({bufferMs: number, coyoteMs: number}))});
|
|
271
|
-
|
|
271
|
+
/** ONE-FORMAT OF9b3: the page-start words, optional in the manifest since they live in their sections (`level-start.ts`). */
|
|
272
|
+
const levelAudio = v.strictObject({ambience: text, score: text, catalogue:v.exactOptional(v.literal(true)), alertOnlyHostile: v.exactOptional(v.boolean()), bed: v.exactOptional(text), samples: v.exactOptional(v.strictObject({loopGains: v.record(text, number), omitLoops: v.exactOptional(strings), omitShots: v.exactOptional(strings)}))});
|
|
273
|
+
const levelSpawn = v.strictObject({ x: number, y: v.exactOptional(number), z: number, yaw: number });
|
|
274
|
+
const weaponPicker = v.picklist(['crossbow', 'sword', 'custom']);
|
|
275
|
+
const mapImage = v.exactOptional(image);
|
|
276
|
+
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.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['audio'], undefined>, Exclude<ManifestMetadata['audio'], undefined>>, undefined>; 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.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['weapon'], undefined>, Exclude<ManifestMetadata['weapon'], undefined>>, undefined>; 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.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['spawn'], undefined>, Exclude<ManifestMetadata['spawn'], undefined>>, undefined>; readonly bounds: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['bounds'], undefined>, Exclude<ManifestMetadata['bounds'], undefined>>, undefined>; readonly sky: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['sky'], undefined>, Exclude<ManifestMetadata['sky'], undefined>>, undefined>; readonly atmosphere: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['atmosphere'], undefined>, Exclude<ManifestMetadata['atmosphere'], undefined>>, undefined>; readonly grade: v.ExactOptionalSchema<v.GenericSchema<Exclude<ManifestMetadataInput['grade'], undefined>, Exclude<ManifestMetadata['grade'], undefined>>, undefined>; 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({
|
|
272
277
|
bindings,
|
|
273
278
|
boot: v.exactOptional(v.strictObject({barrier: v.exactOptional(v.boolean()), cullBeforeFirstDraw: v.exactOptional(v.boolean()),
|
|
274
279
|
phone: v.exactOptional(v.strictObject({ deferExtras: v.exactOptional(v.boolean()), fragile: v.exactOptional(v.boolean()), trace: v.exactOptional(v.boolean()) })), viewmodelSets: v.exactOptional(v.pipe(v.array(v.picklist(['walnut', 'brushed-steel', 'leather', 'cord', 'bolt', 'anodised', 'polymer', 'gunmetal'])), v.maxLength(8))), shaders: v.exactOptional(v.strictObject({background: v.boolean()})), audio: v.exactOptional(strings), precache: strings, stagedWorld: v.exactOptional(v.boolean()),
|
|
@@ -295,24 +300,24 @@ export const ManifestMetadataSchema: v.StrictObjectSchema<{ readonly bindings: v
|
|
|
295
300
|
regionalSimCost: v.exactOptional(v.strictObject({residentMB: number, rev: text, device: text, evidence: text})),
|
|
296
301
|
spawns: v.exactOptional(v.pipe(v.array(v.strictObject({kind: text, count: number, variants: v.exactOptional(strings),
|
|
297
302
|
anchor: v.exactOptional(v.strictObject({x: number, z: number, rMin: number, rMax: number})), canopy: v.boolean(), trailBand: v.tuple([number, number])})), v.maxLength(256))),
|
|
298
|
-
audio: v.
|
|
303
|
+
audio: v.exactOptional(levelAudio),
|
|
299
304
|
api: v.literal(1), slug: v.pipe(text, v.regex(/^(?:_[a-z]+|[a-z][a-z0-9-]*)$/u)),
|
|
300
305
|
order: number, status: v.picklist(['live', 'experimental', 'earlyAccess', 'hidden']), shardSelect: v.exactOptional(v.boolean()),
|
|
301
306
|
name: text, label: text, seed: v.pipe(number, v.integer()),
|
|
302
307
|
biome: text, blurb: text, card: v.strictObject({ thumb: image, portrait: image, landscape: image }),
|
|
303
308
|
style: text, kitLook: v.picklist(['toon', 'painterly', 'pbr']), hands: v.exactOptional(v.picklist(['toon', 'pbr'])),
|
|
304
309
|
camera: v.exactOptional(v.strictObject({ portraitFov: v.pipe(v.number(), v.finite(), v.minValue(1), v.maxValue(179)) })),
|
|
305
|
-
weapon: v.
|
|
310
|
+
weapon: v.exactOptional(weaponPicker), treeCount: v.pipe(number, v.integer(), v.minValue(0)),
|
|
306
311
|
trees: v.strictObject({ factory: v.exactOptional(v.literal('none')), noun: text, bark: v.exactOptional(text), twigAtlas: v.exactOptional(text), set: v.exactOptional(text), treeSet: v.exactOptional(v.literal('world/trees')), drawnBy: v.exactOptional(v.literal('model')),
|
|
307
312
|
setVariants: v.exactOptional(v.array(v.strictObject({name: text, species: text, height: number, trunk: number, collider: number}))) }),
|
|
308
313
|
assetGlobs: v.pipe(v.array(text), v.maxLength(128)),
|
|
309
|
-
spawn: v.
|
|
314
|
+
spawn: v.exactOptional(levelSpawn),
|
|
310
315
|
bounds: v.exactOptional(v.strictObject({ x0: number, x1: number, z0: number, z1: number, floor: number })),
|
|
311
316
|
sky: v.exactOptional(LevelSkySchema),
|
|
312
317
|
atmosphere: v.exactOptional(LevelAtmosphereSchema),
|
|
313
318
|
grade: v.exactOptional(LevelGradeSchema),
|
|
314
319
|
horizon: v.exactOptional(LevelHorizonSchema),
|
|
315
|
-
minimap: v.strictObject({ image, openWater: v.exactOptional(v.strictObject({level: number, deepDepth: number})), outside: v.exactOptional(text) }),
|
|
320
|
+
minimap: v.strictObject({ image: mapImage, openWater: v.exactOptional(v.strictObject({level: number, deepDepth: number})), outside: v.exactOptional(text) }),
|
|
316
321
|
pois: v.pipe(v.array(v.strictObject({ id: text, name: text, x: number, z: number, r: v.exactOptional(number), respawn: optionalFlag })), v.maxLength(256)),
|
|
317
322
|
explore: v.strictObject({ art, compare: v.exactOptional(v.array(v.strictObject({id: text, label: text, model: v.pipe(v.string(), v.maxLength(512)), target: text, live: image, image}))) }),
|
|
318
323
|
captureProbes: v.exactOptional(v.array(v.strictObject({name: text, x: number, z: number, yaw: number, pitch: number}))),
|
|
@@ -646,7 +651,7 @@ export interface ManifestMetadataFields {
|
|
|
646
651
|
number
|
|
647
652
|
];
|
|
648
653
|
})[];
|
|
649
|
-
audio
|
|
654
|
+
audio?: {
|
|
650
655
|
ambience: string;
|
|
651
656
|
score: string;
|
|
652
657
|
catalogue?: true;
|
|
@@ -679,7 +684,7 @@ export interface ManifestMetadataFields {
|
|
|
679
684
|
camera?: {
|
|
680
685
|
portraitFov: number;
|
|
681
686
|
};
|
|
682
|
-
weapon
|
|
687
|
+
weapon?: 'crossbow' | 'sword' | 'custom';
|
|
683
688
|
treeCount: number;
|
|
684
689
|
trees: {
|
|
685
690
|
factory?: 'none';
|
|
@@ -698,7 +703,7 @@ export interface ManifestMetadataFields {
|
|
|
698
703
|
})[];
|
|
699
704
|
};
|
|
700
705
|
assetGlobs: (string)[];
|
|
701
|
-
spawn
|
|
706
|
+
spawn?: {
|
|
702
707
|
x: number;
|
|
703
708
|
y?: number;
|
|
704
709
|
z: number;
|
|
@@ -843,7 +848,7 @@ export interface ManifestMetadataFields {
|
|
|
843
848
|
cloudSea: boolean;
|
|
844
849
|
};
|
|
845
850
|
minimap: {
|
|
846
|
-
image
|
|
851
|
+
image?: string;
|
|
847
852
|
openWater?: {
|
|
848
853
|
level: number;
|
|
849
854
|
deepDepth: number;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import { LimbPopulationSchema } from './limbPopulation.ts';
|
|
3
|
+
import { NativeHuntSchema } from './speciesPrograms.ts';
|
|
4
|
+
import type { NativeHuntRows } from './speciesPrograms.ts';
|
|
3
5
|
|
|
4
6
|
const key = v.pipe(v.string(), v.minLength(1), v.maxLength(128));
|
|
5
7
|
const finite = v.pipe(v.number(), v.finite());
|
|
@@ -7,6 +9,11 @@ const count = v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(1024));
|
|
|
7
9
|
const point = v.strictObject({ x: finite, z: finite });
|
|
8
10
|
const identity = v.strictObject({ kind: key, variant: key });
|
|
9
11
|
const poseTriple=v.tuple([finite,finite,finite]);
|
|
12
|
+
const MAX_SPAWN_ONLY = 16;
|
|
13
|
+
const MAX_DECLARED_SPECIES = 256;
|
|
14
|
+
const spawnOnly = v.pipe(v.array(key), v.maxLength(MAX_SPAWN_ONLY));
|
|
15
|
+
const declaredRow = v.strictObject({ id: key, spawnOnly: v.exactOptional(spawnOnly) });
|
|
16
|
+
const declaredSpecies = v.pipe(v.array(declaredRow), v.maxLength(MAX_DECLARED_SPECIES));
|
|
10
17
|
/** Native pose recipes retain the complete ordered local joint hierarchy. */
|
|
11
18
|
export const TamingPoseFileSchema:v.GenericSchema<TamingPoseFileRows,TamingPoseFileRows>=v.strictObject({
|
|
12
19
|
poses:v.pipe(v.array(v.strictObject({kind:key,variant:key,pose:v.strictObject({
|
|
@@ -37,6 +44,10 @@ export const NativePopulationRowsSchema: v.GenericSchema<NativePopulationRowsInp
|
|
|
37
44
|
identities: v.array(identity), ordinary: v.record(key, v.array(key)),
|
|
38
45
|
reserves: v.array(v.strictObject({ kind: key, variant: v.nullable(key) })),
|
|
39
46
|
homes: v.array(v.strictObject({ ...identity.entries, x: finite, z: finite, stream: key })),
|
|
47
|
+
// ONE-FORMAT OF30: a roster on a product with no species programme names the declared species it runs, in its native
|
|
48
|
+
// registration order (a listed row's `spawnOnly` rows lend their variants as that kind's spawn-only variants), and its hunt
|
|
49
|
+
species: v.exactOptional(declaredSpecies),
|
|
50
|
+
hunt: v.exactOptional(NativeHuntSchema),
|
|
40
51
|
});
|
|
41
52
|
|
|
42
53
|
/** Admit once, before any native actor or RNG draw is installed. */
|
|
@@ -88,6 +99,8 @@ interface NativePopulationRowsInputFields {
|
|
|
88
99
|
kind: string;
|
|
89
100
|
variant: (string) | null;
|
|
90
101
|
})[];
|
|
102
|
+
species?: { id: string; spawnOnly?: string[] }[];
|
|
103
|
+
hunt?: NativeHuntRows;
|
|
91
104
|
homes: (Omit<{
|
|
92
105
|
kind: string;
|
|
93
106
|
variant: string;
|
|
@@ -142,6 +155,8 @@ interface NativePopulationRowsFields {
|
|
|
142
155
|
kind: string;
|
|
143
156
|
variant: (string) | null;
|
|
144
157
|
})[];
|
|
158
|
+
species?: { id: string; spawnOnly?: string[] }[];
|
|
159
|
+
hunt?: NativeHuntRows;
|
|
145
160
|
homes: (Omit<{
|
|
146
161
|
kind: string;
|
|
147
162
|
variant: string;
|