@wildshard/shard-format 0.50.0 → 0.52.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 +2 -1
- package/src/format/entryClearance.ts +2 -1
- package/src/format/liftApproach.ts +1 -1
- package/src/format/look-level.ts +164 -0
- package/src/format/look-light.ts +4 -3
- package/src/format/look-render.ts +17 -0
- package/src/format/look-swing.ts +18 -0
- package/src/format/minimap.ts +28 -17
- package/src/format/prop-hull.ts +54 -1
- package/src/format/props.ts +47 -13
- package/src/format/shardSchema.ts +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.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": {
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
"./pbr-fur": "./src/format/pbr-fur.ts",
|
|
128
128
|
"./fur-strands": "./src/format/fur-strands.ts",
|
|
129
129
|
"./scene-render": "./src/format/scene-render.ts",
|
|
130
|
+
"./look-level": "./src/format/look-level.ts",
|
|
130
131
|
"./look-sky": "./src/format/look-sky.ts",
|
|
131
132
|
"./directorDocument": "./src/format/directorDocument.ts",
|
|
132
133
|
"./directorStages": "./src/format/directorStages.ts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ShardEntryways } from './entryways.ts';
|
|
2
2
|
import type { ShardProps } from './props.ts';
|
|
3
|
-
import { propHullBounds } from './prop-hull.ts';
|
|
3
|
+
import { propCapsuleBounds, propHullBounds } from './prop-hull.ts';
|
|
4
4
|
import type { ShardWater } from './water.ts';
|
|
5
5
|
import { entryFootprints, clipEntryPolygon, obstructsEntry, type EntryVertex, type EntryFootprint } from './entryGeometry.ts';
|
|
6
6
|
import { PropExtent, visitGlbTriangles } from './shardfile-assets.ts';
|
|
@@ -53,6 +53,7 @@ export function validateEntrywayClearance(source: { entryways: ShardEntryways; p
|
|
|
53
53
|
for (const row of props.colliders) for (const shape of row.shapes) {
|
|
54
54
|
if (shape.kind === 'box') boxTriangles(shape, inspect);
|
|
55
55
|
else if (shape.kind === 'hull') { boxTriangles(propHullBounds(shape), inspect); }
|
|
56
|
+
else if (shape.kind === 'capsule') { boxTriangles(propCapsuleBounds(shape), inspect); }
|
|
56
57
|
else {
|
|
57
58
|
const dx = shape.to.x - shape.from.x, dz = shape.to.z - shape.from.z, run = Math.hypot(dx, dz) / shape.count, rise = (shape.to.y - shape.from.y) / shape.count;
|
|
58
59
|
for (let i = 0; i < shape.count; i++) {
|
|
@@ -22,7 +22,7 @@ function boxTop(box: Box): EntryVertex[][] {
|
|
|
22
22
|
function staticTops(rows: readonly ShardProps['colliders'][number][]): EntryVertex[][] {
|
|
23
23
|
return rows.flatMap(row => row.shapes.flatMap(shape => {
|
|
24
24
|
if (shape.kind === 'box') return boxTop(shape);
|
|
25
|
-
if (shape.kind === 'hull') { return []; }
|
|
25
|
+
if (shape.kind === 'hull' || shape.kind === 'capsule') { return []; }
|
|
26
26
|
const dx = shape.to.x - shape.from.x, dz = shape.to.z - shape.from.z, run = Math.hypot(dx, dz) / shape.count, rise = (shape.to.y - shape.from.y) / shape.count;
|
|
27
27
|
return Array.from({ length: shape.count }, (_unused, i) => {
|
|
28
28
|
const f = (i + 0.5) / shape.count, hy = Math.max(0.01, rise * (i + 1) / 2);
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `look.level` (ONE-FORMAT OF9b2, J365 (7)): the level's sky rig, atmosphere, engine grade and painted horizon, in the
|
|
3
|
+
* look section beside the rest of the look. OF7 gave `look.light.heightFog` and `look.grade.bloom`; these are the words
|
|
4
|
+
* it left the manifest's: the sun's colour, intensity and place, the hemisphere, the environment and background
|
|
5
|
+
* intensity, the sun's tints on fog, cloud and shafts, the grade's saturation, brightness, contrast, split tones, lift,
|
|
6
|
+
* gain and gamma, and the horizon rings. Each keeps the shape and units it had in the manifest (the same schemas,
|
|
7
|
+
* `ManifestMetadataSchema.entries`), so a value moves byte for byte and a shard looks the same.
|
|
8
|
+
*
|
|
9
|
+
* A product built since OF9b2 carries them here and its `ui/level` manifest has no `sky`, `atmosphere`, `grade` or
|
|
10
|
+
* `horizon`; an older product carries them in its manifest. `levelLook` reads the look first and lifts an older
|
|
11
|
+
* manifest's at the door; `liftLevelLook` moves them into `look.level` (the look's own win when both are present).
|
|
12
|
+
*
|
|
13
|
+
* Plain data and checks, no three.js.
|
|
14
|
+
*/
|
|
15
|
+
import { exactOptional, strictObject } from 'valibot'
|
|
16
|
+
|
|
17
|
+
import { ManifestMetadataSchema } from './minimap.ts'
|
|
18
|
+
|
|
19
|
+
import type { ManifestMetadata } from './minimap.ts'
|
|
20
|
+
import type { GenericSchema } from 'valibot'
|
|
21
|
+
|
|
22
|
+
/** The sky rig: sun, hemisphere, environment and background intensity, the sun's tints, painted dome, planet, HDRI. */
|
|
23
|
+
type LookLevelSky = NonNullable<ManifestMetadata['sky']>
|
|
24
|
+
/** Distance and height fog and the volumetric light. */
|
|
25
|
+
type LookLevelAtmosphere = NonNullable<ManifestMetadata['atmosphere']>
|
|
26
|
+
/** The engine grade. */
|
|
27
|
+
type LookLevelGrade = NonNullable<ManifestMetadata['grade']>
|
|
28
|
+
/** A painted horizon of rings. */
|
|
29
|
+
type LookLevelHorizon = NonNullable<ManifestMetadata['horizon']>
|
|
30
|
+
/** `look.level`: the sky rig, atmosphere and grade (all three), and a horizon when the level paints one. */
|
|
31
|
+
interface LookLevel {
|
|
32
|
+
sky: LookLevelSky
|
|
33
|
+
atmosphere: LookLevelAtmosphere
|
|
34
|
+
grade: LookLevelGrade
|
|
35
|
+
horizon?: LookLevelHorizon
|
|
36
|
+
}
|
|
37
|
+
type LookLevelInput = LookLevel
|
|
38
|
+
/** The four level fields a manifest carried before OF9b2. */
|
|
39
|
+
type LevelField = 'sky' | 'atmosphere' | 'grade' | 'horizon'
|
|
40
|
+
/** A manifest as the level look reads it: any of the four fields, or none. */
|
|
41
|
+
type LevelManifest = Readonly<Partial<Pick<ManifestMetadata, LevelField>>>
|
|
42
|
+
/** What the level look is read from: a look with an optional level, and an optional manifest. */
|
|
43
|
+
interface LevelLookSource {
|
|
44
|
+
readonly look: { readonly level?: LookLevel }
|
|
45
|
+
readonly manifest?: LevelManifest
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const LEVEL_FIELDS: readonly LevelField[] = [
|
|
49
|
+
'sky',
|
|
50
|
+
'atmosphere',
|
|
51
|
+
'grade',
|
|
52
|
+
'horizon',
|
|
53
|
+
]
|
|
54
|
+
const { entries } = ManifestMetadataSchema
|
|
55
|
+
|
|
56
|
+
/** `look.level`'s schema: the manifest's own sky, atmosphere, grade and horizon schemas. */
|
|
57
|
+
const LookLevelSchema: GenericSchema<LookLevelInput, LookLevel> = strictObject({
|
|
58
|
+
sky: entries.sky.wrapped,
|
|
59
|
+
atmosphere: entries.atmosphere.wrapped,
|
|
60
|
+
grade: entries.grade.wrapped,
|
|
61
|
+
horizon: exactOptional(entries.horizon.wrapped),
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
/** Whether a manifest still carries any of the level look's fields (a product built before OF9b2). */
|
|
65
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
66
|
+
function manifestCarriesLevel(manifest: LevelManifest): boolean {
|
|
67
|
+
return LEVEL_FIELDS.some((field: LevelField): boolean =>
|
|
68
|
+
Object.hasOwn(manifest, field),
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The level look a manifest carries, when it carries a whole one (sky, atmosphere and grade). */
|
|
73
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
74
|
+
function manifestLevel(manifest: LevelManifest): LookLevel | undefined {
|
|
75
|
+
const { sky, atmosphere, grade, horizon } = manifest
|
|
76
|
+
if (sky === undefined || atmosphere === undefined || grade === undefined) {
|
|
77
|
+
return undefined
|
|
78
|
+
}
|
|
79
|
+
return horizon === undefined
|
|
80
|
+
? { sky, atmosphere, grade }
|
|
81
|
+
: { sky, atmosphere, grade, horizon }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The level look of a shard: its look's, else (a product built before OF9b2) its manifest's; none for a plain shard. */
|
|
85
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
86
|
+
function levelLook(source: LevelLookSource): LookLevel | undefined {
|
|
87
|
+
if (source.look.level !== undefined) {
|
|
88
|
+
return source.look.level
|
|
89
|
+
}
|
|
90
|
+
return source.manifest === undefined
|
|
91
|
+
? undefined
|
|
92
|
+
: manifestLevel(source.manifest)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A manifest without the four level fields. */
|
|
96
|
+
function withoutLevel<Manifest extends LevelManifest>(
|
|
97
|
+
manifest: Manifest,
|
|
98
|
+
): Omit<Manifest, LevelField> {
|
|
99
|
+
const {
|
|
100
|
+
sky: _sky,
|
|
101
|
+
atmosphere: _atmosphere,
|
|
102
|
+
grade: _grade,
|
|
103
|
+
horizon: _horizon,
|
|
104
|
+
...rest
|
|
105
|
+
} = manifest
|
|
106
|
+
return rest
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The door for a product built before OF9b2: its manifest's `sky`, `atmosphere`, `grade` and `horizon` move into
|
|
111
|
+
* `look.level` (unless the look already declares one, which wins) and leave the manifest. A source with neither, or
|
|
112
|
+
* already lifted, comes back as it is (the same object).
|
|
113
|
+
*/
|
|
114
|
+
function liftLevelLook<Source extends LevelLookSource>(source: Source): Source {
|
|
115
|
+
const { manifest } = source
|
|
116
|
+
if (manifest === undefined || !manifestCarriesLevel(manifest)) {
|
|
117
|
+
return source
|
|
118
|
+
}
|
|
119
|
+
const level = levelLook(source)
|
|
120
|
+
return {
|
|
121
|
+
...source,
|
|
122
|
+
manifest: withoutLevel(manifest),
|
|
123
|
+
look: level === undefined ? source.look : { ...source.look, level },
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** OF9b2's semantic rule: a shard with a manifest has a whole level look, in `look.level` or the manifest, never both. */
|
|
128
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- plain JSON rows the caller owns; nothing here writes them
|
|
129
|
+
function lookLevelRules(source: LevelLookSource): readonly string[] {
|
|
130
|
+
const { manifest } = source
|
|
131
|
+
if (manifest === undefined) {
|
|
132
|
+
return []
|
|
133
|
+
}
|
|
134
|
+
if (source.look.level !== undefined) {
|
|
135
|
+
return manifestCarriesLevel(manifest)
|
|
136
|
+
? [
|
|
137
|
+
'look.level: the level look lives in look.level or the manifest, not both',
|
|
138
|
+
]
|
|
139
|
+
: []
|
|
140
|
+
}
|
|
141
|
+
return manifestLevel(manifest) === undefined
|
|
142
|
+
? [
|
|
143
|
+
'look.level: a level needs its sky, atmosphere and grade (look.level, or a manifest built before OF9b2)',
|
|
144
|
+
]
|
|
145
|
+
: []
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export {
|
|
149
|
+
LookLevelSchema,
|
|
150
|
+
levelLook,
|
|
151
|
+
liftLevelLook,
|
|
152
|
+
lookLevelRules,
|
|
153
|
+
manifestCarriesLevel,
|
|
154
|
+
}
|
|
155
|
+
export type {
|
|
156
|
+
LevelLookSource,
|
|
157
|
+
LevelManifest,
|
|
158
|
+
LookLevel,
|
|
159
|
+
LookLevelAtmosphere,
|
|
160
|
+
LookLevelGrade,
|
|
161
|
+
LookLevelHorizon,
|
|
162
|
+
LookLevelInput,
|
|
163
|
+
LookLevelSky,
|
|
164
|
+
}
|
package/src/format/look-light.ts
CHANGED
|
@@ -50,10 +50,12 @@ import {
|
|
|
50
50
|
lampDecay,
|
|
51
51
|
lampFlicker,
|
|
52
52
|
lampHalo,
|
|
53
|
+
lampPanel,
|
|
53
54
|
} from './look-render.ts'
|
|
54
55
|
import { LookSwingsSchema, swingNumber, swingsDeclared } from './look-swing.ts'
|
|
55
56
|
|
|
56
57
|
import type {
|
|
58
|
+
LampPanel,
|
|
57
59
|
LookLampFlicker,
|
|
58
60
|
LookLampHalo,
|
|
59
61
|
LookMotes,
|
|
@@ -64,7 +66,6 @@ import type { GenericSchema } from 'valibot'
|
|
|
64
66
|
|
|
65
67
|
type Rgb = [number, number, number]
|
|
66
68
|
type Point = [number, number, number]
|
|
67
|
-
|
|
68
69
|
/** At most this many light pools in one look (one instanced draw). */
|
|
69
70
|
const LOOK_LIGHT_POOLS_MAX = 64
|
|
70
71
|
const NONE = 0
|
|
@@ -125,7 +126,7 @@ interface LookLampFollow {
|
|
|
125
126
|
bone?: string
|
|
126
127
|
}
|
|
127
128
|
/** One lamp: a point light at `at`, `colour` × `intensity` (candela), out to `distance` metres, decay 2, no shadow. */
|
|
128
|
-
interface LookLamp {
|
|
129
|
+
interface LookLamp extends LampPanel {
|
|
129
130
|
at: Point
|
|
130
131
|
follow?: LookLampFollow
|
|
131
132
|
colour: Rgb
|
|
@@ -181,7 +182,6 @@ const colour: GenericSchema<Rgb, Rgb> = tuple([
|
|
|
181
182
|
range(NONE, FULL),
|
|
182
183
|
])
|
|
183
184
|
const point: GenericSchema<Point, Point> = tuple([real, real, real])
|
|
184
|
-
|
|
185
185
|
const LookAoSchema: GenericSchema<LookAo, LookAo> = strictObject({
|
|
186
186
|
intensity: range(NONE, AO_INTENSITY_MAX),
|
|
187
187
|
radius: range(AO_RADIUS_MIN, AO_RADIUS_MAX),
|
|
@@ -223,6 +223,7 @@ const LookLampSchema: GenericSchema<LookLamp, LookLamp> = strictObject({
|
|
|
223
223
|
halo: lampHalo,
|
|
224
224
|
flicker: lampFlicker,
|
|
225
225
|
swing: exactOptional(swingNumber),
|
|
226
|
+
panel: exactOptional(lampPanel),
|
|
226
227
|
})
|
|
227
228
|
const LookLampsSchema: GenericSchema<LookLamp[], LookLamp[]> = pipe(
|
|
228
229
|
array(LookLampSchema),
|
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
exactOptional,
|
|
19
19
|
finite,
|
|
20
20
|
integer,
|
|
21
|
+
maxLength,
|
|
21
22
|
maxValue,
|
|
23
|
+
minLength,
|
|
22
24
|
minValue,
|
|
23
25
|
number,
|
|
24
26
|
pipe,
|
|
27
|
+
string,
|
|
25
28
|
strictObject,
|
|
26
29
|
tuple,
|
|
27
30
|
} from 'valibot'
|
|
@@ -140,6 +143,18 @@ const LookMotesSchema: GenericSchema<LookMotes, LookMotes> = pipe(
|
|
|
140
143
|
)
|
|
141
144
|
const LookVignetteSchema: GenericSchema<LookVignette, LookVignette> =
|
|
142
145
|
strictObject({ offset: unit, darkness: unit })
|
|
146
|
+
/** Meta MOSSGATE-ZONE MZ34: a lamp may follow a `props.panels` id (a brazier's fire lights with its flames). */
|
|
147
|
+
interface LampPanel {
|
|
148
|
+
/** The panel it lights with: lit while that panel shows, dark while it is hidden */
|
|
149
|
+
panel?: string
|
|
150
|
+
}
|
|
151
|
+
const LAMP_PANEL_LEAST = 1
|
|
152
|
+
const LAMP_PANEL_MAX = 128
|
|
153
|
+
const lampPanel: GenericSchema<string, string> = pipe(
|
|
154
|
+
string(),
|
|
155
|
+
minLength(LAMP_PANEL_LEAST),
|
|
156
|
+
maxLength(LAMP_PANEL_MAX),
|
|
157
|
+
)
|
|
143
158
|
|
|
144
159
|
export {
|
|
145
160
|
LOOK_LIGHT_MOTES_MAX,
|
|
@@ -151,8 +166,10 @@ export {
|
|
|
151
166
|
lampDecay,
|
|
152
167
|
lampFlicker,
|
|
153
168
|
lampHalo,
|
|
169
|
+
lampPanel,
|
|
154
170
|
}
|
|
155
171
|
export type {
|
|
172
|
+
LampPanel,
|
|
156
173
|
LookLampFlicker,
|
|
157
174
|
LookLampHalo,
|
|
158
175
|
LookMotes,
|
package/src/format/look-swing.ts
CHANGED
|
@@ -86,8 +86,26 @@ function swingsDeclared(light: SwingRefs): boolean {
|
|
|
86
86
|
return true
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/** Every lamp's `panel` names a declared `props.panels` row. */
|
|
90
|
+
function lampPanelErrors(
|
|
91
|
+
lamps: readonly Readonly<{ panel?: string }>[],
|
|
92
|
+
panels: readonly Readonly<{ id: string }>[],
|
|
93
|
+
): string[] {
|
|
94
|
+
const declared = new Set(panels.map((row): string => row.id))
|
|
95
|
+
const errors: string[] = []
|
|
96
|
+
for (const lamp of lamps) {
|
|
97
|
+
if (lamp.panel !== undefined && !declared.has(lamp.panel)) {
|
|
98
|
+
errors.push(
|
|
99
|
+
`look lamp names panel ${lamp.panel}, which props.panels does not declare`,
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return errors
|
|
104
|
+
}
|
|
105
|
+
|
|
89
106
|
export {
|
|
90
107
|
LOOK_SWINGS_MAX,
|
|
108
|
+
lampPanelErrors,
|
|
91
109
|
LookSwingSchema,
|
|
92
110
|
LookSwingsSchema,
|
|
93
111
|
swingNumber,
|
package/src/format/minimap.ts
CHANGED
|
@@ -191,6 +191,26 @@ const art = v.strictObject({ world: image, models: image, sets: image, practice:
|
|
|
191
191
|
const band = v.strictObject({ azimuth: number, spread: number, height: number, rough: number });
|
|
192
192
|
const ring = v.strictObject({ r: number, base: number, color: rgb, top: rgb, snowLine: number, haze: number,
|
|
193
193
|
bands: v.pipe(v.array(band), v.maxLength(128)), floor: number });
|
|
194
|
+
/**
|
|
195
|
+
* The level's light, air and colour (ONE-FORMAT OF9b2, J365 (7)): the sky rig (sun, hemisphere, environment and
|
|
196
|
+
* background intensity, the sun's tints on fog and cloud, a painted dome, a planet, an HDRI stem), the atmosphere (fog,
|
|
197
|
+
* volumetric light), the engine grade (saturation, brightness, contrast, bloom, split tones, lift, gain, gamma) and a
|
|
198
|
+
* painted horizon. A product built since OF9b2 carries them in `look.level` (`look-level.ts` reads these schemas off
|
|
199
|
+
* `ManifestMetadataSchema.entries`); an older one in its manifest (`ui/level`), which `liftLevelLook` lifts at the door.
|
|
200
|
+
*/
|
|
201
|
+
const LevelSkySchema: v.GenericSchema<Exclude<ManifestMetadata['sky'], undefined>, Exclude<ManifestMetadata['sky'], undefined>> = v.strictObject({ hdri: v.exactOptional(v.union([image, v.pipe(text, v.regex(/^[a-z0-9_-]+$/u))])), sunColor: rgb, sunIntensity: number,
|
|
202
|
+
envIntensity: number, bgIntensity: number, fogSunColor: rgb, cloudSunColor: rgb,
|
|
203
|
+
hemiSky: number, hemiGround: number, hemiIntensity: number,
|
|
204
|
+
sun: v.exactOptional(v.strictObject({ azimuth: number, elevation: number })),
|
|
205
|
+
planet: v.exactOptional(v.strictObject({ azimuth: number, elevation: number, size: number, tilt: number, roll: v.exactOptional(number) })),
|
|
206
|
+
painted: v.exactOptional(v.strictObject({ zenith: rgb, horizon: rgb, ground: rgb, glow: rgb })) });
|
|
207
|
+
const LevelAtmosphereSchema: v.GenericSchema<Exclude<ManifestMetadata['atmosphere'], undefined>, Exclude<ManifestMetadata['atmosphere'], undefined>> = v.strictObject({ edgeHaze: v.exactOptional(v.boolean()), wetSurfaces: v.exactOptional(v.boolean()),
|
|
208
|
+
weather: v.exactOptional(v.boolean()), fogHeight: number, fogHeightFalloff: number,
|
|
209
|
+
fogHeightDensity: number, fogDistDensity: number, volumetricSunColor: rgb,
|
|
210
|
+
volumetric: v.exactOptional(v.strictObject({ height: number, falloff: number, density: number, strength: number })) });
|
|
211
|
+
const LevelGradeSchema: v.GenericSchema<Exclude<ManifestMetadata['grade'], undefined>, Exclude<ManifestMetadata['grade'], undefined>> = v.strictObject({ saturation: number, brightness: number, contrast: number, bloomIntensity: number,
|
|
212
|
+
bloomThreshold: number, shadowTint: rgb, highTint: rgb, lift: rgb, gain: rgb, gamma: number });
|
|
213
|
+
const LevelHorizonSchema: v.GenericSchema<Exclude<ManifestMetadata['horizon'], undefined>, Exclude<ManifestMetadata['horizon'], undefined>> = v.strictObject({ rings: v.pipe(v.array(ring), v.maxLength(32)), cloudSea: v.boolean() });
|
|
194
214
|
/** JSON metadata shared by discovery and the shardfile schema. Native loaders,
|
|
195
215
|
* generated inventories and terrain/model owners are explicit typed bindings. */
|
|
196
216
|
const localModule = v.pipe(text, v.regex(/^\.\/[a-zA-Z0-9_-]+(?:[./][a-zA-Z0-9_-]+)*$/u));
|
|
@@ -248,7 +268,7 @@ const strings = v.pipe(v.array(text), v.maxLength(256));
|
|
|
248
268
|
const optionalFlag = v.exactOptional(v.boolean())
|
|
249
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()),
|
|
250
270
|
input: v.exactOptional(v.strictObject({bufferMs: number, coyoteMs: number}))});
|
|
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({
|
|
271
|
+
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.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({
|
|
252
272
|
bindings,
|
|
253
273
|
boot: v.exactOptional(v.strictObject({barrier: v.exactOptional(v.boolean()), cullBeforeFirstDraw: v.exactOptional(v.boolean()),
|
|
254
274
|
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()),
|
|
@@ -288,19 +308,10 @@ export const ManifestMetadataSchema: v.StrictObjectSchema<{ readonly bindings: v
|
|
|
288
308
|
assetGlobs: v.pipe(v.array(text), v.maxLength(128)),
|
|
289
309
|
spawn: v.strictObject({ x: number, y: v.exactOptional(number), z: number, yaw: number }),
|
|
290
310
|
bounds: v.exactOptional(v.strictObject({ x0: number, x1: number, z0: number, z1: number, floor: number })),
|
|
291
|
-
sky: v.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
planet: v.exactOptional(v.strictObject({ azimuth: number, elevation: number, size: number, tilt: number, roll: v.exactOptional(number) })),
|
|
296
|
-
painted: v.exactOptional(v.strictObject({ zenith: rgb, horizon: rgb, ground: rgb, glow: rgb })) }),
|
|
297
|
-
atmosphere: v.strictObject({ edgeHaze: v.exactOptional(v.boolean()), wetSurfaces: v.exactOptional(v.boolean()),
|
|
298
|
-
weather: v.exactOptional(v.boolean()), fogHeight: number, fogHeightFalloff: number,
|
|
299
|
-
fogHeightDensity: number, fogDistDensity: number, volumetricSunColor: rgb,
|
|
300
|
-
volumetric: v.exactOptional(v.strictObject({ height: number, falloff: number, density: number, strength: number })) }),
|
|
301
|
-
grade: v.strictObject({ saturation: number, brightness: number, contrast: number, bloomIntensity: number,
|
|
302
|
-
bloomThreshold: number, shadowTint: rgb, highTint: rgb, lift: rgb, gain: rgb, gamma: number }),
|
|
303
|
-
horizon: v.exactOptional(v.strictObject({ rings: v.pipe(v.array(ring), v.maxLength(32)), cloudSea: v.boolean() })),
|
|
311
|
+
sky: v.exactOptional(LevelSkySchema),
|
|
312
|
+
atmosphere: v.exactOptional(LevelAtmosphereSchema),
|
|
313
|
+
grade: v.exactOptional(LevelGradeSchema),
|
|
314
|
+
horizon: v.exactOptional(LevelHorizonSchema),
|
|
304
315
|
minimap: v.strictObject({ image, openWater: v.exactOptional(v.strictObject({level: number, deepDepth: number})), outside: v.exactOptional(text) }),
|
|
305
316
|
pois: v.pipe(v.array(v.strictObject({ id: text, name: text, x: number, z: number, r: v.exactOptional(number), respawn: optionalFlag })), v.maxLength(256)),
|
|
306
317
|
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}))) }),
|
|
@@ -700,7 +711,7 @@ export interface ManifestMetadataFields {
|
|
|
700
711
|
z1: number;
|
|
701
712
|
floor: number;
|
|
702
713
|
};
|
|
703
|
-
sky
|
|
714
|
+
sky?: {
|
|
704
715
|
hdri?: string;
|
|
705
716
|
sunColor: [
|
|
706
717
|
number,
|
|
@@ -757,7 +768,7 @@ export interface ManifestMetadataFields {
|
|
|
757
768
|
];
|
|
758
769
|
};
|
|
759
770
|
};
|
|
760
|
-
atmosphere
|
|
771
|
+
atmosphere?: {
|
|
761
772
|
edgeHaze?: boolean;
|
|
762
773
|
wetSurfaces?: boolean;
|
|
763
774
|
weather?: boolean;
|
|
@@ -777,7 +788,7 @@ export interface ManifestMetadataFields {
|
|
|
777
788
|
strength: number;
|
|
778
789
|
};
|
|
779
790
|
};
|
|
780
|
-
grade
|
|
791
|
+
grade?: {
|
|
781
792
|
saturation: number;
|
|
782
793
|
brightness: number;
|
|
783
794
|
contrast: number;
|
package/src/format/prop-hull.ts
CHANGED
|
@@ -155,4 +155,57 @@ function propHullBounds(shape: HullPose): HullBounds {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
type CapsulePose = Readonly<GlbVertex> & {
|
|
159
|
+
readonly halfHeight: number
|
|
160
|
+
readonly radius: number
|
|
161
|
+
readonly yaw?: number | undefined
|
|
162
|
+
readonly rot?: (Readonly<GlbVertex> & { readonly w: number }) | undefined
|
|
163
|
+
}
|
|
164
|
+
const BELOW = -1
|
|
165
|
+
const ABOVE = 1
|
|
166
|
+
const SIGNS = [BELOW, ABOVE] as const
|
|
167
|
+
|
|
168
|
+
/** OF22a3: a capsule's local bounding box corners, posed as the capsule is. */
|
|
169
|
+
function capsuleCorners(shape: CapsulePose): number[] {
|
|
170
|
+
const across = shape.radius
|
|
171
|
+
const along = shape.halfHeight + shape.radius
|
|
172
|
+
return SIGNS.flatMap((sx: number): number[] =>
|
|
173
|
+
SIGNS.flatMap((sy: number): number[] =>
|
|
174
|
+
SIGNS.flatMap((sz: number): number[] => [
|
|
175
|
+
sx * across,
|
|
176
|
+
sy * along,
|
|
177
|
+
sz * across,
|
|
178
|
+
]),
|
|
179
|
+
),
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** A conservative clearance envelope for the posed capsule. */
|
|
184
|
+
function propCapsuleBounds(shape: CapsulePose): HullBounds {
|
|
185
|
+
return propHullBounds({ ...shape, points: capsuleCorners(shape) })
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** OF22a3: both posed end caps, swollen by the radius, stay inside the cell. */
|
|
189
|
+
function solidCapsuleWithinCell(shape: CapsulePose): boolean {
|
|
190
|
+
const ends = pointsInWorld({
|
|
191
|
+
...shape,
|
|
192
|
+
points: [ZERO, -shape.halfHeight, ZERO, ZERO, shape.halfHeight, ZERO],
|
|
193
|
+
})
|
|
194
|
+
return (
|
|
195
|
+
ends.length === SIGNS.length &&
|
|
196
|
+
ends.every(
|
|
197
|
+
(end: Readonly<GlbVertex>): boolean =>
|
|
198
|
+
Math.abs(end.x) + shape.radius <= CELL_HALF_WIDTH &&
|
|
199
|
+
Math.abs(end.z) + shape.radius <= CELL_HALF_WIDTH &&
|
|
200
|
+
end.y - shape.radius >= -CELL_BELOW &&
|
|
201
|
+
end.y + shape.radius <= CELL_ABOVE,
|
|
202
|
+
)
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export {
|
|
207
|
+
propCapsuleBounds,
|
|
208
|
+
propHullBounds,
|
|
209
|
+
solidCapsuleWithinCell,
|
|
210
|
+
solidHullWithinCell,
|
|
211
|
+
}
|
package/src/format/props.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { isJsonData } from './json.ts';
|
|
|
4
4
|
import { PropMaterialsSchema, propMaterialTextureRefs, validatePropMaterials } from './propMaterials.ts';
|
|
5
5
|
import { SplatTerrainSchema, validateSplatTerrain } from './splatTerrain.ts';
|
|
6
6
|
import { glbPoint, glbTransform } from './glbTriangles.ts';
|
|
7
|
-
import { solidHullWithinCell } from './prop-hull.ts';
|
|
7
|
+
import { solidCapsuleWithinCell, solidHullWithinCell } from './prop-hull.ts';
|
|
8
8
|
import type { GlbVertex } from './glbTriangles.ts';
|
|
9
9
|
|
|
10
10
|
const ref = v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/u));
|
|
@@ -16,9 +16,18 @@ const height = v.pipe(v.number(), v.finite(), v.minValue(-CELL_BELOW), v.maxValu
|
|
|
16
16
|
const finite = v.pipe(v.number(), v.finite());
|
|
17
17
|
const extent = v.pipe(finite, v.minValue(0.005), v.maxValue(250));
|
|
18
18
|
const point = v.strictObject({ x: coord, y: height, z: coord });
|
|
19
|
-
|
|
19
|
+
/** OF22a3: a static solid's material is any engine contact material a bake tags (`planks`, `ground`, `flesh`, `shell` beside the body materials). */
|
|
20
|
+
const SURFACES = ['wood', 'stone', 'grass', 'sand', 'rock', 'metal', 'earth', 'felt', 'planks', 'ground', 'flesh', 'shell'] as const;
|
|
21
|
+
type PropSurface = typeof SURFACES[number];
|
|
22
|
+
const surface = v.optional(v.picklist(SURFACES));
|
|
23
|
+
const CONTACT_LEAST = 0;
|
|
24
|
+
const CONTACT_FRICTION_MAX = 2;
|
|
25
|
+
const GROUPS_MAX = 0xFF_FF_FF_FF;
|
|
26
|
+
/** OF22a3: a baked solid's own contact: its friction, and its Rapier interaction groups (membership high 16 bits, filter low 16). */
|
|
27
|
+
const contact = { friction: v.optional(v.pipe(v.number(), v.finite(), v.minValue(CONTACT_LEAST), v.maxValue(CONTACT_FRICTION_MAX))),
|
|
28
|
+
groups: v.optional(v.pipe(v.number(), v.integer(), v.minValue(CONTACT_LEAST), v.maxValue(GROUPS_MAX))) };
|
|
20
29
|
const rotation = v.pipe(v.strictObject({ x: finite, y: finite, z: finite, w: finite }), v.check((q) => Math.abs(q.x ** 2 + q.y ** 2 + q.z ** 2 + q.w ** 2 - 1) < 1e-5, 'unit collider rotation'));
|
|
21
|
-
const boxData = v.strictObject({ kind: v.literal('box'), x: coord, y: height, z: coord, hx: extent, hy: extent, hz: extent, yaw: v.optional(finite), rot: v.optional(rotation), surface });
|
|
30
|
+
const boxData = v.strictObject({ kind: v.literal('box'), x: coord, y: height, z: coord, hx: extent, hy: extent, hz: extent, yaw: v.optional(finite), rot: v.optional(rotation), surface, ...contact });
|
|
22
31
|
function boxWithinCell(b: v.InferOutput<typeof boxData>): boolean {
|
|
23
32
|
const q = b.rot ?? { x: 0, y: Math.sin((b.yaw ?? 0) / 2), z: 0, w: Math.cos((b.yaw ?? 0) / 2) };
|
|
24
33
|
const transform = glbTransform({ translation: [b.x, b.y, b.z], rotation: [q.x, q.y, q.z, q.w] });
|
|
@@ -33,19 +42,27 @@ interface PropHull extends GlbVertex {
|
|
|
33
42
|
yaw?: number | undefined;
|
|
34
43
|
// oxlint-disable-next-line eslint/id-length -- Quaternion components are part of the wire.
|
|
35
44
|
rot?: (GlbVertex & { w: number }) | undefined;
|
|
36
|
-
surface?:
|
|
45
|
+
surface?: PropSurface | undefined;
|
|
46
|
+
friction?: number | undefined;
|
|
47
|
+
groups?: number | undefined;
|
|
37
48
|
}
|
|
38
49
|
const MIN_HULL_COORDS = 12;
|
|
39
|
-
|
|
50
|
+
/** OF22a3: up to 256 points, the largest hull a bake keeps (Driftwood's is 168). */
|
|
51
|
+
const MAX_HULL_COORDS = 768;
|
|
40
52
|
const AXES_PER_VERTEX = 3;
|
|
41
53
|
const COLLIDER_UNIT = 1;
|
|
42
54
|
const hullPoints = v.pipe(v.array(finite), v.minLength(MIN_HULL_COORDS), v.maxLength(MAX_HULL_COORDS));
|
|
43
55
|
// oxlint-disable-next-line eslint/id-length -- A hull has the same cell-local pose as a prop box.
|
|
44
56
|
const hullData = v.strictObject({ kind: v.literal('hull'), x: coord, y: height, z: coord, points: hullPoints,
|
|
45
|
-
yaw: v.optional(finite), rot: v.optional(rotation), surface });
|
|
57
|
+
yaw: v.optional(finite), rot: v.optional(rotation), surface, ...contact });
|
|
46
58
|
const hull = v.pipe(hullData, v.check<v.InferOutput<typeof hullData>, string>(solidHullWithinCell, 'solid hull within cell'));
|
|
47
|
-
const treads = v.pipe(v.strictObject({ kind: v.literal('treads'), from: point, to: point, width: extent, count: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(256)), surface }), v.check((t) => Math.hypot(t.to.x - t.from.x, t.to.z - t.from.z) > 0 && t.to.y >= t.from.y && [t.from, t.to].every((p) => Math.abs(p.x) + t.width / 2 <= 250 && Math.abs(p.z) + t.width / 2 <= 250), 'bounded nondegenerate stair'));
|
|
48
|
-
|
|
59
|
+
const treads = v.pipe(v.strictObject({ kind: v.literal('treads'), from: point, to: point, width: extent, count: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(256)), surface, ...contact }), v.check((t) => Math.hypot(t.to.x - t.from.x, t.to.z - t.from.z) > 0 && t.to.y >= t.from.y && [t.from, t.to].every((p) => Math.abs(p.x) + t.width / 2 <= 250 && Math.abs(p.z) + t.width / 2 <= 250), 'bounded nondegenerate stair'));
|
|
60
|
+
/** OF22a3: an upright capsule (or turned by `yaw`/`rot`): the straight part's half height and the radius, whole inside the cell. */
|
|
61
|
+
// oxlint-disable-next-line eslint/id-length -- A capsule has the same cell-local pose as a prop box.
|
|
62
|
+
const capsuleData = v.strictObject({ kind: v.literal('capsule'), x: coord, y: height, z: coord, halfHeight: extent, radius: extent,
|
|
63
|
+
yaw: v.optional(finite), rot: v.optional(rotation), surface, ...contact });
|
|
64
|
+
const capsule = v.pipe(capsuleData, v.check<v.InferOutput<typeof capsuleData>, string>(solidCapsuleWithinCell, 'capsule within cell'));
|
|
65
|
+
const collider = v.strictObject({ id, panel: v.nullable(id), initialActive: v.boolean(), shapes: v.pipe(v.array(v.variant('kind', [box, treads, hull, capsule])), v.minLength(1), v.maxLength(256)) });
|
|
49
66
|
const BODY_EXTENT_MIN = 0.005;
|
|
50
67
|
const BODY_EXTENT_MAX = 8;
|
|
51
68
|
const BODY_DENSITY_MIN = 1;
|
|
@@ -81,8 +98,9 @@ function bodiesAdmitted(section: { readonly bodies?: readonly { readonly id: str
|
|
|
81
98
|
const owned = new Set(rows.map((row): string => row.panel));
|
|
82
99
|
return ids.size === rows.length && owned.size === rows.length && rows.every((row): boolean => declared.has(row.panel) && !claimed.has(row.panel));
|
|
83
100
|
}
|
|
84
|
-
type CostedShape = Readonly<{ kind: 'treads'; count: number }> | Readonly<{ kind: 'hull'; points: readonly number[] }> | Readonly<{ kind: 'box' }>;
|
|
85
|
-
|
|
101
|
+
type CostedShape = Readonly<{ kind: 'treads'; count: number }> | Readonly<{ kind: 'hull'; points: readonly number[] }> | Readonly<{ kind: 'box' | 'capsule' }>;
|
|
102
|
+
/** OF22a3: a baked island's solids (Driftwood: about 13,500 units, which its native bake admits today) fit; a hull point costs one unit. */
|
|
103
|
+
const COLLIDER_BUDGET = 16_384;
|
|
86
104
|
function withinColliderBudget(rows: readonly Readonly<{ shapes: readonly CostedShape[] }>[]): boolean {
|
|
87
105
|
let total = 0;
|
|
88
106
|
for (const row of rows) {
|
|
@@ -179,8 +197,10 @@ interface PropsDataFields {
|
|
|
179
197
|
z: number;
|
|
180
198
|
w: number;
|
|
181
199
|
} | undefined;
|
|
182
|
-
surface?:
|
|
183
|
-
|
|
200
|
+
surface?: PropSurface | undefined;
|
|
201
|
+
friction?: number | undefined;
|
|
202
|
+
groups?: number | undefined;
|
|
203
|
+
}) | PropHull | PropCapsule | ({
|
|
184
204
|
kind: 'treads';
|
|
185
205
|
from: {
|
|
186
206
|
x: number;
|
|
@@ -194,7 +214,9 @@ interface PropsDataFields {
|
|
|
194
214
|
};
|
|
195
215
|
width: number;
|
|
196
216
|
count: number;
|
|
197
|
-
surface?:
|
|
217
|
+
surface?: PropSurface | undefined;
|
|
218
|
+
friction?: number | undefined;
|
|
219
|
+
groups?: number | undefined;
|
|
198
220
|
}))[];
|
|
199
221
|
})[];
|
|
200
222
|
textures: ({
|
|
@@ -203,6 +225,18 @@ interface PropsDataFields {
|
|
|
203
225
|
})[];
|
|
204
226
|
bodies?: PropsBody[];
|
|
205
227
|
}
|
|
228
|
+
/** OF22a3: a static capsule solid. */
|
|
229
|
+
interface PropCapsule extends GlbVertex {
|
|
230
|
+
kind: 'capsule';
|
|
231
|
+
halfHeight: number;
|
|
232
|
+
radius: number;
|
|
233
|
+
yaw?: number | undefined;
|
|
234
|
+
// oxlint-disable-next-line eslint/id-length -- Quaternion components are part of the wire.
|
|
235
|
+
rot?: (GlbVertex & { w: number }) | undefined;
|
|
236
|
+
surface?: PropSurface | undefined;
|
|
237
|
+
friction?: number | undefined;
|
|
238
|
+
groups?: number | undefined;
|
|
239
|
+
}
|
|
206
240
|
/** SS9a: a point, or a cuboid's half extents, in metres. */
|
|
207
241
|
interface PropsBodyVector { x: number; y: number; z: number }
|
|
208
242
|
/** SS9a: one touchable panel's body. */
|
|
@@ -45,6 +45,7 @@ import { ItemsSchema, itemRules } from './items.ts';
|
|
|
45
45
|
import { TraversalSchema } from './traversal.ts';
|
|
46
46
|
import { RuntimeSchema } from './runtime.ts';
|
|
47
47
|
import { ClientScriptsSchema, clientScriptRules } from './clientScripts.ts';
|
|
48
|
+
import { lampPanelErrors } from './look-swing.ts';
|
|
48
49
|
import { ClientChannelsSchema } from './clientChannels.ts';
|
|
49
50
|
import { EdgeProfilesSchema } from './edgeProfiles.ts';
|
|
50
51
|
import { EntrywaysSchema, entrywayRules } from './entryways.ts';
|
|
@@ -68,6 +69,8 @@ import { LookBloomSchema, LookLightSchema, LookToneSchema } from './look-light.t
|
|
|
68
69
|
import { LookVignetteSchema } from './look-render.ts';
|
|
69
70
|
import type { LookBloom, LookBloomInput, LookLight, LookLightInput, LookTone } from './look-light.ts';
|
|
70
71
|
import { LookDetailsSchema, detailLayerRules } from './look-details.ts';
|
|
72
|
+
import { LookLevelSchema, lookLevelRules } from './look-level.ts';
|
|
73
|
+
import type { LookLevel, LookLevelInput } from './look-level.ts';
|
|
71
74
|
import type { LookDetail } from './look-details.ts';
|
|
72
75
|
import type { LookVignette } from './look-render.ts';
|
|
73
76
|
|
|
@@ -89,7 +92,7 @@ const rawSchema: v.GenericSchema<ShardfileRowsInput, ShardfileRows> & { readonly
|
|
|
89
92
|
map: v.exactOptional(MapSchema),
|
|
90
93
|
requires: RequiresSchema,
|
|
91
94
|
budgets: BudgetsSchema,
|
|
92
|
-
look: v.strictObject({ families: names, materials: v.optional(MaterialsSchema, {}), familyLooks: v.optional(FamilyLooksSchema, {}), curves: v.exactOptional(MaterialCurvesSchema), samplers: v.exactOptional(TextureSamplersSchema), post: v.exactOptional(PostStackSchema), sky: v.exactOptional(LookSkySchema), light: v.exactOptional(LookLightSchema), details: v.exactOptional(LookDetailsSchema), grade: lookGrade, clock: v.literal('engine'), day: v.optional(day), dayOverride: v.nullable(channel), keys: v.pipe(v.array(key), v.maxLength(64)) }),
|
|
95
|
+
look: v.strictObject({ families: names, materials: v.optional(MaterialsSchema, {}), familyLooks: v.optional(FamilyLooksSchema, {}), curves: v.exactOptional(MaterialCurvesSchema), samplers: v.exactOptional(TextureSamplersSchema), post: v.exactOptional(PostStackSchema), sky: v.exactOptional(LookSkySchema), light: v.exactOptional(LookLightSchema), level: v.exactOptional(LookLevelSchema), details: v.exactOptional(LookDetailsSchema), grade: lookGrade, clock: v.literal('engine'), day: v.optional(day), dayOverride: v.nullable(channel), keys: v.pipe(v.array(key), v.maxLength(64)) }),
|
|
93
96
|
sim: SimSchema,
|
|
94
97
|
state: StateSchema,
|
|
95
98
|
migrations: v.optional(MigrationsSchema, []),
|
|
@@ -200,6 +203,7 @@ export interface Shardfile {
|
|
|
200
203
|
post?: v.InferOutput<typeof PostStackSchema>;
|
|
201
204
|
sky?: LookSky;
|
|
202
205
|
light?: LookLight;
|
|
206
|
+
level?: LookLevel;
|
|
203
207
|
details?: LookDetail[];
|
|
204
208
|
grade: { exposure: number; saturation: number; contrast: number; lut: string | null; bloom?: LookBloom; tone?: LookTone; vignette?: LookVignette };
|
|
205
209
|
clock: 'engine';
|
|
@@ -335,7 +339,7 @@ export function shardfileRules(s: Shardfile, sections?: ReadonlyMap<string, unkn
|
|
|
335
339
|
}
|
|
336
340
|
if (s.runtime !== null && s.modes?.traverse.some(row => row.kind === 'ladder')) errors.push('ladder traversal requires the data-only player owner');
|
|
337
341
|
errors.push(...skinLookRules(s), ...attachmentFileRules({ species: s.rows.species, files: s.files, library: s.library, materials: s.look.materials }));
|
|
338
|
-
errors.push(...clientScriptRules(s));
|
|
342
|
+
errors.push(...lookLevelRules(s), ...clientScriptRules(s), ...lampPanelErrors(s.look.light?.lamps ?? [], s.props?.panels ?? []));
|
|
339
343
|
if (s.props !== null) {
|
|
340
344
|
try { validatePropsReferences(s.props, s); } catch { errors.push('declared prop references'); }
|
|
341
345
|
if (!materialExists(s.look.materials, s.props.family)) errors.push('declared prop material');
|
|
@@ -477,6 +481,7 @@ interface ShardfileRowsInputFields {
|
|
|
477
481
|
post?: v.InferInput<typeof PostStackSchema>;
|
|
478
482
|
sky?: LookSkyInput;
|
|
479
483
|
light?: LookLightInput;
|
|
484
|
+
level?: LookLevelInput;
|
|
480
485
|
details?: LookDetail[];
|
|
481
486
|
grade: {
|
|
482
487
|
exposure: v.InferInput<typeof finite>;
|
|
@@ -555,6 +560,7 @@ interface ShardfileRowsFields {
|
|
|
555
560
|
post?: v.InferOutput<typeof PostStackSchema>;
|
|
556
561
|
sky?: LookSky;
|
|
557
562
|
light?: LookLight;
|
|
563
|
+
level?: LookLevel;
|
|
558
564
|
details?: LookDetail[];
|
|
559
565
|
grade: {
|
|
560
566
|
exposure: v.InferOutput<typeof finite>;
|