@hytopia.com/server-protocol 1.3.43 → 1.3.45
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 +1 -1
- package/packets/PacketCore.ts +1 -1
- package/packets/outbound/Entities.ts +12 -0
- package/packets/outbound/index.ts +1 -1
- package/schemas/Entities.ts +10 -0
- package/schemas/Entity.ts +56 -0
- package/schemas/ModelNodeOverride.ts +8 -14
- package/schemas/index.ts +2 -2
- package/packets/outbound/Models.ts +0 -12
- package/schemas/Model.ts +0 -46
- package/schemas/Models.ts +0 -10
package/package.json
CHANGED
package/packets/PacketCore.ts
CHANGED
|
@@ -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,56 @@
|
|
|
1
|
+
import { rgbColorSchema } from './RgbColor';
|
|
2
|
+
import { modelNodeOverrideSchema } from './ModelNodeOverride';
|
|
3
|
+
import { quaternionSchema } from './Quaternion';
|
|
4
|
+
import { vectorSchema } from './Vector';
|
|
5
|
+
import type { JSONSchemaType } from 'ajv';
|
|
6
|
+
import type { ModelNodeOverrideSchema } from './ModelNodeOverride';
|
|
7
|
+
import type { QuaternionSchema } from './Quaternion';
|
|
8
|
+
import type { RgbColorSchema } from './RgbColor';
|
|
9
|
+
import type { VectorSchema } from './Vector';
|
|
10
|
+
|
|
11
|
+
export type EntitySchema = {
|
|
12
|
+
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
|
+
bh?: VectorSchema; // block half extents
|
|
18
|
+
bt?: string; // block texture uri
|
|
19
|
+
m?: string; // model uri
|
|
20
|
+
mo?: ModelNodeOverrideSchema[]; // model node overrides
|
|
21
|
+
n?: string; // name
|
|
22
|
+
o?: number; // opacity
|
|
23
|
+
p?: VectorSchema; // position
|
|
24
|
+
pe?: number; // parent entity id
|
|
25
|
+
pn?: string; // parent node name
|
|
26
|
+
r?: QuaternionSchema; // rotation
|
|
27
|
+
rm?: boolean; // removed/remove
|
|
28
|
+
s?: number; // model scale
|
|
29
|
+
t?: RgbColorSchema; // tint color
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const entitySchema: JSONSchemaType<EntitySchema> = {
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {
|
|
35
|
+
i: { type: 'number' },
|
|
36
|
+
al: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
37
|
+
ao: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
38
|
+
ap: { type: 'number', nullable: true },
|
|
39
|
+
as: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
40
|
+
bh: { ...vectorSchema, nullable: true },
|
|
41
|
+
bt: { type: 'string', nullable: true },
|
|
42
|
+
m: { type: 'string', nullable: true },
|
|
43
|
+
mo: { type: 'array', items: { ...modelNodeOverrideSchema }, nullable: true },
|
|
44
|
+
n: { type: 'string', nullable: true },
|
|
45
|
+
o: { type: 'number', nullable: true },
|
|
46
|
+
p: { ...vectorSchema, nullable: true },
|
|
47
|
+
pe: { type: 'number', nullable: true },
|
|
48
|
+
pn: { type: 'string', nullable: true },
|
|
49
|
+
r: { ...quaternionSchema, nullable: true },
|
|
50
|
+
rm: { type: 'boolean', nullable: true },
|
|
51
|
+
s: { type: 'number', nullable: true },
|
|
52
|
+
t: { ...rgbColorSchema, nullable: true },
|
|
53
|
+
},
|
|
54
|
+
required: [ 'i' ],
|
|
55
|
+
additionalProperties: false,
|
|
56
|
+
}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { quaternionSchema } from './Quaternion';
|
|
2
1
|
import { rgbColorSchema } from './RgbColor';
|
|
3
|
-
import { vectorSchema } from './Vector';
|
|
4
2
|
import type { JSONSchemaType } from 'ajv';
|
|
5
|
-
import type { QuaternionSchema } from './Quaternion';
|
|
6
3
|
import type { RgbColorSchema } from './RgbColor';
|
|
7
|
-
import type { VectorSchema } from './Vector';
|
|
8
4
|
|
|
9
5
|
export type ModelNodeOverrideSchema = {
|
|
10
|
-
n: string;
|
|
11
|
-
h?: boolean;
|
|
12
|
-
o?: number;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
t?: RgbColorSchema; // tint color
|
|
6
|
+
n: string; // node name match
|
|
7
|
+
h?: boolean; // hidden
|
|
8
|
+
o?: number; // opacity
|
|
9
|
+
r?: boolean; // reset override to defaults
|
|
10
|
+
s?: number; // scale
|
|
11
|
+
t?: RgbColorSchema; // tint color
|
|
17
12
|
}
|
|
18
13
|
|
|
19
14
|
export const modelNodeOverrideSchema: JSONSchemaType<ModelNodeOverrideSchema> = {
|
|
@@ -22,11 +17,10 @@ export const modelNodeOverrideSchema: JSONSchemaType<ModelNodeOverrideSchema> =
|
|
|
22
17
|
n: { type: 'string' },
|
|
23
18
|
h: { type: 'boolean', nullable: true },
|
|
24
19
|
o: { type: 'number', minimum: 0, maximum: 1, nullable: true },
|
|
25
|
-
|
|
26
|
-
r: { ...quaternionSchema, nullable: true },
|
|
20
|
+
r: { type: 'boolean', nullable: true },
|
|
27
21
|
s: { type: 'number', nullable: true },
|
|
28
22
|
t: { ...rgbColorSchema, nullable: true },
|
|
29
23
|
},
|
|
30
24
|
required: [ 'n' ],
|
|
31
25
|
additionalProperties: false,
|
|
32
|
-
}
|
|
26
|
+
}
|
package/schemas/index.ts
CHANGED
|
@@ -10,13 +10,13 @@ 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
19
|
export * from './ModelNodeOverride';
|
|
19
|
-
export * from './Models';
|
|
20
20
|
export * from './PhysicsDebugRaycast';
|
|
21
21
|
export * from './PhysicsDebugRaycasts';
|
|
22
22
|
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 { modelNodeOverrideSchema } from './ModelNodeOverride';
|
|
3
|
-
import { vectorSchema } from './Vector';
|
|
4
|
-
import type { JSONSchemaType } from 'ajv';
|
|
5
|
-
import type { QuaternionSchema } from './Quaternion';
|
|
6
|
-
import type { ModelNodeOverrideSchema } from './ModelNodeOverride';
|
|
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?: ModelNodeOverrideSchema[]; // 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: { ...modelNodeOverrideSchema }, 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
|
-
}
|
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
|
-
}
|