@hytopia.com/server-protocol 1.3.27 → 1.3.29

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hytopia.com/server-protocol",
3
- "version": "1.3.27",
3
+ "version": "1.3.29",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -37,6 +37,7 @@ export enum PacketId {
37
37
  CAMERA = 40,
38
38
  UI = 41,
39
39
  UI_DATAS = 42,
40
+ SCENE_UIS = 43,
40
41
 
41
42
  // Debug Inbound Packet Types: 128 - 191 range
42
43
  DEBUG_CONFIG = 128,
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { sceneUIsSchema } from '../../schemas/SceneUIs';
4
+ import type { SceneUIsSchema } from '../../schemas/SceneUIs';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type SceneUIsPacket = IPacket<typeof PacketId.SCENE_UIS, SceneUIsSchema> & [WorldTick];
8
+
9
+ export const sceneUIsPacketDefinition = definePacket(
10
+ PacketId.SCENE_UIS,
11
+ sceneUIsSchema,
12
+ );
@@ -7,6 +7,7 @@ export * from './Chunks';
7
7
  export * from './Entities';
8
8
  export * from './PhysicsDebugRender';
9
9
  export * from './PhysicsDebugRaycasts';
10
+ export * from './SceneUIs';
10
11
  export * from './SyncResponse';
11
12
  export * from './UI';
12
13
  export * from './UIDatas';
@@ -0,0 +1,26 @@
1
+ import { vectorSchema } from './Vector';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { VectorSchema } from './Vector';
4
+
5
+ export type SceneUISchema = {
6
+ i: number; // scene ui id
7
+ e?: number; // entity attachment, follows entity id
8
+ o?: VectorSchema; // offset
9
+ p?: VectorSchema; // spatial position of ui
10
+ rm?: boolean; // remove/removed
11
+ t?: string; // template id
12
+ }
13
+
14
+ export const sceneUISchema: JSONSchemaType<SceneUISchema> = {
15
+ type: 'object',
16
+ properties: {
17
+ i: { type: 'number' },
18
+ e: { type: 'number', nullable: true },
19
+ o: { ...vectorSchema, nullable: true },
20
+ p: { ...vectorSchema, nullable: true },
21
+ rm: { type: 'boolean', nullable: true },
22
+ t: { type: 'string', nullable: true },
23
+ },
24
+ required: ['i'],
25
+ additionalProperties: false,
26
+ }
@@ -0,0 +1,10 @@
1
+ import { sceneUISchema } from './SceneUI';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { SceneUISchema } from './SceneUI';
4
+
5
+ export type SceneUIsSchema = SceneUISchema[];
6
+
7
+ export const sceneUIsSchema: JSONSchemaType<SceneUIsSchema> = {
8
+ type: 'array',
9
+ items: { ...sceneUISchema },
10
+ }
package/schemas/index.ts CHANGED
@@ -19,6 +19,8 @@ export * from './PhysicsDebugRaycasts';
19
19
  export * from './PhysicsDebugRender';
20
20
  export * from './Quaternion';
21
21
  export * from './RgbColor';
22
+ export * from './SceneUI';
23
+ export * from './SceneUIs';
22
24
  export * from './StateRequest';
23
25
  export * from './SyncRequest';
24
26
  export * from './SyncResponse';