@hytopia.com/server-protocol 1.4.9 → 1.4.10-dev2

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.4.9",
3
+ "version": "1.4.10-dev2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -40,6 +40,7 @@ export enum PacketId {
40
40
  SCENE_UIS = 43,
41
41
  LIGHTS = 44,
42
42
  PLAYERS = 45,
43
+ PARTICLE_EMITTERS = 46,
43
44
 
44
45
  // Standard Bi-Directional Packet Types: 116 - 127 range
45
46
  CONNECTION = 116,
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { particleEmittersSchema } from '../../schemas/ParticleEmitters';
4
+ import type { ParticleEmittersSchema } from '../../schemas/ParticleEmitters';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type ParticleEmittersPacket = IPacket<typeof PacketId.PARTICLE_EMITTERS, ParticleEmittersSchema> & [WorldTick];
8
+
9
+ export const particleEmittersPacketDefinition = definePacket(
10
+ PacketId.PARTICLE_EMITTERS,
11
+ particleEmittersSchema,
12
+ );
@@ -6,6 +6,7 @@ export * from './ChatMessages';
6
6
  export * from './Chunks';
7
7
  export * from './Entities';
8
8
  export * from './Lights';
9
+ export * from './ParticleEmitters';
9
10
  export * from './PhysicsDebugRender';
10
11
  export * from './PhysicsDebugRaycasts';
11
12
  export * from './Players';
@@ -0,0 +1,72 @@
1
+ import { rgbColorSchema } from './RgbColor';
2
+ import { vectorSchema } from './Vector';
3
+ import type { JSONSchemaType } from 'ajv';
4
+ import type { RgbColorSchema } from './RgbColor';
5
+ import type { VectorSchema } from './Vector';
6
+
7
+ export type ParticleEmitterSchema = {
8
+ i: number; // particle emitter id
9
+ at?: number; // alpha test, 0 to 1
10
+ ce?: RgbColorSchema; // color end, rgb color
11
+ cev?: RgbColorSchema; // color end variance, rgb color
12
+ cs?: RgbColorSchema; // color start, rgb color
13
+ csv?: RgbColorSchema; // color start variance, rgb color
14
+ e?: number; // entity attachment, follows entity id
15
+ en?: string; // entity attachment node name, follows entity node name
16
+ g?: VectorSchema; // gravity per axis as vector3
17
+ l?: number; // lifetime, in seconds
18
+ lv?: number; // lifetime variance, in seconds
19
+ mp?: number; // max particles
20
+ o?: VectorSchema; // offset
21
+ oe?: number; // opacity end
22
+ oev?: number; // opacity end variance
23
+ os?: number; // opacity start
24
+ osv?: number; // opacity start variance
25
+ p?: VectorSchema; // spatial position
26
+ pv?: VectorSchema; // particle spatial variance relative to attachment or position
27
+ r?: number; // rate, in particles per second
28
+ rv?: number; // rate variance, in particles per second
29
+ rm?: boolean; // remove/removed
30
+ s?: number; // size, in pixels
31
+ sv?: number; // size variance, in pixels
32
+ t?: boolean; // transparent
33
+ tu?: string; // texture uri
34
+ v?: VectorSchema; // velocity per axis as vector3
35
+ vv?: VectorSchema; // velocity variance per axis as vector3
36
+ }
37
+
38
+ export const particleEmitterSchema: JSONSchemaType<ParticleEmitterSchema> = {
39
+ type: 'object',
40
+ properties: {
41
+ i: { type: 'number' },
42
+ at: { type: 'number', nullable: true },
43
+ ce: { ...rgbColorSchema, nullable: true },
44
+ cev: { ...rgbColorSchema, nullable: true },
45
+ cs: { ...rgbColorSchema, nullable: true },
46
+ csv: { ...rgbColorSchema, nullable: true },
47
+ e: { type: 'number', nullable: true },
48
+ en: { type: 'string', nullable: true },
49
+ g: { ...vectorSchema, nullable: true },
50
+ l: { type: 'number', nullable: true },
51
+ lv: { type: 'number', nullable: true },
52
+ mp: { type: 'number', nullable: true },
53
+ o: { ...vectorSchema, nullable: true },
54
+ oe: { type: 'number', nullable: true },
55
+ oev: { type: 'number', nullable: true },
56
+ os: { type: 'number', nullable: true },
57
+ osv: { type: 'number', nullable: true },
58
+ p: { ...vectorSchema, nullable: true },
59
+ pv: { ...vectorSchema, nullable: true },
60
+ r: { type: 'number', nullable: true },
61
+ rv: { type: 'number', nullable: true },
62
+ rm: { type: 'boolean', nullable: true },
63
+ s: { type: 'number', nullable: true },
64
+ sv: { type: 'number', nullable: true },
65
+ t: { type: 'boolean', nullable: true },
66
+ tu: { type: 'string', nullable: true },
67
+ v: { ...vectorSchema, nullable: true },
68
+ vv: { ...vectorSchema, nullable: true },
69
+ },
70
+ required: ['i'],
71
+ additionalProperties: false,
72
+ }
@@ -0,0 +1,10 @@
1
+ import { particleEmitterSchema } from './ParticleEmitter';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { ParticleEmitterSchema } from './ParticleEmitter';
4
+
5
+ export type ParticleEmittersSchema = ParticleEmitterSchema[];
6
+
7
+ export const particleEmittersSchema: JSONSchemaType<ParticleEmittersSchema> = {
8
+ type: 'array',
9
+ items: { ...particleEmitterSchema },
10
+ }
package/schemas/index.ts CHANGED
@@ -19,6 +19,8 @@ export * from './Input';
19
19
  export * from './Light';
20
20
  export * from './Lights';
21
21
  export * from './ModelNodeOverride';
22
+ export * from './ParticleEmitter';
23
+ export * from './ParticleEmitters';
22
24
  export * from './PhysicsDebugRaycast';
23
25
  export * from './PhysicsDebugRaycasts';
24
26
  export * from './PhysicsDebugRender';