@hytopia.com/server-protocol 1.0.12 → 1.0.14
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 +4 -2
- package/packets/inbound/DebugConfig.ts +11 -0
- package/packets/inbound/StateRequest.ts +11 -0
- package/packets/inbound/index.ts +1 -0
- package/packets/outbound/BlockTypeRegistry.ts +11 -0
- package/packets/outbound/index.ts +1 -1
- package/schemas/{BlockRegistry.ts → BlockTypeRegistry.ts} +2 -2
- package/schemas/Collider.ts +2 -0
- package/schemas/DebugConfig.ts +17 -0
- package/schemas/Entity.ts +2 -0
- package/schemas/RigidBody.ts +2 -0
- package/schemas/StateRequest.ts +13 -0
- package/schemas/index.ts +1 -1
- package/packets/outbound/BlockRegistry.ts +0 -11
package/package.json
CHANGED
package/packets/PacketCore.ts
CHANGED
|
@@ -20,11 +20,13 @@ import type { JSONSchemaType, ValidateFunction } from 'ajv';
|
|
|
20
20
|
export enum PacketId {
|
|
21
21
|
// Standard Inbound Packet Types: 0 - 31 range
|
|
22
22
|
HEARTBEAT = 0,
|
|
23
|
-
|
|
23
|
+
DEBUG_CONFIG = 1,
|
|
24
|
+
INPUT = 2,
|
|
25
|
+
STATE_REQUEST = 3,
|
|
24
26
|
|
|
25
27
|
// Standard Outbound Packet Types: 32 - 127 range
|
|
26
28
|
BLOCK = 32,
|
|
27
|
-
|
|
29
|
+
BLOCK_TYPE_REGISTRY = 33,
|
|
28
30
|
BLOCK_TYPE = 34,
|
|
29
31
|
CHUNK = 35,
|
|
30
32
|
ENTITY = 36,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { debugConfigSchema } from '../../schemas/DebugConfig';
|
|
4
|
+
import type { DebugConfigSchema } from '../../schemas/DebugConfig';
|
|
5
|
+
|
|
6
|
+
export type DebugConfigPacket = IPacket<typeof PacketId.DEBUG_CONFIG, DebugConfigSchema>;
|
|
7
|
+
|
|
8
|
+
export const debugConfigPacketDefinition = definePacket(
|
|
9
|
+
PacketId.DEBUG_CONFIG,
|
|
10
|
+
debugConfigSchema
|
|
11
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { stateRequestSchema } from '../../schemas/StateRequest';
|
|
4
|
+
import type { StateRequestSchema } from '../../schemas/StateRequest';
|
|
5
|
+
|
|
6
|
+
export type StateRequestPacket = IPacket<typeof PacketId.STATE_REQUEST, StateRequestSchema>;
|
|
7
|
+
|
|
8
|
+
export const stateRequestPacketDefinition = definePacket(
|
|
9
|
+
PacketId.STATE_REQUEST,
|
|
10
|
+
stateRequestSchema
|
|
11
|
+
);
|
package/packets/inbound/index.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { blockTypeRegistrySchema } from '../../schemas/BlockTypeRegistry';
|
|
4
|
+
import type { BlockTypeRegistrySchema } from '../../schemas/BlockTypeRegistry';
|
|
5
|
+
|
|
6
|
+
export type BlockTypeRegistryPacket = IPacket<typeof PacketId.BLOCK_TYPE_REGISTRY, BlockTypeRegistrySchema>;
|
|
7
|
+
|
|
8
|
+
export const blockTypeRegistryPacketDefinition = definePacket(
|
|
9
|
+
PacketId.BLOCK_TYPE_REGISTRY,
|
|
10
|
+
blockTypeRegistrySchema,
|
|
11
|
+
);
|
|
@@ -2,12 +2,12 @@ import { blockTypeSchema } from './BlockType';
|
|
|
2
2
|
import type { JSONSchemaType } from 'ajv';
|
|
3
3
|
import type { BlockTypeSchema } from './BlockType';
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type BlockTypeRegistrySchema = {
|
|
6
6
|
wi: string; // world id
|
|
7
7
|
b: BlockTypeSchema[]; // block types
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const blockTypeRegistrySchema: JSONSchemaType<BlockTypeRegistrySchema> = {
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
|
13
13
|
wi: { type: 'string' },
|
package/schemas/Collider.ts
CHANGED
|
@@ -4,12 +4,14 @@ import type { ColliderDescSchema } from './ColliderDesc';
|
|
|
4
4
|
|
|
5
5
|
export type ColliderSchema = {
|
|
6
6
|
h?: number; // collider handle for rapier
|
|
7
|
+
rm?: boolean; // removed
|
|
7
8
|
} & ColliderDescSchema;
|
|
8
9
|
|
|
9
10
|
export const colliderSchema: JSONSchemaType<ColliderSchema> = {
|
|
10
11
|
type: 'object',
|
|
11
12
|
properties: {
|
|
12
13
|
h: { type: 'number', nullable: true },
|
|
14
|
+
rm: { type: 'boolean', nullable: true },
|
|
13
15
|
...colliderDescSchema.properties
|
|
14
16
|
},
|
|
15
17
|
additionalProperties: false,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
|
|
3
|
+
export type DebugConfigSchema = {
|
|
4
|
+
// physics debug render enabled,
|
|
5
|
+
// setting true will cause the
|
|
6
|
+
// server to send a PhysicsDebugRender
|
|
7
|
+
// packet per tick.
|
|
8
|
+
pdr?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const debugConfigSchema: JSONSchemaType<DebugConfigSchema> = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
pdr: { type: 'boolean', nullable: true },
|
|
15
|
+
},
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
}
|
package/schemas/Entity.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type EntitySchema = {
|
|
|
7
7
|
i: number; // entity id
|
|
8
8
|
d: boolean; // delta
|
|
9
9
|
f?: boolean; // focused
|
|
10
|
+
rm?: boolean; // removed
|
|
10
11
|
n?: string; // name
|
|
11
12
|
m?: string; // model uri
|
|
12
13
|
t?: string; // texture uri
|
|
@@ -20,6 +21,7 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
|
|
|
20
21
|
i: { type: 'number' },
|
|
21
22
|
d: { type: 'boolean' },
|
|
22
23
|
f: { type: 'boolean', nullable: true },
|
|
24
|
+
rm: { type: 'boolean', nullable: true },
|
|
23
25
|
n: { type: 'string', nullable: true },
|
|
24
26
|
m: { type: 'string', nullable: true },
|
|
25
27
|
t: { type: 'string', nullable: true },
|
package/schemas/RigidBody.ts
CHANGED
|
@@ -4,12 +4,14 @@ import { RigidBodyDescSchema } from './RigidBodyDesc';
|
|
|
4
4
|
|
|
5
5
|
export type RigidBodySchema = {
|
|
6
6
|
h?: number; // rigid body handle for rapier
|
|
7
|
+
rm?: boolean; // removed
|
|
7
8
|
} & RigidBodyDescSchema;
|
|
8
9
|
|
|
9
10
|
export const rigidBodySchema: JSONSchemaType<RigidBodySchema> = {
|
|
10
11
|
type: 'object',
|
|
11
12
|
properties: {
|
|
12
13
|
h: { type: 'number', nullable: true },
|
|
14
|
+
rm: { type: 'boolean', nullable: true },
|
|
13
15
|
...rigidBodyDescSchema.properties,
|
|
14
16
|
},
|
|
15
17
|
additionalProperties: false,
|
package/schemas/index.ts
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
-
import type { IPacket } from '../PacketCore';
|
|
3
|
-
import { blockRegistrySchema } from '../../schemas/BlockRegistry';
|
|
4
|
-
import type { BlockRegistrySchema } from '../../schemas/BlockRegistry';
|
|
5
|
-
|
|
6
|
-
export type BlockRegistryPacket = IPacket<typeof PacketId.BLOCK_REGISTRY, BlockRegistrySchema>;
|
|
7
|
-
|
|
8
|
-
export const blockRegistryPacketDefinition = definePacket(
|
|
9
|
-
PacketId.BLOCK_REGISTRY,
|
|
10
|
-
blockRegistrySchema,
|
|
11
|
-
);
|