@hytopia.com/server-protocol 1.0.59 → 1.0.61
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
package/packets/PacketCore.ts
CHANGED
|
@@ -23,6 +23,7 @@ export enum PacketId {
|
|
|
23
23
|
DEBUG_CONFIG = 1,
|
|
24
24
|
INPUT = 2,
|
|
25
25
|
STATE_REQUEST = 3,
|
|
26
|
+
MESSAGE_SEND = 4,
|
|
26
27
|
|
|
27
28
|
// Standard Outbound Packet Types: 32 - 127 range
|
|
28
29
|
SYNC_RESPONSE = 32,
|
|
@@ -33,6 +34,7 @@ export enum PacketId {
|
|
|
33
34
|
ENTITY = 37,
|
|
34
35
|
SIMULATION = 38,
|
|
35
36
|
WORLD = 39,
|
|
37
|
+
MESSAGE = 40,
|
|
36
38
|
|
|
37
39
|
// Debug Inbound Packet Types: 128 - 191 range
|
|
38
40
|
// NONE atm, start at 128
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { messageSchema } from '../../schemas/Message';
|
|
4
|
+
import type { MessageSchema } from '../../schemas/Message';
|
|
5
|
+
|
|
6
|
+
export type MessageSendPacket = IPacket<typeof PacketId.MESSAGE_SEND, MessageSchema>;
|
|
7
|
+
|
|
8
|
+
export const messageSendPacketDefinition = definePacket(
|
|
9
|
+
PacketId.MESSAGE_SEND,
|
|
10
|
+
messageSchema
|
|
11
|
+
);
|
package/packets/inbound/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { messageSchema } from '../../schemas/Message';
|
|
4
|
+
import type { MessageSchema } from '../../schemas/Message';
|
|
5
|
+
import type { WorldTick } from '../PacketCore';
|
|
6
|
+
|
|
7
|
+
export type MessagePacket = IPacket<typeof PacketId.MESSAGE, MessageSchema> & [WorldTick];
|
|
8
|
+
|
|
9
|
+
export const messagePacketDefinition = definePacket(
|
|
10
|
+
PacketId.MESSAGE,
|
|
11
|
+
messageSchema,
|
|
12
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
|
|
3
|
+
export type MessageSchema = {
|
|
4
|
+
m: string; // message
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const messageSchema: JSONSchemaType<MessageSchema> = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
m: { type: 'string' },
|
|
11
|
+
},
|
|
12
|
+
required: ['m'],
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
}
|
package/schemas/RigidBody.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type RigidBodySchema = {
|
|
|
25
25
|
ld?: number; // linear damping
|
|
26
26
|
lv?: VectorSchema; // linear velocity
|
|
27
27
|
r?: QuaternionSchema; // rotation
|
|
28
|
+
rm?: boolean; // removed
|
|
28
29
|
sl?: boolean; // sleeping
|
|
29
30
|
scp?: number; // soft ccd prediction
|
|
30
31
|
t?: VectorSchema; // translation
|
|
@@ -49,6 +50,7 @@ export const rigidBodySchema: JSONSchemaType<RigidBodySchema> = {
|
|
|
49
50
|
ld: { type: 'number', nullable: true },
|
|
50
51
|
lv: { ...vectorSchema, nullable: true },
|
|
51
52
|
r: { ...quaternionSchema, nullable: true },
|
|
53
|
+
rm: { type: 'boolean', nullable: true },
|
|
52
54
|
sl: { type: 'boolean', nullable: true },
|
|
53
55
|
scp: { type: 'number', nullable: true },
|
|
54
56
|
t: { ...vectorSchema, nullable: true },
|