@hytopia.com/server-protocol 1.3.17 → 1.3.18

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.3.17",
3
+ "version": "1.3.18",
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,9 @@
1
- import { hexColorSchema } from './HexColor';
2
1
  import { quaternionSchema } from './Quaternion';
2
+ import { rgbColorSchema } from './RgbColor';
3
3
  import { vectorSchema } from './Vector';
4
- import type { HexColorSchema } from './HexColor';
5
4
  import type { JSONSchemaType } from 'ajv';
6
5
  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 = {
@@ -19,7 +19,7 @@ export type EntitySchema = {
19
19
  r?: QuaternionSchema; // rotation
20
20
  rm?: boolean; // removed/remove
21
21
  s?: number; // model scale
22
- t?: HexColorSchema; // tint color
22
+ t?: RgbColorSchema; // tint color
23
23
  }
24
24
 
25
25
  export const entitySchema: JSONSchemaType<EntitySchema> = {
@@ -37,7 +37,7 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
37
37
  r: { ...quaternionSchema, nullable: true },
38
38
  rm: { type: 'boolean', nullable: true },
39
39
  s: { type: 'number', nullable: true },
40
- t: { ...hexColorSchema, nullable: true },
40
+ t: { ...rgbColorSchema, nullable: true },
41
41
  },
42
42
  required: [ 'i' ],
43
43
  additionalProperties: false,
@@ -0,0 +1,18 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+
3
+ export type RgbColorSchema = [
4
+ number, // r
5
+ number, // g
6
+ number, // b
7
+ ];
8
+
9
+ export const rgbColorSchema: JSONSchemaType<RgbColorSchema> = {
10
+ type: 'array',
11
+ items: [
12
+ { type: 'number', minimum: 0, maximum: 255 },
13
+ { type: 'number', minimum: 0, maximum: 255 },
14
+ { type: 'number', minimum: 0, maximum: 255 }
15
+ ],
16
+ minItems: 3,
17
+ maxItems: 3,
18
+ }
package/schemas/index.ts CHANGED
@@ -18,6 +18,7 @@ export * from './PhysicsDebugRaycast';
18
18
  export * from './PhysicsDebugRaycasts';
19
19
  export * from './PhysicsDebugRender';
20
20
  export * from './Quaternion';
21
+ export * from './RgbColor';
21
22
  export * from './StateRequest';
22
23
  export * from './SyncRequest';
23
24
  export * from './SyncResponse';