@hytopia.com/server-protocol 1.3.47 → 1.3.48

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.47",
3
+ "version": "1.3.48",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -39,6 +39,7 @@ export enum PacketId {
39
39
  UI_DATAS = 42,
40
40
  SCENE_UIS = 43,
41
41
  LIGHTS = 44,
42
+ PLAYERS = 45,
42
43
 
43
44
  // Debug Inbound Packet Types: 128 - 191 range
44
45
  DEBUG_CONFIG = 128,
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { playersSchema } from '../../schemas/Players';
4
+ import type { PlayersSchema } from '../../schemas/Players';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type PlayersPacket = IPacket<typeof PacketId.PLAYERS, PlayersSchema> & [WorldTick];
8
+
9
+ export const playersPacketDefinition = definePacket(
10
+ PacketId.PLAYERS,
11
+ playersSchema,
12
+ );
@@ -8,6 +8,7 @@ export * from './Entities';
8
8
  export * from './Lights';
9
9
  export * from './PhysicsDebugRender';
10
10
  export * from './PhysicsDebugRaycasts';
11
+ export * from './Players';
11
12
  export * from './SceneUIs';
12
13
  export * from './SyncResponse';
13
14
  export * from './UI';
@@ -0,0 +1,20 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+
3
+ export type PlayerSchema = {
4
+ i: string; // player id
5
+ u?: string; // username
6
+ p?: string; // profile picture url
7
+ rm?: boolean; // removed/left game
8
+ }
9
+
10
+ export const playerSchema: JSONSchemaType<PlayerSchema> = {
11
+ type: 'object',
12
+ properties: {
13
+ i: { type: 'string' },
14
+ u: { type: 'string', nullable: true },
15
+ p: { type: 'string', nullable: true },
16
+ rm: { type: 'boolean', nullable: true },
17
+ },
18
+ required: [ 'i' ],
19
+ additionalProperties: false,
20
+ }
@@ -0,0 +1,10 @@
1
+ import { playerSchema } from './Player';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { PlayerSchema } from './Player';
4
+
5
+ export type PlayersSchema = PlayerSchema[];
6
+
7
+ export const playersSchema: JSONSchemaType<PlayersSchema> = {
8
+ type: 'array',
9
+ items: { ...playerSchema },
10
+ }
package/schemas/index.ts CHANGED
@@ -20,6 +20,8 @@ export * from './ModelNodeOverride';
20
20
  export * from './PhysicsDebugRaycast';
21
21
  export * from './PhysicsDebugRaycasts';
22
22
  export * from './PhysicsDebugRender';
23
+ export * from './Player';
24
+ export * from './Players';
23
25
  export * from './Quaternion';
24
26
  export * from './RgbColor';
25
27
  export * from './SceneUI';