@hytopia.com/server-protocol 1.3.38 → 1.3.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 +1 -1
- package/packets/PacketCore.ts +1 -1
- package/packets/outbound/Models.ts +12 -0
- package/packets/outbound/index.ts +1 -1
- package/schemas/Model.ts +44 -0
- package/schemas/ModelNode.ts +32 -0
- package/schemas/Models.ts +10 -0
- package/packets/outbound/Entities.ts +0 -12
- package/schemas/Entities.ts +0 -10
- package/schemas/Entity.ts +0 -50
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 { 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
|
+
);
|
|
@@ -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';
|
|
8
7
|
export * from './Lights';
|
|
8
|
+
export * from './Models';
|
|
9
9
|
export * from './PhysicsDebugRender';
|
|
10
10
|
export * from './PhysicsDebugRaycasts';
|
|
11
11
|
export * from './SceneUIs';
|
package/schemas/Model.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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 custom configurations
|
|
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
|
+
u?: string; // model uri
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const modelSchema: JSONSchemaType<ModelSchema> = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
i: { type: 'number' },
|
|
29
|
+
al: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
30
|
+
ao: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
31
|
+
ap: { type: 'number', nullable: true },
|
|
32
|
+
as: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
33
|
+
bh: { ...vectorSchema, nullable: true },
|
|
34
|
+
bt: { type: 'string', nullable: true },
|
|
35
|
+
n: { type: 'array', items: { ...modelNodeSchema }, nullable: true },
|
|
36
|
+
p: { ...vectorSchema, nullable: true },
|
|
37
|
+
pm: { type: 'number', nullable: true },
|
|
38
|
+
pn: { type: 'string', nullable: true },
|
|
39
|
+
r: { ...quaternionSchema, nullable: true },
|
|
40
|
+
u: { type: 'string', nullable: true },
|
|
41
|
+
},
|
|
42
|
+
required: [ 'i' ],
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
);
|
package/schemas/Entities.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|
package/schemas/Entity.ts
DELETED
|
@@ -1,50 +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 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
|
-
}
|