@hytopia.com/server-protocol 1.0.38 → 1.0.40

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.0.38",
3
+ "version": "1.0.40",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -3,16 +3,19 @@ import type { JSONSchemaType } from 'ajv';
3
3
  import type { ColliderDescSchema } from './ColliderDesc';
4
4
 
5
5
  export type ColliderSchema = {
6
- h?: number; // collider handle for rapier
7
- rm?: boolean; // removed
6
+ h: number; // handle
7
+ mk?: boolean; // created/make
8
+ rm?: boolean; // removed/remove
8
9
  } & ColliderDescSchema;
9
10
 
10
11
  export const colliderSchema: JSONSchemaType<ColliderSchema> = {
11
12
  type: 'object',
12
13
  properties: {
13
14
  h: { type: 'number', nullable: true },
15
+ mk: { type: 'boolean', nullable: true },
14
16
  rm: { type: 'boolean', nullable: true },
15
17
  ...colliderDescSchema.properties
16
18
  },
19
+ required: [ 'h' ],
17
20
  additionalProperties: false,
18
21
  }
@@ -14,13 +14,13 @@ export type ColliderDescSchema = {
14
14
  f?: number; // friction
15
15
  fr?: number; // friction combine rule
16
16
  en?: boolean; // enabled
17
- sn?: boolean; // sensor
18
17
  m?: number; // mass
19
18
  re?: number; // restitution
20
19
  rer?: number; // restitution combine rule
21
20
  r?: QuaternionSchema; // rotation
22
21
  s?: ShapeSchema; // shape
23
22
  sg?: number; // solver groups
23
+ sn?: boolean; // sensor
24
24
  t?: VectorSchema; // translation
25
25
  }
26
26
 
@@ -34,13 +34,13 @@ export const colliderDescSchema: JSONSchemaType<ColliderDescSchema> = {
34
34
  f: { type: 'number', nullable: true },
35
35
  fr: { type: 'number', nullable: true },
36
36
  en: { type: 'boolean', nullable: true },
37
- sn: { type: 'boolean', nullable: true },
38
37
  m: { type: 'number', nullable: true },
39
38
  re: { type: 'number', nullable: true },
40
39
  rer: { type: 'number', nullable: true },
41
40
  r: { ...quaternionSchema, nullable: true },
42
41
  s: { ...shapeSchema, nullable: true },
43
42
  sg: { type: 'number', nullable: true },
43
+ sn: { type: 'boolean', nullable: true },
44
44
  t: { ...vectorSchema, nullable: true },
45
45
  },
46
46
  additionalProperties: false,
package/schemas/Entity.ts CHANGED
@@ -6,11 +6,12 @@ export type EntitySchema = {
6
6
  wi: number; // world id
7
7
  i: number; // entity id
8
8
  f?: boolean; // focused
9
- rm?: boolean; // removed
10
- n?: string; // name
11
9
  m?: string; // model uri
12
- t?: string; // texture uri
10
+ mk?: boolean; // created/make
11
+ n?: string; // name
13
12
  r?: RigidBodySchema; // rigid body
13
+ rm?: boolean; // removed/remove
14
+ t?: string; // texture uri
14
15
  }
15
16
 
16
17
  export const entitySchema: JSONSchemaType<EntitySchema> = {
@@ -19,12 +20,13 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
19
20
  wi: { type: 'number' },
20
21
  i: { type: 'number' },
21
22
  f: { type: 'boolean', nullable: true },
22
- rm: { type: 'boolean', nullable: true },
23
- n: { type: 'string', nullable: true },
24
23
  m: { type: 'string', nullable: true },
25
- t: { type: 'string', nullable: true },
24
+ mk: { type: 'boolean', nullable: true },
25
+ n: { type: 'string', nullable: true },
26
26
  r: { ...rigidBodySchema, nullable: true },
27
+ rm: { type: 'boolean', nullable: true },
28
+ t: { type: 'string', nullable: true },
27
29
  },
28
30
  required: [ 'wi', 'i' ],
29
31
  additionalProperties: false,
30
- }
32
+ }
@@ -17,10 +17,8 @@ export type RigidBodySchema = {
17
17
  er?: VectorBooleanSchema; // enabled rotations
18
18
  et?: VectorBooleanSchema; // enabled translations
19
19
  g?: number; // gravity scaling
20
- h?: number; // rigid body handle for rapier
21
20
  ld?: number; // linear damping
22
21
  lv?: VectorSchema; // linear velocity
23
- rm?: boolean; // removed
24
22
  sl?: boolean; // sleeping
25
23
  scp?: number; // soft ccd prediction
26
24
  t?: VectorSchema; // translation
@@ -39,10 +37,8 @@ export const rigidBodySchema: JSONSchemaType<RigidBodySchema> = {
39
37
  er: { ...vectorBooleanSchema, nullable: true },
40
38
  et: { ...vectorBooleanSchema, nullable: true },
41
39
  g: { type: 'number', nullable: true },
42
- h: { type: 'number', nullable: true },
43
40
  ld: { type: 'number', nullable: true },
44
41
  lv: { ...vectorSchema, nullable: true },
45
- rm: { type: 'boolean', nullable: true },
46
42
  sl: { type: 'boolean', nullable: true },
47
43
  scp: { type: 'number', nullable: true },
48
44
  t: { ...vectorSchema, nullable: true },
@@ -3,7 +3,7 @@ import { vectorSchema } from './Vector';
3
3
  import type { VectorSchema } from './Vector';
4
4
 
5
5
  export type SimulationSchema = {
6
- wi: number; // world id
6
+ wi: number; // world id
7
7
  t?: number; // tickRate (ticks per second)
8
8
  g?: VectorSchema; // gravity
9
9
  };
@@ -1,14 +1,16 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
3
  export type SyncResponseSchema = {
4
+ p: number; // high resolution of total processing time from request receipt to response
4
5
  t: number; // high resolution ms from server response time to next server tick
5
6
  };
6
7
 
7
8
  export const syncResponseSchema: JSONSchemaType<SyncResponseSchema> = {
8
9
  type: 'object',
9
10
  properties: {
11
+ p: { type: 'number' },
10
12
  t: { type: 'number' },
11
13
  },
12
- required: [ 't' ],
14
+ required: [ 'p', 't' ],
13
15
  additionalProperties: false,
14
16
  }