@hytopia.com/server-protocol 1.4.54 → 1.4.56-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hytopia.com/server-protocol",
3
- "version": "1.4.54",
3
+ "version": "1.4.56-dev1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/schemas/Entity.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { rgbColorSchema } from './RgbColor';
2
+ import { modelAnimationSchema } from './ModelAnimation';
2
3
  import { modelNodeOverrideSchema } from './ModelNodeOverride';
3
4
  import { outlineSchema } from './Outline';
4
5
  import { quaternionSchema } from './Quaternion';
5
6
  import { vectorSchema } from './Vector';
6
7
  import type { JSONSchemaType } from 'ajv';
8
+ import type { ModelAnimationSchema } from './ModelAnimation';
7
9
  import type { ModelNodeOverrideSchema } from './ModelNodeOverride';
8
10
  import type { OutlineSchema } from './Outline';
9
11
  import type { QuaternionSchema } from './Quaternion';
@@ -12,29 +14,24 @@ import type { VectorSchema } from './Vector';
12
14
 
13
15
  export type EntitySchema = {
14
16
  i: number; // entity id
15
- al?: string[]; // model animations looped
16
- ao?: string[]; // model animations one shot
17
- ap?: number; // model animations playback rate
18
- as?: string[]; // model animations stop
19
17
  bh?: VectorSchema; // block half extents
20
18
  bt?: string; // block texture uri
21
19
  e?: boolean; // environmental
22
20
  ec?: RgbColorSchema; // emissive color
23
21
  ei?: number; // emissive intensity
24
- h?: string[]; // model nodes to hide by partial case insensitive match of gltf node names - merge into node overrides?
25
22
  m?: string; // model uri
23
+ ma?: ModelAnimationSchema[]; // model animations
26
24
  mo?: ModelNodeOverrideSchema[]; // model node overrides
27
25
  mt?: string; // model texture uri (custom override)
28
26
  n?: string; // name
29
27
  o?: number; // opacity
30
- ol?: OutlineSchema; // outline options
28
+ ol?: OutlineSchema; // outline options
31
29
  p?: VectorSchema; // position
32
30
  pe?: number; // parent entity id
33
31
  pn?: string; // parent node name
34
32
  r?: QuaternionSchema; // rotation
35
33
  rm?: boolean; // removed/remove
36
34
  s?: number; // model scale - Deprecated as of 0.11.10, use sv
37
- sn?: string[]; // model nodes to show by partial case insensitive match of gltf node names - merge into node overrides?
38
35
  sv?: VectorSchema; // model scale vector for each axis
39
36
  t?: RgbColorSchema; // tint color
40
37
  }
@@ -43,17 +40,13 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
43
40
  type: 'object',
44
41
  properties: {
45
42
  i: { type: 'number' },
46
- al: { type: 'array', items: { type: 'string' }, nullable: true },
47
- ao: { type: 'array', items: { type: 'string' }, nullable: true },
48
- ap: { type: 'number', nullable: true },
49
- as: { type: 'array', items: { type: 'string' }, nullable: true },
50
43
  bh: { ...vectorSchema, nullable: true },
51
44
  bt: { type: 'string', nullable: true },
52
45
  e: { type: 'boolean', nullable: true },
53
46
  ec: { ...rgbColorSchema, nullable: true },
54
47
  ei: { type: 'number', nullable: true },
55
- h: { type: 'array', items: { type: 'string' }, nullable: true },
56
48
  m: { type: 'string', nullable: true },
49
+ ma: { type: 'array', items: { ...modelAnimationSchema }, nullable: true },
57
50
  mo: { type: 'array', items: { ...modelNodeOverrideSchema }, nullable: true },
58
51
  mt: { type: 'string', nullable: true },
59
52
  n: { type: 'string', nullable: true },
@@ -65,7 +58,6 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
65
58
  r: { ...quaternionSchema, nullable: true },
66
59
  rm: { type: 'boolean', nullable: true },
67
60
  s: { type: 'number', nullable: true },
68
- sn: { type: 'array', items: { type: 'string' }, nullable: true },
69
61
  sv: { ...vectorSchema, nullable: true },
70
62
  t: { ...rgbColorSchema, nullable: true },
71
63
  },
@@ -0,0 +1,32 @@
1
+ import { JSONSchemaType } from 'ajv';
2
+
3
+ export type ModelAnimationSchema = {
4
+ n: string; // animation name
5
+ b?: number; // blend mode enum index
6
+ c?: boolean; // clamp when finished
7
+ l?: number; // loop mode enum index
8
+ p?: boolean; // play
9
+ pa?: boolean; // pause
10
+ pr?: number; // playback rate
11
+ r?: boolean; // restart
12
+ s?: boolean; // stop
13
+ w?: number; // weight
14
+ }
15
+
16
+ export const modelAnimationSchema: JSONSchemaType<ModelAnimationSchema> = {
17
+ type: 'object',
18
+ properties: {
19
+ n: { type: 'string' },
20
+ b: { type: 'number', nullable: true },
21
+ c: { type: 'boolean', nullable: true },
22
+ l: { type: 'number', nullable: true },
23
+ p: { type: 'boolean', nullable: true },
24
+ pa: { type: 'boolean', nullable: true },
25
+ pr: { type: 'number', nullable: true },
26
+ r: { type: 'boolean', nullable: true },
27
+ s: { type: 'boolean', nullable: true },
28
+ w: { type: 'number', nullable: true },
29
+ },
30
+ required: [ 'n' ],
31
+ additionalProperties: false,
32
+ }
@@ -6,6 +6,7 @@ export type ModelNodeOverrideSchema = {
6
6
  n: string; // node name match
7
7
  ec?: RgbColorSchema; // emissive color
8
8
  ei?: number; // emissive intensity
9
+ h?: boolean; // hidden
9
10
  }
10
11
 
11
12
  export const modelNodeOverrideSchema: JSONSchemaType<ModelNodeOverrideSchema> = {
@@ -14,6 +15,7 @@ export const modelNodeOverrideSchema: JSONSchemaType<ModelNodeOverrideSchema> =
14
15
  n: { type: 'string' },
15
16
  ec: { ...rgbColorSchema, nullable: true },
16
17
  ei: { type: 'number', nullable: true },
18
+ h: { type: 'boolean', nullable: true },
17
19
  },
18
20
  required: [ 'n' ],
19
21
  additionalProperties: false,
@@ -26,7 +26,7 @@ export type ParticleEmitterSchema = {
26
26
  o?: VectorSchema; // offset
27
27
  oe?: number; // opacity end
28
28
  oev?: number; // opacity end variance
29
- or?: number; // orientation mode: 0=billboard, 1=billboardY, 2=fixed
29
+ or?: number; // orientation mode: 0=billboard, 1=billboardY, 2=fixed, 3=velocity
30
30
  ofr?: VectorSchema; // orientation fixed rotation in degrees (x, y, z)
31
31
  os?: number; // opacity start
32
32
  osv?: number; // opacity start variance
package/schemas/index.ts CHANGED
@@ -18,6 +18,7 @@ export * from './HexColor';
18
18
  export * from './Input';
19
19
  export * from './Light';
20
20
  export * from './Lights';
21
+ export * from './ModelAnimation';
21
22
  export * from './ModelNodeOverride';
22
23
  export * from './NotificationPermissionRequest';
23
24
  export * from './Outline';