@hytopia.com/server-protocol 1.3.38 → 1.3.39
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 +1 -1
- package/schemas/Entity.ts +6 -20
- package/schemas/Model.ts +27 -0
- package/schemas/ModelNode.ts +32 -0
package/package.json
CHANGED
package/schemas/Entity.ts
CHANGED
|
@@ -1,49 +1,35 @@
|
|
|
1
|
+
import { modelSchema } from './Model';
|
|
1
2
|
import { quaternionSchema } from './Quaternion';
|
|
2
|
-
import { rgbColorSchema } from './RgbColor';
|
|
3
3
|
import { vectorSchema } from './Vector';
|
|
4
4
|
import type { JSONSchemaType } from 'ajv';
|
|
5
|
+
import type { ModelSchema } from './Model';
|
|
5
6
|
import type { QuaternionSchema } from './Quaternion';
|
|
6
|
-
import type { RgbColorSchema } from './RgbColor';
|
|
7
7
|
import type { VectorSchema } from './Vector';
|
|
8
8
|
|
|
9
9
|
export type EntitySchema = {
|
|
10
10
|
i: number; // entity id
|
|
11
|
-
|
|
12
|
-
ao?: string[]; // model animations one shot
|
|
13
|
-
ap?: number; // model animations playback rate
|
|
14
|
-
as?: string[]; // model animations stop
|
|
11
|
+
am?: ModelSchema[]; // attached models
|
|
15
12
|
bh?: VectorSchema; // block half extents
|
|
16
13
|
bt?: string; // block texture uri
|
|
17
|
-
|
|
18
|
-
m?: string; // model uri
|
|
14
|
+
m?: ModelSchema; // model
|
|
19
15
|
n?: string; // name
|
|
20
|
-
o?: number; // opacity
|
|
21
16
|
p?: VectorSchema; // position
|
|
22
17
|
r?: QuaternionSchema; // rotation
|
|
23
18
|
rm?: boolean; // removed/remove
|
|
24
|
-
s?: number; // model scale
|
|
25
|
-
t?: RgbColorSchema; // tint color
|
|
26
19
|
}
|
|
27
20
|
|
|
28
21
|
export const entitySchema: JSONSchemaType<EntitySchema> = {
|
|
29
22
|
type: 'object',
|
|
30
23
|
properties: {
|
|
31
24
|
i: { type: 'number' },
|
|
32
|
-
|
|
33
|
-
ao: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
34
|
-
ap: { type: 'number', nullable: true },
|
|
35
|
-
as: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
25
|
+
am: { type: 'array', items: { ...modelSchema }, nullable: true },
|
|
36
26
|
bh: { ...vectorSchema, nullable: true },
|
|
37
27
|
bt: { type: 'string', nullable: true },
|
|
38
|
-
|
|
39
|
-
m: { type: 'string', nullable: true },
|
|
28
|
+
m: { ...modelSchema, nullable: true },
|
|
40
29
|
n: { type: 'string', nullable: true },
|
|
41
|
-
o: { type: 'number', minimum: 0, maximum: 1, nullable: true },
|
|
42
30
|
p: { ...vectorSchema, nullable: true },
|
|
43
31
|
r: { ...quaternionSchema, nullable: true },
|
|
44
32
|
rm: { type: 'boolean', nullable: true },
|
|
45
|
-
s: { type: 'number', nullable: true },
|
|
46
|
-
t: { ...rgbColorSchema, nullable: true },
|
|
47
33
|
},
|
|
48
34
|
required: [ 'i' ],
|
|
49
35
|
additionalProperties: false,
|
package/schemas/Model.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { modelNodeSchema } from './ModelNode';
|
|
2
|
+
import type { JSONSchemaType } from 'ajv';
|
|
3
|
+
import type { ModelNodeSchema } from './ModelNode';
|
|
4
|
+
|
|
5
|
+
export type ModelSchema = {
|
|
6
|
+
al?: string[]; // animations looped
|
|
7
|
+
ao?: string[]; // animations one shot
|
|
8
|
+
ap?: number; // animations playback rate
|
|
9
|
+
as?: string[]; // animations stop
|
|
10
|
+
n?: ModelNodeSchema[]; // node custom configurations
|
|
11
|
+
pn?: string; // parent node name (When model is attached to another model)
|
|
12
|
+
u?: string; // uri
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const modelSchema: JSONSchemaType<ModelSchema> = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
al: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
19
|
+
ao: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
20
|
+
ap: { type: 'number', nullable: true },
|
|
21
|
+
as: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
22
|
+
n: { type: 'array', items: { ...modelNodeSchema }, nullable: true },
|
|
23
|
+
pn: { type: 'string', nullable: true },
|
|
24
|
+
u: { type: 'string', nullable: true },
|
|
25
|
+
},
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { quaternionSchema } from './Quaternion';
|
|
2
|
+
import { rgbColorSchema } from './RgbColor';
|
|
3
|
+
import { vectorSchema } from './Vector';
|
|
4
|
+
import type { JSONSchemaType } from 'ajv';
|
|
5
|
+
import type { QuaternionSchema } from './Quaternion';
|
|
6
|
+
import type { RgbColorSchema } from './RgbColor';
|
|
7
|
+
import type { VectorSchema } from './Vector';
|
|
8
|
+
|
|
9
|
+
export type ModelNodeSchema = {
|
|
10
|
+
n: string; // node name matcher, supporting wildcards (*), ie *-hand should match left-hand, right-hand nodes.
|
|
11
|
+
o?: number; // opacity
|
|
12
|
+
p?: VectorSchema; // relative position
|
|
13
|
+
r?: QuaternionSchema; // relative rotation
|
|
14
|
+
s?: number; // scale
|
|
15
|
+
t?: RgbColorSchema; // tint color
|
|
16
|
+
v?: boolean; // visible
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const modelNodeSchema: JSONSchemaType<ModelNodeSchema> = {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
n: { type: 'string' },
|
|
23
|
+
o: { type: 'number', minimum: 0, maximum: 1, nullable: true },
|
|
24
|
+
p: { ...vectorSchema, nullable: true },
|
|
25
|
+
r: { ...quaternionSchema, nullable: true },
|
|
26
|
+
s: { type: 'number', nullable: true },
|
|
27
|
+
t: { ...rgbColorSchema, nullable: true },
|
|
28
|
+
v: { type: 'boolean', nullable: true },
|
|
29
|
+
},
|
|
30
|
+
required: [ 'n' ],
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
}
|