@hytopia.com/server-protocol 1.3.42 → 1.3.44

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.42",
3
+ "version": "1.3.44",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -32,7 +32,7 @@ export enum PacketId {
32
32
  BLOCK_TYPES = 35,
33
33
  CHAT_MESSAGES = 36,
34
34
  CHUNKS = 37,
35
- MODELS = 38,
35
+ ENTITIES = 38,
36
36
  WORLD = 39,
37
37
  CAMERA = 40,
38
38
  UI = 41,
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { entitiesSchema } from '../../schemas/Entities';
4
+ import type { EntitiesSchema } from '../../schemas/Entities';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type EntitiesPacket = IPacket<typeof PacketId.ENTITIES, EntitiesSchema> & [WorldTick];
8
+
9
+ export const entitiesPacketDefinition = definePacket(
10
+ PacketId.ENTITIES,
11
+ entitiesSchema,
12
+ );
@@ -4,8 +4,8 @@ export * from './BlockTypes';
4
4
  export * from './Camera';
5
5
  export * from './ChatMessages';
6
6
  export * from './Chunks';
7
+ export * from './Entities';
7
8
  export * from './Lights';
8
- export * from './Models';
9
9
  export * from './PhysicsDebugRender';
10
10
  export * from './PhysicsDebugRaycasts';
11
11
  export * from './SceneUIs';
@@ -0,0 +1,10 @@
1
+ import { entitySchema } from './Entity';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { EntitySchema } from './Entity';
4
+
5
+ export type EntitiesSchema = EntitySchema[];
6
+
7
+ export const entitiesSchema: JSONSchemaType<EntitiesSchema> = {
8
+ type: 'array',
9
+ items: { ...entitySchema },
10
+ }
@@ -0,0 +1,50 @@
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 EntitySchema = {
10
+ i: number; // entity id
11
+ al?: string[]; // model animations looped
12
+ ao?: string[]; // model animations one shot
13
+ ap?: number; // model animations playback rate
14
+ as?: string[]; // model animations stop
15
+ bh?: VectorSchema; // block half extents
16
+ bt?: string; // block texture uri
17
+ h?: string[]; // model parts to hide
18
+ m?: string; // model uri
19
+ n?: string; // name
20
+ o?: number; // opacity
21
+ p?: VectorSchema; // position
22
+ r?: QuaternionSchema; // rotation
23
+ rm?: boolean; // removed/remove
24
+ s?: number; // model scale
25
+ t?: RgbColorSchema; // tint color
26
+ }
27
+
28
+ export const entitySchema: JSONSchemaType<EntitySchema> = {
29
+ type: 'object',
30
+ properties: {
31
+ i: { type: 'number' },
32
+ al: { type: 'array', items: { type: 'string' }, nullable: true },
33
+ ao: { type: 'array', items: { type: 'string' }, nullable: true },
34
+ ap: { type: 'number', nullable: true },
35
+ as: { type: 'array', items: { type: 'string' }, nullable: true },
36
+ bh: { ...vectorSchema, nullable: true },
37
+ bt: { type: 'string', nullable: true },
38
+ h: { type: 'array', items: { type: 'string' }, nullable: true },
39
+ m: { type: 'string', nullable: true },
40
+ n: { type: 'string', nullable: true },
41
+ o: { type: 'number', minimum: 0, maximum: 1, nullable: true },
42
+ p: { ...vectorSchema, nullable: true },
43
+ r: { ...quaternionSchema, nullable: true },
44
+ rm: { type: 'boolean', nullable: true },
45
+ s: { type: 'number', nullable: true },
46
+ t: { ...rgbColorSchema, nullable: true },
47
+ },
48
+ required: [ 'i' ],
49
+ additionalProperties: false,
50
+ }
package/schemas/index.ts CHANGED
@@ -10,13 +10,12 @@ export * from './ChatMessages';
10
10
  export * from './Chunk';
11
11
  export * from './Chunks';
12
12
  export * from './DebugConfig';
13
+ export * from './Entity';
14
+ export * from './Entities';
13
15
  export * from './HexColor';
14
16
  export * from './Input';
15
17
  export * from './Light';
16
18
  export * from './Lights';
17
- export * from './Model';
18
- export * from './ModelNode';
19
- export * from './Models';
20
19
  export * from './PhysicsDebugRaycast';
21
20
  export * from './PhysicsDebugRaycasts';
22
21
  export * from './PhysicsDebugRender';
@@ -1,12 +0,0 @@
1
- import { definePacket, PacketId } from '../PacketCore';
2
- import type { IPacket } from '../PacketCore';
3
- import { modelsSchema } from '../../schemas/Models';
4
- import type { ModelsSchema } from '../../schemas/Models';
5
- import type { WorldTick } from '../PacketCore';
6
-
7
- export type ModelsPacket = IPacket<typeof PacketId.MODELS, ModelsSchema> & [WorldTick];
8
-
9
- export const modelsPacketDefinition = definePacket(
10
- PacketId.MODELS,
11
- modelsSchema,
12
- );
package/schemas/Model.ts DELETED
@@ -1,46 +0,0 @@
1
- import { quaternionSchema } from './Quaternion';
2
- import { modelNodeSchema } from './ModelNode';
3
- import { vectorSchema } from './Vector';
4
- import type { JSONSchemaType } from 'ajv';
5
- import type { QuaternionSchema } from './Quaternion';
6
- import type { ModelNodeSchema } from './ModelNode';
7
- import type { VectorSchema } from './Vector';
8
-
9
- export type ModelSchema = {
10
- i: number; // model id
11
- al?: string[]; // animations looped
12
- ao?: string[]; // animations one shot
13
- ap?: number; // animations playback rate
14
- as?: string[]; // animations stop
15
- bh?: VectorSchema; // block model half extents
16
- bt?: string; // block model texture uri
17
- n?: ModelNodeSchema[]; // model node overrides
18
- p?: VectorSchema; // position
19
- pm?: number; // parent model id (When model is attached to another model)
20
- pn?: string; // parent node name (Optional node attached to when model is attached to another model)
21
- r?: QuaternionSchema; // rotation
22
- rm?: boolean; // removed/remove
23
- u?: string; // model uri
24
- }
25
-
26
- export const modelSchema: JSONSchemaType<ModelSchema> = {
27
- type: 'object',
28
- properties: {
29
- i: { type: 'number' },
30
- al: { type: 'array', items: { type: 'string' }, nullable: true },
31
- ao: { type: 'array', items: { type: 'string' }, nullable: true },
32
- ap: { type: 'number', nullable: true },
33
- as: { type: 'array', items: { type: 'string' }, nullable: true },
34
- bh: { ...vectorSchema, nullable: true },
35
- bt: { type: 'string', nullable: true },
36
- n: { type: 'array', items: { ...modelNodeSchema }, nullable: true },
37
- p: { ...vectorSchema, nullable: true },
38
- pm: { type: 'number', nullable: true },
39
- pn: { type: 'string', nullable: true },
40
- r: { ...quaternionSchema, nullable: true },
41
- rm: { type: 'boolean', nullable: true },
42
- u: { type: 'string', nullable: true },
43
- },
44
- required: [ 'i' ],
45
- additionalProperties: false,
46
- }
@@ -1,32 +0,0 @@
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
- }
package/schemas/Models.ts DELETED
@@ -1,10 +0,0 @@
1
- import { modelSchema } from './Model';
2
- import type { JSONSchemaType } from 'ajv';
3
- import type { ModelSchema } from './Model';
4
-
5
- export type ModelsSchema = ModelSchema[];
6
-
7
- export const modelsSchema: JSONSchemaType<ModelsSchema> = {
8
- type: 'array',
9
- items: { ...modelSchema },
10
- }