@hytopia.com/server-protocol 1.3.47 → 1.3.49
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 +1 -0
- package/packets/outbound/Players.ts +12 -0
- package/packets/outbound/index.ts +1 -0
- package/schemas/Entity.ts +2 -0
- package/schemas/Player.ts +20 -0
- package/schemas/Players.ts +10 -0
- package/schemas/index.ts +2 -0
package/package.json
CHANGED
package/packets/PacketCore.ts
CHANGED
|
@@ -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
|
+
);
|
package/schemas/Entity.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type EntitySchema = {
|
|
|
23
23
|
o?: number; // opacity
|
|
24
24
|
p?: VectorSchema; // position
|
|
25
25
|
pe?: number; // parent entity id
|
|
26
|
+
pi?: string; // player id
|
|
26
27
|
pn?: string; // parent node name
|
|
27
28
|
r?: QuaternionSchema; // rotation
|
|
28
29
|
rm?: boolean; // removed/remove
|
|
@@ -47,6 +48,7 @@ export const entitySchema: JSONSchemaType<EntitySchema> = {
|
|
|
47
48
|
o: { type: 'number', nullable: true },
|
|
48
49
|
p: { ...vectorSchema, nullable: true },
|
|
49
50
|
pe: { type: 'number', nullable: true },
|
|
51
|
+
pi: { type: 'string', nullable: true },
|
|
50
52
|
pn: { type: 'string', nullable: true },
|
|
51
53
|
r: { ...quaternionSchema, nullable: true },
|
|
52
54
|
rm: { type: 'boolean', nullable: true },
|
|
@@ -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';
|