@hytopia.com/server-protocol 1.3.7 → 1.3.9

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.7",
3
+ "version": "1.3.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { cameraSchema } from '../../schemas';
4
+ import type { CameraSchema } from '../../schemas';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type CameraPacket = IPacket<typeof PacketId.CAMERA, CameraSchema> & [WorldTick];
8
+
9
+ export const cameraPacketDefinition = definePacket(
10
+ PacketId.CAMERA,
11
+ cameraSchema,
12
+ )
package/schemas/Camera.ts CHANGED
@@ -3,16 +3,15 @@ import { vectorSchema } from './Vector';
3
3
  import type { VectorSchema } from './Vector';
4
4
 
5
5
  export type CameraSchema = {
6
- f?: boolean // first person mode
7
- t?: boolean // third person mode
6
+ m?: number // camera mode - 0: first person, 1: third person
8
7
  e?: number // entity id to fix camera to
9
- el?: number // entity id to look at
8
+ et?: number // entity id to track
10
9
  fo?: number // film offset, + value shifts right, - shifts left
11
10
  ffo?: number // first person forward offset, moves camera in (+) or out (-) relative to camera position
12
11
  fv?: number // field of view
13
12
  p?: VectorSchema // position to fix camera at
14
- pl?: VectorSchema // position to look at
15
- h?: string[] // player model parts to hide by partial case insensitive match of gltf children names
13
+ pt?: VectorSchema // position to track
14
+ h?: string[] // player model parts to hide by partial case insensitive match of gltf node names
16
15
  o?: VectorSchema // offset - positional relative to target
17
16
  z?: number // zoom
18
17
  }
@@ -20,15 +19,14 @@ export type CameraSchema = {
20
19
  export const cameraSchema: JSONSchemaType<CameraSchema> = {
21
20
  type: 'object',
22
21
  properties: {
23
- f: { type: 'boolean', nullable: true },
24
- t: { type: 'boolean', nullable: true },
22
+ m: { type: 'number', nullable: true },
25
23
  e: { type: 'number', nullable: true },
26
- el: { type: 'number', nullable: true },
24
+ et: { type: 'number', nullable: true },
27
25
  fo: { type: 'number', nullable: true },
28
26
  ffo: { type: 'number', nullable: true },
29
27
  fv: { type: 'number', nullable: true },
30
28
  p: { ...vectorSchema, nullable: true },
31
- pl: { ...vectorSchema, nullable: true },
29
+ pt: { ...vectorSchema, nullable: true },
32
30
  h: { type: 'array', items: { type: 'string' }, nullable: true },
33
31
  o: { ...vectorSchema, nullable: true },
34
32
  z: { type: 'number', nullable: true },