@wildshard/shard-format 0.25.0 → 0.27.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 +4 -1
- package/src/format/actorMoves.ts +32 -0
- package/src/format/audio-mp4.ts +1 -1
- package/src/format/audioProfiles.ts +1 -1
- package/src/format/boot-memory-cost.ts +93 -2
- package/src/format/brains.ts +3 -3
- package/src/format/budget-tiers.ts +62 -0
- package/src/format/builtIndexes.ts +2 -2
- package/src/format/clientChannels.ts +3 -3
- package/src/format/clientScripts.ts +1 -1
- package/src/format/contentBounds.ts +1 -1
- package/src/format/contentCost.ts +2 -1
- package/src/format/creature-layers.ts +13 -1
- package/src/format/creature-ranks.ts +37 -0
- package/src/format/creature-sizes.ts +45 -4
- package/src/format/creature-volumes.ts +5 -4
- package/src/format/creatures.ts +20 -3
- package/src/format/crowds.ts +1 -1
- package/src/format/deviceMemoryCost.ts +2 -2
- package/src/format/directorStages.ts +3 -3
- package/src/format/flyers.ts +2 -2
- package/src/format/grazers.ts +2 -2
- package/src/format/items.ts +1 -1
- package/src/format/materialGraph.ts +7 -7
- package/src/format/materials.ts +10 -10
- package/src/format/memory-epoch.ts +1 -1
- package/src/format/memory-line.ts +48 -5
- package/src/format/memoryAdmission.ts +1 -1
- package/src/format/namedJsonContracts.ts +1 -1
- package/src/format/nativeGround.ts +3 -3
- package/src/format/navigation.ts +2 -2
- package/src/format/parsed-json.ts +91 -0
- package/src/format/placement-page-text.ts +281 -0
- package/src/format/questHost.ts +1 -1
- package/src/format/rows.ts +18 -5
- package/src/format/runtime-tier.ts +56 -0
- package/src/format/runtimeBinds.ts +6 -6
- package/src/format/runtimeCost.ts +1 -1
- package/src/format/runtimeSpawns.ts +2 -2
- package/src/format/scaledPostContract.ts +2 -2
- package/src/format/scriptAbi.ts +1 -1
- package/src/format/scriptWireV2.ts +1 -1
- package/src/format/shardSchema.ts +2 -2
- package/src/format/shardSections.ts +7 -1
- package/src/format/shardfile-assets.ts +9 -10
- package/src/format/shardfileValidation.ts +17 -11
- package/src/format/skin-file.ts +3 -0
- package/src/format/skinData.ts +39 -19
- package/src/format/skins.ts +21 -2
- package/src/format/sourceResidency.ts +1 -1
- package/src/format/standalone-catalogue.ts +1 -1
- package/src/format/terrain.ts +1 -1
- package/src/format/validationReceipt.ts +2 -2
- package/src/format/weaponProfiles.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.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": {
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"./bowVariantRows": "./src/format/bowVariantRows.ts",
|
|
78
78
|
"./brains": "./src/format/brains.ts",
|
|
79
79
|
"./budget": "./src/format/budget.ts",
|
|
80
|
+
"./budget-tiers": "./src/format/budget-tiers.ts",
|
|
80
81
|
"./buildings": "./src/format/buildings.ts",
|
|
81
82
|
"./builtIndexes": "./src/format/builtIndexes.ts",
|
|
82
83
|
"./catalogueEconomy": "./src/format/catalogueEconomy.ts",
|
|
@@ -304,6 +305,7 @@
|
|
|
304
305
|
"./rows": "./src/format/rows.ts",
|
|
305
306
|
"./runtime": "./src/format/runtime.ts",
|
|
306
307
|
"./runtimeBinds": "./src/format/runtimeBinds.ts",
|
|
308
|
+
"./runtime-tier": "./src/format/runtime-tier.ts",
|
|
307
309
|
"./runtimeCost": "./src/format/runtimeCost.ts",
|
|
308
310
|
"./runtimeSpawns": "./src/format/runtimeSpawns.ts",
|
|
309
311
|
"./scalarChannel": "./src/format/scalarChannel.ts",
|
|
@@ -405,6 +407,7 @@
|
|
|
405
407
|
"./worldSceneModels": "./src/format/worldSceneModels.ts",
|
|
406
408
|
"./worldScenePages": "./src/format/worldScenePages.ts",
|
|
407
409
|
"./worldScenePlacement": "./src/format/worldScenePlacement.ts",
|
|
410
|
+
"./placement-page-text": "./src/format/placement-page-text.ts",
|
|
408
411
|
"./worldSceneSlabs": "./src/format/worldSceneSlabs.ts",
|
|
409
412
|
"./worldSceneSurface": "./src/format/worldSceneSurface.ts",
|
|
410
413
|
"./worldSceneWeld": "./src/format/worldSceneWeld.ts",
|
package/src/format/actorMoves.ts
CHANGED
|
@@ -11,6 +11,14 @@ const turn = v.pipe(radius, v.maxValue(30));
|
|
|
11
11
|
const seconds = v.pipe(positive, v.maxValue(600));
|
|
12
12
|
const angle = v.pipe(finite, v.minValue(-2 * Math.PI), v.maxValue(2 * Math.PI));
|
|
13
13
|
const motion = { speed, turn, ground: v.optional(v.boolean(), false) };
|
|
14
|
+
/** CC17 leap: an arc to the target or a spot, peaking `height` metres above the start; `gravity` sets the time aloft. */
|
|
15
|
+
const LEAP_LIMIT = 100;
|
|
16
|
+
const EARTH_GRAVITY = 9.81;
|
|
17
|
+
const leapBound = v.pipe(positive, v.maxValue(LEAP_LIMIT));
|
|
18
|
+
const leapTarget = v.strictObject({ kind: v.literal('target') });
|
|
19
|
+
const leapSpot = v.strictObject({ kind: v.literal('spot'), spot: id });
|
|
20
|
+
const leapPoint = v.variant('kind', [leapTarget, leapSpot]);
|
|
21
|
+
const leap = v.strictObject({ id, kind: v.literal('leap'), to: leapPoint, height: leapBound, gravity: v.optional(leapBound, EARTH_GRAVITY) });
|
|
14
22
|
const ready = v.variant('kind', [
|
|
15
23
|
v.strictObject({ kind: v.literal('over'), radius: positive, height: positive }),
|
|
16
24
|
v.strictObject({ kind: v.literal('band'), tolerance: positive }),
|
|
@@ -41,6 +49,7 @@ export const ActorMoveSchema: v.GenericSchema<ActorMoveInput, ActorMove> = v.var
|
|
|
41
49
|
angularSpeed: v.optional(v.pipe(finite, v.minValue(-30), v.maxValue(30)), 0), closeRadius: v.optional(radius, 0), stopDistance: v.optional(radius, 0) }),
|
|
42
50
|
v.strictObject({ id, kind: v.literal('burrow'), field: id, rate: positive }),
|
|
43
51
|
v.strictObject({ id, kind: v.literal('surface'), field: id, rate: positive }),
|
|
52
|
+
leap,
|
|
44
53
|
]);
|
|
45
54
|
/** Plain `actors/moves` section, bounded and uniquely named. */
|
|
46
55
|
export const ActorMovesSchema: v.GenericSchema<unknown, ActorMoves> = v.pipe(v.unknown(), v.check(isJsonData, 'plain JSON move data'), v.array(ActorMoveSchema), v.maxLength(256),
|
|
@@ -62,6 +71,7 @@ export function actorMoveRules(rows: readonly ActorMove[], refs: { spots: Readon
|
|
|
62
71
|
if (row.kind === 'stalk' && row.ready.kind === 'range' && row.ready.strike !== undefined && !refs.strikes.has(row.ready.strike)) failures.add('move range resolves in actors/strikes');
|
|
63
72
|
if (row.kind === 'dive' && row.strike !== undefined && !refs.strikes.has(row.strike)) failures.add('move strike resolves in actors/strikes');
|
|
64
73
|
if ((row.kind === 'burrow' || row.kind === 'surface') && !refs.fields.has(row.field)) failures.add('move field resolves in declared actor fields');
|
|
74
|
+
if (row.kind === 'leap' && row.to.kind === 'spot' && !refs.spots.has(row.to.spot)) { failures.add('move location resolves in world spots'); }
|
|
65
75
|
}
|
|
66
76
|
return [...failures];
|
|
67
77
|
}
|
|
@@ -339,6 +349,17 @@ export type ActorMoveInput = (Omit<Omit<{
|
|
|
339
349
|
kind: 'surface';
|
|
340
350
|
field: string;
|
|
341
351
|
rate: number;
|
|
352
|
+
}) | ({
|
|
353
|
+
id: string;
|
|
354
|
+
kind: 'leap';
|
|
355
|
+
to: ({
|
|
356
|
+
kind: 'target';
|
|
357
|
+
}) | ({
|
|
358
|
+
kind: 'spot';
|
|
359
|
+
spot: string;
|
|
360
|
+
});
|
|
361
|
+
height: number;
|
|
362
|
+
gravity?: number | undefined;
|
|
342
363
|
});
|
|
343
364
|
export type ActorMove = (Omit<Omit<{
|
|
344
365
|
id: string;
|
|
@@ -612,4 +633,15 @@ export type ActorMove = (Omit<Omit<{
|
|
|
612
633
|
kind: 'surface';
|
|
613
634
|
field: string;
|
|
614
635
|
rate: number;
|
|
636
|
+
}) | ({
|
|
637
|
+
id: string;
|
|
638
|
+
kind: 'leap';
|
|
639
|
+
to: ({
|
|
640
|
+
kind: 'target';
|
|
641
|
+
}) | ({
|
|
642
|
+
kind: 'spot';
|
|
643
|
+
spot: string;
|
|
644
|
+
});
|
|
645
|
+
height: number;
|
|
646
|
+
gravity: number;
|
|
615
647
|
});
|
package/src/format/audio-mp4.ts
CHANGED
|
@@ -162,7 +162,7 @@ function mediaSeconds(source: Readonly<Bytes>, mdhd: number): number {
|
|
|
162
162
|
return scale === NONE ? NONE : frames / scale
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
/** The packet count and bytes from `stsz`; a count is never
|
|
165
|
+
/** The packet count and bytes from `stsz`; a count is never host-owned past the box's own bytes. */
|
|
166
166
|
function packets(
|
|
167
167
|
source: Readonly<Bytes>,
|
|
168
168
|
stsz: number,
|
|
@@ -289,7 +289,7 @@ export interface AudioAmbienceRouting { probes?: ({ kind: 'bounds'; id: string;
|
|
|
289
289
|
prewarmMissing?: boolean; list: { id: string; ir: string; weight: string; level: AudioMixExpr; feeds?:
|
|
290
290
|
string[]; }[]; }; zoneNames: string[]; samples?: { startDelay: number; tap: string; beds: { id: string; out:
|
|
291
291
|
string; panned: boolean; }[]; }; activeGains?: [ string, string | number ][]; }
|
|
292
|
-
/** Bounded zone/mixer data. Terrain, moving emitters and bespoke synthesis remain
|
|
292
|
+
/** Bounded zone/mixer data. Terrain, moving emitters and bespoke synthesis remain native runtime ports. */
|
|
293
293
|
/** Sampled loop levels and seeded distant calls; native mixers own playback. */
|
|
294
294
|
const sampleInterval = v.pipe(v.tuple([v.pipe(finite,v.minValue(0),v.maxValue(600)),v.pipe(finite,v.minValue(0),v.maxValue(600))]),v.check(row=>row[0]<=row[1]));
|
|
295
295
|
export const AudioSampleMixSchema: v.GenericSchema<AudioSampleMix> = v.pipe(v.strictObject({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { controlFileHashes } from './admissionControl.ts'
|
|
2
2
|
import { textureMipBytes } from './contentBounds.ts'
|
|
3
3
|
import { spawnViewSceneFiles } from './spawnView.ts'
|
|
4
|
+
import { parseImageAsset } from './stillImage.ts'
|
|
4
5
|
import { parseWorldScenes, worldScenesForTier } from './worldScenes.ts'
|
|
5
6
|
|
|
6
7
|
import type { Shardfile } from './shardSchema.ts'
|
|
@@ -13,6 +14,12 @@ interface BootMemoryCosts {
|
|
|
13
14
|
readonly farSlabIndices: number
|
|
14
15
|
readonly paintArrayGpu: number
|
|
15
16
|
readonly paintArrayStaging: number
|
|
17
|
+
/** MG6 epoch 3: the boot's CPU side as the phone-tier probe's renderer holds it (boot-phone.ts). */
|
|
18
|
+
readonly renderer?: number
|
|
19
|
+
/** MG6 epoch 3: a runtime home's paired Simulator WebContent + GL reading, whole (not less its pre-entry set). */
|
|
20
|
+
readonly runtimeReading?: number
|
|
21
|
+
/** MG6 epoch 3: `bootPhoneBytes` of the two above, the floor the loading estimate never goes under. */
|
|
22
|
+
readonly phoneFloor?: number
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
const NO_BYTES = 0
|
|
@@ -24,6 +31,18 @@ const BASE_LEVEL = 1
|
|
|
24
31
|
// MG6: Nine's cold phone-tier shader step rose by 193 MB in the mini's
|
|
25
32
|
// Chromium capture (04d76bcf). The calibrated increment rounds to 168 MB.
|
|
26
33
|
const SHADER_COMPILE_BYTES = 168_000_000
|
|
34
|
+
/** MG6 epoch 3 (mini-estcal, 2026-11-17): the phone-tier probe's loading renderer on an empty product (Ink Cel, Pastel,
|
|
35
|
+
* Template, Open Plots read 368-424 MB on the v0.1.36 client, engine probe `3cd2dd87`), rounded up to cover Brasscap
|
|
36
|
+
* and Sunscar. Lower it when the engine's own boot gets cheaper (mini-ninemem2). */
|
|
37
|
+
const RENDERER_FLOOR_BYTES = 420_000_000
|
|
38
|
+
const MB = 1_000_000
|
|
39
|
+
/** MG6 epoch 3: the phone is the probe's loading renderer x2.0 (engine `3cd2dd87`, the floor from Jake's v0.1.36
|
|
40
|
+
* iPhone crash). */
|
|
41
|
+
const PHONE_PER_RENDERER = 2
|
|
42
|
+
/** MG6 epoch 3: the probe's phone over a runtime home's paired Simulator WebContent + GL reading. Nalati 2,239 / 904 MB
|
|
43
|
+
* = 2.48, Pine 2,076 / 850 MB = 2.44 (Driftwood 2.12; Nine's reading is stale). */
|
|
44
|
+
const PHONE_PER_RUNTIME_READING = 2.5
|
|
45
|
+
const IMAGE_MOUNT = /\.(?:webp|png|jpe?g)$/u
|
|
27
46
|
|
|
28
47
|
function spawnMemoryCosts(
|
|
29
48
|
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
@@ -101,23 +120,95 @@ function paintArrayBytes(
|
|
|
101
120
|
return { paintArrayGpu, paintArrayStaging }
|
|
102
121
|
}
|
|
103
122
|
|
|
104
|
-
/**
|
|
123
|
+
/** MG6 epoch 3: what the probe's renderer holds at the boot peak beyond its empty-product floor. Each client file's
|
|
124
|
+
* downloaded bytes, its CPU-decoded form (decoded audio is left out: a boot decodes only its sample set, and Nine and
|
|
125
|
+
* Open Plots decode none), the commons the same way, and the engine images the cook mounts (Far Reach's sky and
|
|
126
|
+
* terrain textures: 107 MB of decoded bitmaps measured against 105 MB charged). */
|
|
127
|
+
function rendererBytes(
|
|
128
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
129
|
+
shard: Shardfile,
|
|
130
|
+
mountedImages: number,
|
|
131
|
+
): number {
|
|
132
|
+
let bytes = RENDERER_FLOOR_BYTES + mountedImages
|
|
133
|
+
for (const file of shard.files) {
|
|
134
|
+
bytes += file.compressed + (file.kind === 'audio' ? NO_BYTES : file.decoded)
|
|
135
|
+
}
|
|
136
|
+
for (const wire of Object.values(shard.requires.commonsWire)) {
|
|
137
|
+
bytes += wire
|
|
138
|
+
}
|
|
139
|
+
for (const row of Object.values(shard.requires.commonsCosts)) {
|
|
140
|
+
bytes += row.decoded
|
|
141
|
+
}
|
|
142
|
+
return bytes
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** MG6 epoch 3: a runtime home's paired reading, whole. */
|
|
146
|
+
function runtimeReadingBytes(
|
|
147
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
148
|
+
shard: Shardfile,
|
|
149
|
+
): number {
|
|
150
|
+
const cost = shard.runtime?.cost
|
|
151
|
+
return cost === undefined
|
|
152
|
+
? NO_BYTES
|
|
153
|
+
: Math.ceil((cost.webContentMB + cost.glMB) * MB)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** The decoded bytes of one mounted engine image the cook serves beside the product; zero for any other mount. A
|
|
157
|
+
* mount that does not parse as a still image is charged at its own size. */
|
|
158
|
+
function mountedImageBytes(path: string, bytes: Readonly<Uint8Array>): number {
|
|
159
|
+
if (!IMAGE_MOUNT.test(path)) {
|
|
160
|
+
return NO_BYTES
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
return parseImageAsset(bytes).decoded
|
|
164
|
+
} catch {
|
|
165
|
+
return bytes.length
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** MG6 epoch 3: the boot's phone floor, from the renderer side and from a runtime home's own reading. */
|
|
170
|
+
function bootPhoneBytes(
|
|
171
|
+
boot: Readonly<Pick<BootMemoryCosts, 'renderer' | 'runtimeReading'>>,
|
|
172
|
+
): number {
|
|
173
|
+
return Math.ceil(
|
|
174
|
+
Math.max(
|
|
175
|
+
PHONE_PER_RENDERER * (boot.renderer ?? NO_BYTES),
|
|
176
|
+
PHONE_PER_RUNTIME_READING * (boot.runtimeReading ?? NO_BYTES),
|
|
177
|
+
),
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Boot memory that sits outside the steady-state file and tile budgets. `mountedImages` is the decoded size of the
|
|
182
|
+
* engine images the cook mounts (`mountedImageBytes`), when the caller has the product's mounts. */
|
|
105
183
|
function bootMemoryCosts(
|
|
106
184
|
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
107
185
|
shard: Shardfile,
|
|
108
186
|
sections: ReadonlyMap<string, unknown>,
|
|
187
|
+
mountedImages: number = NO_BYTES,
|
|
109
188
|
): BootMemoryCosts {
|
|
110
189
|
const rawScene = sections.get('world/scenes')
|
|
111
190
|
const scene =
|
|
112
191
|
rawScene === undefined
|
|
113
192
|
? undefined
|
|
114
193
|
: worldScenesForTier(parseWorldScenes(rawScene), 'phone')
|
|
194
|
+
const renderer = rendererBytes(shard, mountedImages)
|
|
195
|
+
const runtimeReading = runtimeReadingBytes(shard)
|
|
115
196
|
return {
|
|
116
197
|
...spawnMemoryCosts(shard, sections),
|
|
117
198
|
shaderCompile: SHADER_COMPILE_BYTES,
|
|
118
199
|
farSlabIndices: farSlabBytes(shard.files, scene),
|
|
119
200
|
...paintArrayBytes(scene),
|
|
201
|
+
renderer,
|
|
202
|
+
runtimeReading,
|
|
203
|
+
phoneFloor: bootPhoneBytes({ renderer, runtimeReading }),
|
|
120
204
|
}
|
|
121
205
|
}
|
|
122
206
|
|
|
123
|
-
export {
|
|
207
|
+
export {
|
|
208
|
+
type BootMemoryCosts,
|
|
209
|
+
bootMemoryCosts,
|
|
210
|
+
bootPhoneBytes,
|
|
211
|
+
mountedImageBytes,
|
|
212
|
+
NO_BYTES,
|
|
213
|
+
RENDERER_FLOOR_BYTES,
|
|
214
|
+
}
|
package/src/format/brains.ts
CHANGED
|
@@ -31,10 +31,10 @@ export const ScriptBrainSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<
|
|
|
31
31
|
}), v.check(row => new Set(row.strikes.map(strike => strike.event)).size === row.strikes.length, 'Unique declared brain strike events'));
|
|
32
32
|
/** Validated script policy; only named admitted strikes may be requested and motion stays within its declared bounds. */
|
|
33
33
|
|
|
34
|
-
/** Validate a custom policy before module admission,
|
|
34
|
+
/** Validate a custom policy before module admission, native actor binding or physics allocation. */
|
|
35
35
|
export function parseScriptBrain(data: unknown): ShardScriptBrain { return v.parse(ScriptBrainSchema, data); }
|
|
36
36
|
|
|
37
|
-
/** Interior guardian policy; native floor and rise/sink recipes publish completion through
|
|
37
|
+
/** Interior guardian policy; native floor and rise/sink recipes publish completion through native ports. */
|
|
38
38
|
export const GuardianSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{ readonly id: v.GenericSchema<ShardGuardianInput['id'], ShardGuardian['id']>; readonly kind: v.GenericSchema<ShardGuardianInput['kind'], ShardGuardian['kind']>; readonly thinkDivisor: v.OptionalSchema<v.GenericSchema<Exclude<ShardGuardianInput['thinkDivisor'], undefined>, Exclude<ShardGuardian['thinkDivisor'], undefined>>, 6>; readonly wakeRadius: v.GenericSchema<ShardGuardianInput['wakeRadius'], ShardGuardian['wakeRadius']>; readonly guardRadius: v.GenericSchema<ShardGuardianInput['guardRadius'], ShardGuardian['guardRadius']>; readonly approachRadius: v.GenericSchema<ShardGuardianInput['approachRadius'], ShardGuardian['approachRadius']>; readonly swingRadius: v.GenericSchema<ShardGuardianInput['swingRadius'], ShardGuardian['swingRadius']>; readonly swingDuration: v.GenericSchema<ShardGuardianInput['swingDuration'], ShardGuardian['swingDuration']>; readonly speed: v.GenericSchema<ShardGuardianInput['speed'], ShardGuardian['speed']>; readonly holdRadius: v.GenericSchema<ShardGuardianInput['holdRadius'], ShardGuardian['holdRadius']>; readonly sideSpeed: v.GenericSchema<ShardGuardianInput['sideSpeed'], ShardGuardian['sideSpeed']>; readonly sideFlipSeconds: v.GenericSchema<ShardGuardianInput['sideFlipSeconds'], ShardGuardian['sideFlipSeconds']>; readonly sinkAfterSeconds: v.GenericSchema<ShardGuardianInput['sinkAfterSeconds'], ShardGuardian['sinkAfterSeconds']>; readonly cooldownSeconds: v.GenericSchema<ShardGuardianInput['cooldownSeconds'], ShardGuardian['cooldownSeconds']>; readonly hideOffset: v.GenericSchema<ShardGuardianInput['hideOffset'], ShardGuardian['hideOffset']>; readonly noticeCue: v.GenericSchema<ShardGuardianInput['noticeCue'], ShardGuardian['noticeCue']>; }, undefined>, v.CheckAction<{ [K in keyof ShardGuardian]: ShardGuardian[K] }, 'Ordered guardian radii'>]> = v.pipe(v.strictObject({
|
|
39
39
|
id: key, kind: v.literal('guardian'), thinkDivisor: cadence, wakeRadius: radius, guardRadius: radius, approachRadius: radius,
|
|
40
40
|
swingRadius: radius, swingDuration: v.pipe(duration, v.minValue(Number.MIN_VALUE)),
|
|
@@ -48,7 +48,7 @@ export const GuardianSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{ r
|
|
|
48
48
|
/** Validate guardian decisions before selecting the existing native motion and strike recipes. */
|
|
49
49
|
export function parseGuardian(data: unknown): ShardGuardian { return v.parse(GuardianSchema, data); }
|
|
50
50
|
|
|
51
|
-
/** Perch hunting decisions; native perch selection, vertical completion and shared attack RNG remain
|
|
51
|
+
/** Perch hunting decisions; native perch selection, vertical completion and shared attack RNG remain native host ports. */
|
|
52
52
|
export const PerchHunterSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{ readonly id: v.GenericSchema<ShardPerchHunterInput['id'], ShardPerchHunter['id']>; readonly kind: v.GenericSchema<ShardPerchHunterInput['kind'], ShardPerchHunter['kind']>; readonly thinkDivisor: v.OptionalSchema<v.GenericSchema<Exclude<ShardPerchHunterInput['thinkDivisor'], undefined>, Exclude<ShardPerchHunter['thinkDivisor'], undefined>>, 6>; readonly throwRadius: v.GenericSchema<ShardPerchHunterInput['throwRadius'], ShardPerchHunter['throwRadius']>; readonly throwDuration: v.GenericSchema<ShardPerchHunterInput['throwDuration'], ShardPerchHunter['throwDuration']>; readonly biteRadius: v.GenericSchema<ShardPerchHunterInput['biteRadius'], ShardPerchHunter['biteRadius']>; readonly biteDuration: v.GenericSchema<ShardPerchHunterInput['biteDuration'], ShardPerchHunter['biteDuration']>; readonly underRadius: v.GenericSchema<ShardPerchHunterInput['underRadius'], ShardPerchHunter['underRadius']>; readonly underSeconds: v.GenericSchema<ShardPerchHunterInput['underSeconds'], ShardPerchHunter['underSeconds']>; readonly holdRadius: v.GenericSchema<ShardPerchHunterInput['holdRadius'], ShardPerchHunter['holdRadius']>; readonly runSpeed: v.GenericSchema<ShardPerchHunterInput['runSpeed'], ShardPerchHunter['runSpeed']>; readonly activeGroundSeconds: v.GenericSchema<ShardPerchHunterInput['activeGroundSeconds'], ShardPerchHunter['activeGroundSeconds']>; readonly biteCooldown: v.GenericSchema<ShardPerchHunterInput['biteCooldown'], ShardPerchHunter['biteCooldown']>; readonly throwCooldownMin: v.GenericSchema<ShardPerchHunterInput['throwCooldownMin'], ShardPerchHunter['throwCooldownMin']>; readonly throwCooldownMax: v.GenericSchema<ShardPerchHunterInput['throwCooldownMax'], ShardPerchHunter['throwCooldownMax']>; readonly alertCue: v.GenericSchema<ShardPerchHunterInput['alertCue'], ShardPerchHunter['alertCue']>; readonly noticeCue: v.GenericSchema<ShardPerchHunterInput['noticeCue'], ShardPerchHunter['noticeCue']>; }, undefined>, v.CheckAction<{ [K in keyof ShardPerchHunter]: ShardPerchHunter[K] }, 'Ordered perch attack ranges and cooldowns'>]> = v.pipe(v.strictObject({
|
|
53
53
|
id: key, kind: v.literal('perch-hunter'), thinkDivisor: cadence, throwRadius: radius, throwDuration: v.pipe(duration, v.minValue(Number.MIN_VALUE)),
|
|
54
54
|
biteRadius: radius, biteDuration: v.pipe(duration, v.minValue(Number.MIN_VALUE)), underRadius: radius, underSeconds: duration,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { picklist } from 'valibot'
|
|
2
|
+
|
|
3
|
+
import type { PicklistSchema } from 'valibot'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ONE-FORMAT OF10c0 (Q-T21: "tiers a shard picks"): a shard names its budget tier in `budgets.tier`, and each tier is a
|
|
7
|
+
* CPU, memory and bandwidth limit. Checked at build and at upload; OF10c1 to OF10c4 meter the engine's four dangerous
|
|
8
|
+
* gates against these limits and then delete the gates. A shard that names no tier is `small`.
|
|
9
|
+
*
|
|
10
|
+
* - `cpuMicrosPerFrame`: the shard's own runtime and page features, per 60 Hz frame on the reference phone.
|
|
11
|
+
* - `memoryBytes`: resident memory its runtime and owned stages may hold beyond the admitted content.
|
|
12
|
+
* - `bandwidthBytes`: compressed bytes a player downloads for the shard (J338: 50 MB is fine, 100 MB is the hard cap).
|
|
13
|
+
*/
|
|
14
|
+
interface BudgetTierLimits {
|
|
15
|
+
readonly cpuMicrosPerFrame: number
|
|
16
|
+
readonly memoryBytes: number
|
|
17
|
+
readonly bandwidthBytes: number
|
|
18
|
+
}
|
|
19
|
+
type BudgetTier = 'small' | 'medium' | 'large'
|
|
20
|
+
|
|
21
|
+
const MEBIBYTE = 1_048_576
|
|
22
|
+
const SMALL_CPU = 1000
|
|
23
|
+
const MEDIUM_CPU = 2000
|
|
24
|
+
const LARGE_CPU = 4000
|
|
25
|
+
const SMALL_MEMORY = 128
|
|
26
|
+
const MEDIUM_MEMORY = 256
|
|
27
|
+
const LARGE_MEMORY = 512
|
|
28
|
+
const SMALL_BANDWIDTH = 25_000_000
|
|
29
|
+
const MEDIUM_BANDWIDTH = 50_000_000
|
|
30
|
+
const LARGE_BANDWIDTH = 100_000_000
|
|
31
|
+
|
|
32
|
+
const BUDGET_TIERS: Readonly<Record<BudgetTier, BudgetTierLimits>> = {
|
|
33
|
+
small: {
|
|
34
|
+
cpuMicrosPerFrame: SMALL_CPU,
|
|
35
|
+
memoryBytes: SMALL_MEMORY * MEBIBYTE,
|
|
36
|
+
bandwidthBytes: SMALL_BANDWIDTH,
|
|
37
|
+
},
|
|
38
|
+
medium: {
|
|
39
|
+
cpuMicrosPerFrame: MEDIUM_CPU,
|
|
40
|
+
memoryBytes: MEDIUM_MEMORY * MEBIBYTE,
|
|
41
|
+
bandwidthBytes: MEDIUM_BANDWIDTH,
|
|
42
|
+
},
|
|
43
|
+
large: {
|
|
44
|
+
cpuMicrosPerFrame: LARGE_CPU,
|
|
45
|
+
memoryBytes: LARGE_MEMORY * MEBIBYTE,
|
|
46
|
+
bandwidthBytes: LARGE_BANDWIDTH,
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
/** The tier a shard picks; an unknown tier refuses. */
|
|
50
|
+
const BudgetTierSchema: PicklistSchema<
|
|
51
|
+
['small', 'medium', 'large'],
|
|
52
|
+
undefined
|
|
53
|
+
> = picklist(['small', 'medium', 'large'])
|
|
54
|
+
/** The limits a shard's budgets name (`small` when it names none). */
|
|
55
|
+
function budgetTierLimits(budgets: {
|
|
56
|
+
readonly tier?: BudgetTier
|
|
57
|
+
}): BudgetTierLimits {
|
|
58
|
+
return BUDGET_TIERS[budgets.tier ?? 'small']
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { BUDGET_TIERS, BudgetTierSchema, budgetTierLimits }
|
|
62
|
+
export type { BudgetTier, BudgetTierLimits }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const __SHARDFILE_VERDICTS__: unknown;
|
|
2
2
|
|
|
3
|
-
/** Build-owned address for one
|
|
3
|
+
/** Build-owned address for one built-in index. The complete digest remains
|
|
4
4
|
* admission authority; its short URL version is only a cache identity. */
|
|
5
5
|
export function builtIndexHash(path: string): string | null {
|
|
6
6
|
const rows: unknown = typeof __SHARDFILE_VERDICTS__ === 'object' ? __SHARDFILE_VERDICTS__ : null;
|
|
@@ -16,7 +16,7 @@ export function builtIndexHash(path: string): string | null {
|
|
|
16
16
|
return found;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/** The exact
|
|
19
|
+
/** The exact built-in index hashes this client build validated; null for an unbundled client or a build with none. */
|
|
20
20
|
export function builtIndexHashes(): ReadonlySet<string> | null {
|
|
21
21
|
const rows: unknown = typeof __SHARDFILE_VERDICTS__ === 'object' ? __SHARDFILE_VERDICTS__ : null;
|
|
22
22
|
if (!Array.isArray(rows)) return null;
|
|
@@ -171,14 +171,14 @@ function listOk(rows: readonly ClientChannelProgram[]): boolean {
|
|
|
171
171
|
}
|
|
172
172
|
/** Visual property identity, never an authoritative player or shared field. */
|
|
173
173
|
|
|
174
|
-
/** Strictly parse detached author data before the
|
|
174
|
+
/** Strictly parse detached author data before the native view owner binds it. */
|
|
175
175
|
export function parseClientChannels(input: unknown): ClientChannelProgram[] { return v.parse(ClientChannelsSchema, input); }
|
|
176
176
|
|
|
177
177
|
/** Bounded read-only numeric capabilities for a privately owned playback group. */
|
|
178
|
-
/** Admit only bounded paths;
|
|
178
|
+
/** Admit only bounded paths; native owners are supplied separately and are never writable channels. */
|
|
179
179
|
export function parseClientChannelInputs(input: unknown): v.InferOutput<typeof numericInputs> { return v.parse(numericInputs, input); }
|
|
180
180
|
|
|
181
|
-
/** Data-only private scene construction: geometry, textures and graph materials stay in
|
|
181
|
+
/** Data-only private scene construction: geometry, textures and graph materials stay in host-owned owned ports. */
|
|
182
182
|
const sceneCoordinate = v.pipe(v.number(), v.finite(), v.minValue(-1e5), v.maxValue(1e5));
|
|
183
183
|
const sceneVector = v.tuple([sceneCoordinate, sceneCoordinate, sceneCoordinate]);
|
|
184
184
|
const sceneChildren = v.pipe(v.array(name), v.maxLength(128));
|
|
@@ -25,7 +25,7 @@ export function clientScriptViewCost(data: ShardClientScripts): { capacity: numb
|
|
|
25
25
|
const capacity = Math.min(CLIENT_SCRIPT_LIMITS.particlesLive, data.bindings.reduce((sum, binding) => sum + binding.emitters.reduce((n, row) => n + row.live, 0), 0));
|
|
26
26
|
return { capacity, decoded: capacity * 56, gpu: capacity * 32, triangles: 0, draws: capacity > 0 ? 1 : 0 };
|
|
27
27
|
}
|
|
28
|
-
/** A declared visual anchor resolved by
|
|
28
|
+
/** A declared visual anchor resolved by native composition, never by a bytecode physics query. */
|
|
29
29
|
export type ClientScriptTarget = ShardClientScripts['bindings'][number]['target'];
|
|
30
30
|
/** Minimal format view for admission and projection, independent of rendering and author callbacks. */
|
|
31
31
|
export interface ClientScriptContent {
|
|
@@ -54,7 +54,7 @@ export const CONTENT_CAPS: { readonly l0: { readonly size: 62.5; readonly reside
|
|
|
54
54
|
overlap: 80 * CONTENT_MB, residentFactor: 1.11, nearRadius: 150, shadowRadius: 80, pitch: 562.5,
|
|
55
55
|
} as const;
|
|
56
56
|
|
|
57
|
-
/**
|
|
57
|
+
/** Host-owned GPU/transcoder capabilities, never authored shard data. */
|
|
58
58
|
export interface TextureTranscodeSupport { readonly astc: boolean; readonly bc7: boolean }
|
|
59
59
|
/** Exact LDR mip residency, including padded 4x4 ASTC/BC7 blocks at the smallest mip levels. */
|
|
60
60
|
export function textureMipBytes(width: number, height: number, levels: number, blocks: boolean): number {
|
|
@@ -36,7 +36,8 @@ export function contentCost(input: ContentCostInput): { playing: number; loading
|
|
|
36
36
|
const base = (input.engineBase ?? C.engineBase) + page + Math.ceil(resident * C.residentFactor);
|
|
37
37
|
const playing = base + input.overlap;
|
|
38
38
|
// The boot phases and playing churn share the same allocation headroom.
|
|
39
|
-
|
|
39
|
+
// MG6 epoch 3: the boot peak is also bounded below by what the phone-tier probe measures; the larger reading wins.
|
|
40
|
+
const loading = input.boot === undefined ? playing + input.overlap : Math.max(base + bootOverlap(input.overlap, input.boot), input.boot.phoneFloor ?? NO_BYTES);
|
|
40
41
|
return { playing, loading, accounted };
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -20,9 +20,12 @@ import {
|
|
|
20
20
|
union,
|
|
21
21
|
} from 'valibot'
|
|
22
22
|
|
|
23
|
+
import { CreatureSocketNameSchema } from './creature-volumes.ts'
|
|
24
|
+
import { CreatureSkinClipNameSchema } from './skinData.ts'
|
|
23
25
|
import { HuntTuningSchema } from './speciesPrograms.ts'
|
|
24
26
|
|
|
25
27
|
import type { CreatureBody } from './creature-body.ts'
|
|
28
|
+
import type { CreatureSkinClipName } from './skinData.ts'
|
|
26
29
|
import type { SpeciesData } from './speciesPrograms.ts'
|
|
27
30
|
import type { GenericSchema } from 'valibot'
|
|
28
31
|
|
|
@@ -79,7 +82,10 @@ interface CreatureAbility {
|
|
|
79
82
|
speed?: number
|
|
80
83
|
windup?: number
|
|
81
84
|
duration?: number
|
|
85
|
+
from?: string
|
|
86
|
+
clip?: CreatureSkinClipName
|
|
82
87
|
}
|
|
88
|
+
type CreatureAbilityInput = Omit<CreatureAbility, 'clip'> & { clip?: string }
|
|
83
89
|
interface CreaturePresentation {
|
|
84
90
|
blood: boolean
|
|
85
91
|
sounds: {
|
|
@@ -196,7 +202,10 @@ const CreatureSensesSchema: GenericSchema<CreatureSenses> = strictObject(
|
|
|
196
202
|
},
|
|
197
203
|
'Unknown creature sense',
|
|
198
204
|
)
|
|
199
|
-
const CreatureAbilitySchema: GenericSchema<
|
|
205
|
+
const CreatureAbilitySchema: GenericSchema<
|
|
206
|
+
CreatureAbilityInput,
|
|
207
|
+
CreatureAbility
|
|
208
|
+
> = strictObject({
|
|
200
209
|
use: id,
|
|
201
210
|
range: union([radius, orderedRadius]),
|
|
202
211
|
cooldown: time,
|
|
@@ -206,6 +215,8 @@ const CreatureAbilitySchema: GenericSchema<CreatureAbility> = strictObject({
|
|
|
206
215
|
speed: exactOptional(amount),
|
|
207
216
|
windup: exactOptional(time),
|
|
208
217
|
duration: exactOptional(time),
|
|
218
|
+
from: exactOptional(CreatureSocketNameSchema),
|
|
219
|
+
clip: exactOptional(CreatureSkinClipNameSchema),
|
|
209
220
|
})
|
|
210
221
|
const callVariants = pipe(array(sound), maxLength(MAX_CALLS))
|
|
211
222
|
const CreaturePresentationSchema: GenericSchema<CreaturePresentation> =
|
|
@@ -227,6 +238,7 @@ export {
|
|
|
227
238
|
CreaturePresentationSchema,
|
|
228
239
|
}
|
|
229
240
|
export type {
|
|
241
|
+
CreatureAbilityInput,
|
|
230
242
|
CreatureType,
|
|
231
243
|
CreatureSkeleton,
|
|
232
244
|
CreatureSize,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** A spawn row's rank (ONE-FORMAT OF28, Q-CC33 (a)): a stronger version of the
|
|
2
|
+
* same creature, scaled by fixed multipliers. The engine applies them; a shard
|
|
3
|
+
* only names the rank. Pine's and Nalati's elites move onto these (OF33). */
|
|
4
|
+
type CreatureRank = 'veteran' | 'elite' | 'champion' | 'legendary'
|
|
5
|
+
|
|
6
|
+
interface CreatureRankPolicy {
|
|
7
|
+
/** Maximum hit points. */
|
|
8
|
+
readonly hp: number
|
|
9
|
+
/** Every strike's damage. */
|
|
10
|
+
readonly damage: number
|
|
11
|
+
/** Body scale, on top of the spawn's own scale and its size class. */
|
|
12
|
+
readonly size: number
|
|
13
|
+
/** Loot rolls. */
|
|
14
|
+
readonly loot: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CREATURE_RANK_NAMES: readonly CreatureRank[] = [
|
|
18
|
+
'veteran',
|
|
19
|
+
'elite',
|
|
20
|
+
'champion',
|
|
21
|
+
'legendary',
|
|
22
|
+
]
|
|
23
|
+
const CREATURE_RANKS: Readonly<Record<CreatureRank, CreatureRankPolicy>> = {
|
|
24
|
+
veteran: { hp: 2, damage: 1.25, size: 1.1, loot: 2 },
|
|
25
|
+
elite: { hp: 4, damage: 1.5, size: 1.2, loot: 3 },
|
|
26
|
+
champion: { hp: 10, damage: 2, size: 1.35, loot: 5 },
|
|
27
|
+
legendary: { hp: 25, damage: 2.5, size: 1.5, loot: 8 },
|
|
28
|
+
}
|
|
29
|
+
const UNRANKED: CreatureRankPolicy = { hp: 1, damage: 1, size: 1, loot: 1 }
|
|
30
|
+
|
|
31
|
+
/** The multipliers for a spawn row's rank; an unranked row keeps its own numbers. */
|
|
32
|
+
function creatureRank(rank?: CreatureRank): CreatureRankPolicy {
|
|
33
|
+
return rank === undefined ? UNRANKED : CREATURE_RANKS[rank]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { CREATURE_RANK_NAMES, CREATURE_RANKS, creatureRank }
|
|
37
|
+
export type { CreatureRank, CreatureRankPolicy }
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { creatureRank } from './creature-ranks.ts'
|
|
2
|
+
|
|
1
3
|
import type { CreatureBody, CreatureSize } from './creature-layers.ts'
|
|
4
|
+
import type { CreatureRank } from './creature-ranks.ts'
|
|
2
5
|
|
|
3
6
|
interface CreatureSizePolicy {
|
|
4
7
|
readonly scale: number
|
|
@@ -8,6 +11,10 @@ interface CreatureSizePolicy {
|
|
|
8
11
|
readonly maxHeight?: number
|
|
9
12
|
}
|
|
10
13
|
const GIANT_HEIGHT = 15
|
|
14
|
+
/** One row's full count may weigh at most one giant: 16 medium, 4 large. */
|
|
15
|
+
const COUNT_WEIGHT_CAP = 16
|
|
16
|
+
const ONE_CREATURE = 1
|
|
17
|
+
const NO_CREATURES = 0
|
|
11
18
|
const DEFAULT_SCALE = 1
|
|
12
19
|
const BODY_HEIGHT_FACTOR = 2
|
|
13
20
|
const MAX_VARIANT_SCALE = 1
|
|
@@ -42,6 +49,8 @@ interface SizedSpawn {
|
|
|
42
49
|
readonly id: string
|
|
43
50
|
readonly species: string
|
|
44
51
|
readonly scale: number
|
|
52
|
+
readonly rank?: CreatureRank
|
|
53
|
+
readonly count?: { readonly per: number; readonly max: number }
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
function creatureScale(
|
|
@@ -68,17 +77,30 @@ function creatureHeight(
|
|
|
68
77
|
)
|
|
69
78
|
return modelHeight * creatureScale(body, spawnScale)
|
|
70
79
|
}
|
|
80
|
+
function countRules(
|
|
81
|
+
row: SizedSpecies,
|
|
82
|
+
spawns: readonly SizedSpawn[],
|
|
83
|
+
): string[] {
|
|
84
|
+
const weight = CREATURE_SIZES[row.body?.size ?? 'medium'].cellWeight
|
|
85
|
+
return spawns.flatMap((spawn): string[] =>
|
|
86
|
+
spawn.species === row.id &&
|
|
87
|
+
spawn.count !== undefined &&
|
|
88
|
+
spawn.count.max * weight > COUNT_WEIGHT_CAP
|
|
89
|
+
? [`spawn ${spawn.id}: count ceiling outweighs its size class`]
|
|
90
|
+
: [],
|
|
91
|
+
)
|
|
92
|
+
}
|
|
71
93
|
function speciesSizeRules(
|
|
72
94
|
row: SizedSpecies,
|
|
73
95
|
spawns: readonly SizedSpawn[],
|
|
74
96
|
): string[] {
|
|
75
97
|
const { body } = row
|
|
76
98
|
if (body === undefined) {
|
|
77
|
-
return
|
|
99
|
+
return countRules(row, spawns)
|
|
78
100
|
}
|
|
79
101
|
const cap = CREATURE_SIZES[body.size].maxHeight
|
|
80
102
|
if (cap === undefined) {
|
|
81
|
-
return
|
|
103
|
+
return countRules(row, spawns)
|
|
82
104
|
}
|
|
83
105
|
const oversized = row.variants.some(
|
|
84
106
|
(variant): boolean =>
|
|
@@ -87,9 +109,14 @@ function speciesSizeRules(
|
|
|
87
109
|
const errors = oversized ? [`species ${row.id}: giant exceeds ${cap} m`] : []
|
|
88
110
|
return [
|
|
89
111
|
...errors,
|
|
112
|
+
...countRules(row, spawns),
|
|
90
113
|
...spawns.flatMap((spawn): string[] =>
|
|
91
114
|
spawn.species === row.id &&
|
|
92
|
-
creatureHeight(
|
|
115
|
+
creatureHeight(
|
|
116
|
+
body,
|
|
117
|
+
row.dims,
|
|
118
|
+
spawn.scale * creatureRank(spawn.rank).size,
|
|
119
|
+
) > cap
|
|
93
120
|
? [`spawn ${spawn.id}: giant exceeds ${cap} m`]
|
|
94
121
|
: [],
|
|
95
122
|
),
|
|
@@ -102,5 +129,19 @@ function creatureSizeRules(
|
|
|
102
129
|
return species.flatMap((row): string[] => speciesSizeRules(row, spawns))
|
|
103
130
|
}
|
|
104
131
|
|
|
105
|
-
|
|
132
|
+
/** The most creatures the rows can hold at once: a counted row at its ceiling. */
|
|
133
|
+
function spawnCapacity(spawns: readonly Pick<SizedSpawn, 'count'>[]): number {
|
|
134
|
+
return spawns.reduce(
|
|
135
|
+
(sum, spawn): number => sum + (spawn.count?.max ?? ONE_CREATURE),
|
|
136
|
+
NO_CREATURES,
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export {
|
|
141
|
+
CREATURE_SIZES,
|
|
142
|
+
creatureScale,
|
|
143
|
+
creatureHeight,
|
|
144
|
+
creatureSizeRules,
|
|
145
|
+
spawnCapacity,
|
|
146
|
+
}
|
|
106
147
|
export type { CreatureSizePolicy }
|
|
@@ -29,7 +29,7 @@ const MAX_VOLUMES = 16
|
|
|
29
29
|
const MAX_NAME = 128
|
|
30
30
|
const MAX_EXTENT = 500
|
|
31
31
|
const MAX_MULTIPLIER = 100
|
|
32
|
-
const
|
|
32
|
+
const CreatureSocketNameSchema: GenericSchema<string> = pipe(
|
|
33
33
|
string(),
|
|
34
34
|
regex(/^[a-zA-Z][a-zA-Z0-9_.:-]*$/u),
|
|
35
35
|
maxLength(MAX_NAME),
|
|
@@ -38,8 +38,8 @@ const scalar = pipe(number(), finite())
|
|
|
38
38
|
const extent = pipe(scalar, minValue(ZERO), maxValue(MAX_EXTENT))
|
|
39
39
|
const offset = pipe(scalar, minValue(-MAX_EXTENT), maxValue(MAX_EXTENT))
|
|
40
40
|
const volumeObject = strictObject({
|
|
41
|
-
part:
|
|
42
|
-
bone:
|
|
41
|
+
part: CreatureSocketNameSchema,
|
|
42
|
+
bone: CreatureSocketNameSchema,
|
|
43
43
|
shape: picklist(['sphere', 'capsule']),
|
|
44
44
|
radius: pipe(scalar, minValue(Number.MIN_VALUE), maxValue(MAX_EXTENT)),
|
|
45
45
|
halfLength: extent,
|
|
@@ -67,7 +67,7 @@ const CreatureVolumesSchema: GenericSchema<CreatureVolume[]> = pipe(
|
|
|
67
67
|
),
|
|
68
68
|
)
|
|
69
69
|
const CreatureLockSchema: GenericSchema<string[]> = pipe(
|
|
70
|
-
array(
|
|
70
|
+
array(CreatureSocketNameSchema),
|
|
71
71
|
minLength(ONE),
|
|
72
72
|
maxLength(MAX_VOLUMES),
|
|
73
73
|
check<string[], 'Duplicate creature lock point'>(
|
|
@@ -80,6 +80,7 @@ export {
|
|
|
80
80
|
CreatureVolumeSchema,
|
|
81
81
|
CreatureVolumesSchema,
|
|
82
82
|
CreatureLockSchema,
|
|
83
|
+
CreatureSocketNameSchema,
|
|
83
84
|
MAX_VOLUMES,
|
|
84
85
|
}
|
|
85
86
|
export type { CreatureVolume }
|