@hytopia.com/server-protocol 1.4.48 → 1.4.49-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.48",
3
+ "version": "1.4.49-dev1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/schemas/Chunk.ts CHANGED
@@ -5,7 +5,7 @@ import type { VectorSchema } from './Vector';
5
5
  export type ChunkSchema = {
6
6
  c: VectorSchema; // chunk origin coordinate [ 16n, 16n, 16n ]
7
7
  b?: Uint8Array | number[]; // block ids in chunk, 16^3 entries, registry block ids 1-255, 0 = none
8
- r?: number[]; // block rotations, sparse array of block ids index -> rotation enum (0-23)
8
+ r?: number[]; // block rotations, sparse array of block id index -> block rotation index
9
9
  rm?: boolean; // removed/remove
10
10
  };
11
11
 
@@ -28,7 +28,7 @@ export const chunkSchema: JSONSchemaType<ChunkSchema> = {
28
28
  type: 'array',
29
29
  items: { type: 'number' },
30
30
  minItems: 0,
31
- maxItems: 8192, // 4096 blocks per chunk, multiples of 2 for index,blockId
31
+ maxItems: 8192, // 4096 blocks per chunk, multiples of 2 for block id index, block rotation index
32
32
  nullable: true,
33
33
  },
34
34
  rm: { type: 'boolean', nullable: true },
package/schemas/Entity.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { rgbColorSchema } from './RgbColor';
2
+ import { modelAnimationSchema } from './ModelAnimation';
2
3
  import { modelNodeOverrideSchema } from './ModelNodeOverride';
3
4
  import { quaternionSchema } from './Quaternion';
4
5
  import { vectorSchema } from './Vector';
5
6
  import type { JSONSchemaType } from 'ajv';
7
+ import type { ModelAnimationSchema } from './ModelAnimation';
6
8
  import type { ModelNodeOverrideSchema } from './ModelNodeOverride';
7
9
  import type { QuaternionSchema } from './Quaternion';
8
10
  import type { RgbColorSchema } from './RgbColor';
@@ -10,10 +12,6 @@ import type { VectorSchema } from './Vector';
10
12
 
11
13
  export type EntitySchema = {
12
14
  i: number; // entity id
13
- al?: string[]; // model animations looped
14
- ao?: string[]; // model animations one shot
15
- ap?: number; // model animations playback rate
16
- as?: string[]; // model animations stop
17
15
  bh?: VectorSchema; // block half extents
18
16
  bt?: string; // block texture uri
19
17
  e?: boolean; // environmental
@@ -21,6 +19,7 @@ export type EntitySchema = {
21
19
  ei?: number; // emissive intensity
22
20
  h?: string[]; // model nodes to hide by partial case insensitive match of gltf node names - merge into node overrides?
23
21
  m?: string; // model uri
22
+ ma?: ModelAnimationSchema[]; // model animations
24
23
  mo?: ModelNodeOverrideSchema[]; // model node overrides
25
24
  mt?: string; // model texture uri (custom override)
26
25
  n?: string; // name
@@ -51,6 +50,7 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
51
50
  ei: { type: 'number', nullable: true },
52
51
  h: { type: 'array', items: { type: 'string' }, nullable: true },
53
52
  m: { type: 'string', nullable: true },
53
+ ma: { type: 'array', items: { ...modelAnimationSchema }, nullable: true },
54
54
  mo: { type: 'array', items: { ...modelNodeOverrideSchema }, nullable: true },
55
55
  mt: { type: 'string', nullable: true },
56
56
  n: { type: 'string', nullable: true },
@@ -0,0 +1,28 @@
1
+ import { JSONSchemaType } from 'ajv';
2
+
3
+ export type ModelAnimationSchema = {
4
+ n: string; // animation name
5
+ b?: 'normal' | 'additive'; // blend mode
6
+ l?: boolean; // loop
7
+ p?: boolean; // pause
8
+ pr?: number; // playback rate
9
+ r?: boolean; // restart
10
+ s?: boolean; // stop
11
+ w?: number; // weight
12
+ }
13
+
14
+ export const modelAnimationSchema: JSONSchemaType<ModelAnimationSchema> = {
15
+ type: 'object',
16
+ properties: {
17
+ n: { type: 'string' },
18
+ b: { type: 'string', enum: [ 'normal', 'additive' ], nullable: true },
19
+ l: { type: 'boolean', nullable: true },
20
+ p: { type: 'boolean', nullable: true },
21
+ pr: { type: 'number', nullable: true },
22
+ r: { type: 'boolean', nullable: true },
23
+ s: { type: 'boolean', nullable: true },
24
+ w: { type: 'number', nullable: true },
25
+ },
26
+ required: [ 'n' ],
27
+ additionalProperties: false,
28
+ }
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 './ParticleEmitter';