@hytopia.com/server-protocol 1.3.19 → 1.3.20
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 +3 -0
- package/packets/inbound/UIMessageSend.ts +11 -0
- package/packets/inbound/index.ts +1 -0
- package/packets/outbound/UI.ts +12 -0
- package/packets/outbound/UIMessages.ts +12 -0
- package/packets/outbound/index.ts +2 -0
- package/schemas/UI.ts +17 -0
- package/schemas/UIMessage.ts +11 -0
- package/schemas/UIMessages.ts +10 -0
- package/schemas/index.ts +3 -0
package/package.json
CHANGED
package/packets/PacketCore.ts
CHANGED
|
@@ -23,6 +23,7 @@ export enum PacketId {
|
|
|
23
23
|
INPUT = 1,
|
|
24
24
|
STATE_REQUEST = 2,
|
|
25
25
|
CHAT_MESSAGE_SEND = 3,
|
|
26
|
+
UI_MESSAGE_SEND = 4,
|
|
26
27
|
|
|
27
28
|
// Standard Outbound Packet Types: 32 - 127 range
|
|
28
29
|
SYNC_RESPONSE = 32,
|
|
@@ -34,6 +35,8 @@ export enum PacketId {
|
|
|
34
35
|
ENTITIES = 38,
|
|
35
36
|
WORLD = 39,
|
|
36
37
|
CAMERA = 40,
|
|
38
|
+
UI = 41,
|
|
39
|
+
UI_MESSAGES = 42,
|
|
37
40
|
|
|
38
41
|
// Debug Inbound Packet Types: 128 - 191 range
|
|
39
42
|
DEBUG_CONFIG = 128,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { uiMessageSchema } from '../../schemas/UIMessage';
|
|
4
|
+
import type { UIMessageSchema } from '../../schemas/UIMessage';
|
|
5
|
+
|
|
6
|
+
export type UIMessageSendPacket = IPacket<typeof PacketId.UI_MESSAGE_SEND, UIMessageSchema>;
|
|
7
|
+
|
|
8
|
+
export const uiMessageSendPacketDefinition = definePacket(
|
|
9
|
+
PacketId.UI_MESSAGE_SEND,
|
|
10
|
+
uiMessageSchema
|
|
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 { uiSchema } from '../../schemas/UI';
|
|
4
|
+
import type { UISchema } from '../../schemas/UI';
|
|
5
|
+
import type { WorldTick } from '../PacketCore';
|
|
6
|
+
|
|
7
|
+
export type UIPacket = IPacket<typeof PacketId.UI, UISchema> & [WorldTick];
|
|
8
|
+
|
|
9
|
+
export const uiPacketDefinition = definePacket(
|
|
10
|
+
PacketId.UI,
|
|
11
|
+
uiSchema,
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { definePacket, PacketId } from '../PacketCore';
|
|
2
|
+
import type { IPacket } from '../PacketCore';
|
|
3
|
+
import { uiMessagesSchema } from '../../schemas/UIMessages';
|
|
4
|
+
import type { UIMessagesSchema } from '../../schemas/UIMessages';
|
|
5
|
+
import type { WorldTick } from '../PacketCore';
|
|
6
|
+
|
|
7
|
+
export type UIMessagesPacket = IPacket<typeof PacketId.UI_MESSAGES, UIMessagesSchema> & [WorldTick];
|
|
8
|
+
|
|
9
|
+
export const uiMessagesPacketDefinition = definePacket(
|
|
10
|
+
PacketId.UI_MESSAGES,
|
|
11
|
+
uiMessagesSchema,
|
|
12
|
+
);
|
package/schemas/UI.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSONSchemaType } from 'ajv';
|
|
2
|
+
|
|
3
|
+
export type UISchema = {
|
|
4
|
+
c?: string[]; // css uris
|
|
5
|
+
h?: string[]; // html uris
|
|
6
|
+
j?: string[]; // js uris
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const uiSchema: JSONSchemaType<UISchema> = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
c: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
13
|
+
h: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
14
|
+
j: { type: 'array', items: { type: 'string' }, nullable: true },
|
|
15
|
+
},
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { uiMessageSchema } from './UIMessage';
|
|
2
|
+
import type { JSONSchemaType } from 'ajv';
|
|
3
|
+
import type { UIMessageSchema } from './UIMessage';
|
|
4
|
+
|
|
5
|
+
export type UIMessagesSchema = UIMessageSchema[];
|
|
6
|
+
|
|
7
|
+
export const uiMessagesSchema: JSONSchemaType<UIMessagesSchema> = {
|
|
8
|
+
type: 'array',
|
|
9
|
+
items: { ...uiMessageSchema },
|
|
10
|
+
}
|
package/schemas/index.ts
CHANGED
|
@@ -22,6 +22,9 @@ export * from './RgbColor';
|
|
|
22
22
|
export * from './StateRequest';
|
|
23
23
|
export * from './SyncRequest';
|
|
24
24
|
export * from './SyncResponse';
|
|
25
|
+
export * from './UI';
|
|
26
|
+
export * from './UIMessage';
|
|
27
|
+
export * from './UIMessages';
|
|
25
28
|
export * from './Vector';
|
|
26
29
|
export * from './VectorBoolean';
|
|
27
30
|
export * from './World';
|