@hytopia.com/server-protocol 1.2.2 → 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.2",
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';
@@ -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';