@hytopia.com/server-protocol 1.2.1 → 1.2.3

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.2.1",
3
+ "version": "1.2.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -37,7 +37,8 @@ export enum PacketId {
37
37
  DEBUG_CONFIG = 128,
38
38
 
39
39
  // Debug Outbound Packet Types: 192 - 255 range
40
- PHYSICS_DEBUG_RENDER = 192
40
+ PHYSICS_DEBUG_RENDER = 192,
41
+ PHYSICS_DEBUG_RAYCASTS = 193,
41
42
  }
42
43
 
43
44
  /*
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { physicsDebugRaycastsSchema } from '../../schemas/PhysicsDebugRaycasts';
4
+ import type { PhysicsDebugRaycastsSchema } from '../../schemas/PhysicsDebugRaycasts';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type PhysicsDebugRaycastsPacket = IPacket<typeof PacketId.PHYSICS_DEBUG_RAYCASTS, PhysicsDebugRaycastsSchema> & [WorldTick];
8
+
9
+ export const physicsDebugRaycastsPacketDefinition = definePacket(
10
+ PacketId.PHYSICS_DEBUG_RAYCASTS,
11
+ physicsDebugRaycastsSchema,
12
+ );
@@ -4,5 +4,6 @@ export * from './ChatMessages';
4
4
  export * from './Chunks';
5
5
  export * from './Entities';
6
6
  export * from './PhysicsDebugRender';
7
+ export * from './PhysicsDebugRaycasts';
7
8
  export * from './SyncResponse';
8
9
  export * from './World';
package/schemas/Input.ts CHANGED
@@ -1,6 +1,16 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
3
  export type InputSchema = {
4
+ '1'?: boolean; // 1 key pressed
5
+ '2'?: boolean; // 2 key pressed
6
+ '3'?: boolean; // 3 key pressed
7
+ '4'?: boolean; // 4 key pressed
8
+ '5'?: boolean; // 5 key pressed
9
+ '6'?: boolean; // 6 key pressed
10
+ '7'?: boolean; // 7 key pressed
11
+ '8'?: boolean; // 8 key pressed
12
+ '9'?: boolean; // 9 key pressed
13
+ '0'?: boolean; // 0 key pressed
4
14
  w?: boolean; // w key pressed
5
15
  a?: boolean; // a key pressed
6
16
  s?: boolean; // s key pressed
@@ -13,16 +23,6 @@ export type InputSchema = {
13
23
  x?: boolean; // x key pressed
14
24
  c?: boolean; // c key pressed
15
25
  v?: boolean; // v key pressed
16
- 1?: boolean; // 1 key pressed
17
- 2?: boolean; // 2 key pressed
18
- 3?: boolean; // 3 key pressed
19
- 4?: boolean; // 4 key pressed
20
- 5?: boolean; // 5 key pressed
21
- 6?: boolean; // 6 key pressed
22
- 7?: boolean; // 7 key pressed
23
- 8?: boolean; // 8 key pressed
24
- 9?: boolean; // 9 key pressed
25
- 0?: boolean; // 0 key pressed
26
26
  sp?: boolean; // space key pressed
27
27
  sh?: boolean; // shift key pressed
28
28
  tb?: boolean; // tab key pressed
@@ -35,6 +35,16 @@ export type InputSchema = {
35
35
  export const inputSchema: JSONSchemaType<InputSchema> = {
36
36
  type: 'object',
37
37
  properties: {
38
+ '1': { type: 'boolean', nullable: true },
39
+ '2': { type: 'boolean', nullable: true },
40
+ '3': { type: 'boolean', nullable: true },
41
+ '4': { type: 'boolean', nullable: true },
42
+ '5': { type: 'boolean', nullable: true },
43
+ '6': { type: 'boolean', nullable: true },
44
+ '7': { type: 'boolean', nullable: true },
45
+ '8': { type: 'boolean', nullable: true },
46
+ '9': { type: 'boolean', nullable: true },
47
+ '0': { type: 'boolean', nullable: true },
38
48
  w: { type: 'boolean', nullable: true },
39
49
  a: { type: 'boolean', nullable: true },
40
50
  s: { type: 'boolean', nullable: true },
@@ -47,16 +57,6 @@ export const inputSchema: JSONSchemaType<InputSchema> = {
47
57
  x: { type: 'boolean', nullable: true },
48
58
  c: { type: 'boolean', nullable: true },
49
59
  v: { type: 'boolean', nullable: true },
50
- 1: { type: 'boolean', nullable: true },
51
- 2: { type: 'boolean', nullable: true },
52
- 3: { type: 'boolean', nullable: true },
53
- 4: { type: 'boolean', nullable: true },
54
- 5: { type: 'boolean', nullable: true },
55
- 6: { type: 'boolean', nullable: true },
56
- 7: { type: 'boolean', nullable: true },
57
- 8: { type: 'boolean', nullable: true },
58
- 9: { type: 'boolean', nullable: true },
59
- 0: { type: 'boolean', nullable: true },
60
60
  sp: { type: 'boolean', nullable: true },
61
61
  sh: { type: 'boolean', nullable: true },
62
62
  tb: { type: 'boolean', nullable: true },
@@ -0,0 +1,20 @@
1
+ import { vectorSchema } from './Vector';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { VectorSchema } from './Vector';
4
+
5
+ export type PhysicsDebugRaycastSchema = {
6
+ o: VectorSchema; // rapier raycast origin
7
+ d: VectorSchema; // rapier raycast direction
8
+ l: number; // rapier raycast length
9
+ }
10
+
11
+ export const physicsDebugRaycastSchema: JSONSchemaType<PhysicsDebugRaycastSchema> = {
12
+ type: 'object',
13
+ properties: {
14
+ o: { ...vectorSchema },
15
+ d: { ...vectorSchema },
16
+ l: { type: 'number' },
17
+ },
18
+ required: [ 'o', 'd', 'l' ],
19
+ additionalProperties: false,
20
+ }
@@ -0,0 +1,10 @@
1
+ import { physicsDebugRaycastSchema } from './PhysicsDebugRaycast';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { PhysicsDebugRaycastSchema } from './PhysicsDebugRaycast';
4
+
5
+ export type PhysicsDebugRaycastsSchema = PhysicsDebugRaycastSchema[];
6
+
7
+ export const physicsDebugRaycastsSchema: JSONSchemaType<PhysicsDebugRaycastsSchema> = {
8
+ type: 'array',
9
+ items: { ...physicsDebugRaycastSchema },
10
+ }
package/schemas/index.ts CHANGED
@@ -11,6 +11,8 @@ export * from './Entity';
11
11
  export * from './Entities';
12
12
  export * from './HexColor';
13
13
  export * from './Input';
14
+ export * from './PhysicsDebugRaycast';
15
+ export * from './PhysicsDebugRaycasts';
14
16
  export * from './PhysicsDebugRender';
15
17
  export * from './Quaternion';
16
18
  export * from './StateRequest';