hytopia 0.3.28 → 0.3.30

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.
Files changed (60) hide show
  1. package/docs/server.audio.cutoffdistance.md +13 -0
  2. package/docs/server.audio.md +36 -1
  3. package/docs/server.audio.referencedistance.md +1 -1
  4. package/docs/server.audio.setcutoffdistance.md +57 -0
  5. package/docs/server.audio.setreferencedistance.md +4 -0
  6. package/docs/server.audioevent.md +14 -0
  7. package/docs/server.audioeventpayloads._audio.set_cutoff_distance_.md +16 -0
  8. package/docs/server.audioeventpayloads.md +19 -0
  9. package/docs/server.audiooptions.cutoffdistance.md +13 -0
  10. package/docs/server.audiooptions.md +20 -1
  11. package/docs/server.audiooptions.referencedistance.md +1 -1
  12. package/docs/server.playerentity.md +2 -2
  13. package/examples/hygrounds/assets/icons/ranks/bronze-1.png +0 -0
  14. package/examples/hygrounds/assets/icons/ranks/bronze-2.png +0 -0
  15. package/examples/hygrounds/assets/icons/ranks/bronze-3.png +0 -0
  16. package/examples/hygrounds/assets/icons/ranks/bronze-4.png +0 -0
  17. package/examples/hygrounds/assets/icons/ranks/bronze-5.png +0 -0
  18. package/examples/hygrounds/assets/icons/ranks/diamond-1.png +0 -0
  19. package/examples/hygrounds/assets/icons/ranks/diamond-2.png +0 -0
  20. package/examples/hygrounds/assets/icons/ranks/diamond-3.png +0 -0
  21. package/examples/hygrounds/assets/icons/ranks/diamond-4.png +0 -0
  22. package/examples/hygrounds/assets/icons/ranks/diamond-5.png +0 -0
  23. package/examples/hygrounds/assets/icons/ranks/elite-1.png +0 -0
  24. package/examples/hygrounds/assets/icons/ranks/elite-2.png +0 -0
  25. package/examples/hygrounds/assets/icons/ranks/elite-3.png +0 -0
  26. package/examples/hygrounds/assets/icons/ranks/elite-4.png +0 -0
  27. package/examples/hygrounds/assets/icons/ranks/elite-5.png +0 -0
  28. package/examples/hygrounds/assets/icons/ranks/gold-1.png +0 -0
  29. package/examples/hygrounds/assets/icons/ranks/gold-2.png +0 -0
  30. package/examples/hygrounds/assets/icons/ranks/gold-3.png +0 -0
  31. package/examples/hygrounds/assets/icons/ranks/gold-4.png +0 -0
  32. package/examples/hygrounds/assets/icons/ranks/gold-5.png +0 -0
  33. package/examples/hygrounds/assets/icons/ranks/platinum-1.png +0 -0
  34. package/examples/hygrounds/assets/icons/ranks/platinum-2.png +0 -0
  35. package/examples/hygrounds/assets/icons/ranks/platinum-3.png +0 -0
  36. package/examples/hygrounds/assets/icons/ranks/platinum-4.png +0 -0
  37. package/examples/hygrounds/assets/icons/ranks/platinum-5.png +0 -0
  38. package/examples/hygrounds/assets/icons/ranks/silver-1.png +0 -0
  39. package/examples/hygrounds/assets/icons/ranks/silver-2.png +0 -0
  40. package/examples/hygrounds/assets/icons/ranks/silver-3.png +0 -0
  41. package/examples/hygrounds/assets/icons/ranks/silver-4.png +0 -0
  42. package/examples/hygrounds/assets/icons/ranks/silver-5.png +0 -0
  43. package/examples/hygrounds/assets/icons/ranks/unranked.png +0 -0
  44. package/examples/hygrounds/assets/ui/index.html +305 -44
  45. package/examples/hygrounds/classes/ChestEntity.ts +1 -0
  46. package/examples/hygrounds/classes/GameManager.ts +17 -7
  47. package/examples/hygrounds/classes/GamePlayerEntity.ts +103 -3
  48. package/examples/hygrounds/classes/GunEntity.ts +3 -0
  49. package/examples/hygrounds/classes/ItemEntity.ts +1 -0
  50. package/examples/hygrounds/classes/MeleeWeaponEntity.ts +2 -0
  51. package/examples/hygrounds/classes/weapons/PistolEntity.ts +1 -1
  52. package/examples/hygrounds/classes/weapons/RocketLauncherEntity.ts +2 -1
  53. package/examples/hygrounds/dev/persistence/player-player-1.json +3 -0
  54. package/examples/hygrounds/dev/persistence/player-player-2.json +3 -0
  55. package/examples/hygrounds/dev/persistence/player-player-3.json +3 -0
  56. package/examples/hygrounds/gameConfig.ts +281 -21
  57. package/package.json +1 -1
  58. package/server.api.json +175 -4
  59. package/server.d.ts +36 -7
  60. package/server.js +117 -117
package/server.d.ts CHANGED
@@ -4,7 +4,6 @@ import EventEmitter from 'eventemitter3';
4
4
  import http from 'http';
5
5
  import type { IncomingMessage } from 'http';
6
6
  import type { InputSchema } from '@hytopia.com/server-protocol';
7
- import type { IPacket } from '@hytopia.com/server-protocol';
8
7
  import type { LobbyMembershipDto } from '@hytopia.com/creative-lib/dist/impl/getSession';
9
8
  import protocol from '@hytopia.com/server-protocol';
10
9
  import RAPIER from '@dimforge/rapier3d-compat-simd';
@@ -54,6 +53,7 @@ export declare class Audio extends EventRouter implements protocol.Serializable
54
53
 
55
54
 
56
55
 
56
+
57
57
  /**
58
58
  * @param options - The options for the Audio instance.
59
59
  */
@@ -62,6 +62,8 @@ export declare class Audio extends EventRouter implements protocol.Serializable
62
62
  get id(): number | undefined;
63
63
  /** The entity to which the audio is attached if explicitly set. */
64
64
  get attachedToEntity(): Entity | undefined;
65
+ /** The cutoff distance where the audio will be reduced to 0 volume. */
66
+ get cutoffDistance(): number;
65
67
  /** The duration of the audio in seconds if explicitly set. */
66
68
  get duration(): number | undefined;
67
69
  /** The detune of the audio in cents if explicitly set. */
@@ -83,7 +85,7 @@ export declare class Audio extends EventRouter implements protocol.Serializable
83
85
  /** The playback rate of the audio if explicitly set. */
84
86
  get playbackRate(): number | undefined;
85
87
  /** The reference distance of the audio if explicitly set. */
86
- get referenceDistance(): number | undefined;
88
+ get referenceDistance(): number;
87
89
  /** The server tick at which the audio started playing. */
88
90
  get startTick(): number | undefined;
89
91
  /** The URI of the audio asset. */
@@ -109,6 +111,19 @@ export declare class Audio extends EventRouter implements protocol.Serializable
109
111
  * @param entity - The entity to attach the Audio to.
110
112
  */
111
113
  setAttachedToEntity(entity: Entity): void;
114
+ /**
115
+ * Sets the cutoff distance of the audio.
116
+ *
117
+ * @remarks
118
+ * The cutoff distance defines the maximum range at which the audio can be heard.
119
+ * Beyond this distance, the audio volume becomes zero. As the listener moves
120
+ * from the reference distance toward the cutoff distance, the volume decreases
121
+ * linearly, providing a natural spatial audio experience with smooth volume
122
+ * falloff based on distance.
123
+ *
124
+ * @param cutoffDistance - The cutoff distance.
125
+ */
126
+ setCutoffDistance(cutoffDistance: number): void;
112
127
  /**
113
128
  * Sets the detune of the audio.
114
129
  *
@@ -136,6 +151,14 @@ export declare class Audio extends EventRouter implements protocol.Serializable
136
151
  /**
137
152
  * Sets the reference distance of the audio.
138
153
  *
154
+ * @remarks
155
+ * The reference distance defines the range within which the audio plays at
156
+ * full volume. When a listener is within this distance from the audio source,
157
+ * they will hear the sound at its maximum volume. Beyond this distance, the
158
+ * volume decreases linearly until reaching the cutoff distance, where the
159
+ * sound becomes inaudible. This creates a natural spatial audio experience
160
+ * with smooth volume falloff based on distance.
161
+ *
139
162
  * @param referenceDistance - The reference distance.
140
163
  */
141
164
  setReferenceDistance(referenceDistance: number): void;
@@ -155,6 +178,7 @@ export declare enum AudioEvent {
155
178
  PLAY = "AUDIO.PLAY",
156
179
  PLAY_RESTART = "AUDIO.PLAY_RESTART",
157
180
  SET_ATTACHED_TO_ENTITY = "AUDIO.SET_ATTACHED_TO_ENTITY",
181
+ SET_CUTOFF_DISTANCE = "AUDIO.SET_CUTOFF_DISTANCE",
158
182
  SET_DETUNE = "AUDIO.SET_DETUNE",
159
183
  SET_DISTORTION = "AUDIO.SET_DISTORTION",
160
184
  SET_POSITION = "AUDIO.SET_POSITION",
@@ -182,6 +206,11 @@ export declare interface AudioEventPayloads {
182
206
  audio: Audio;
183
207
  entity: Entity | undefined;
184
208
  };
209
+ /** Emitted when the audio's cutoff distance is set. */
210
+ [AudioEvent.SET_CUTOFF_DISTANCE]: {
211
+ audio: Audio;
212
+ cutoffDistance: number;
213
+ };
185
214
  /** Emitted when the audio's detune is set. */
186
215
  [AudioEvent.SET_DETUNE]: {
187
216
  audio: Audio;
@@ -283,6 +312,8 @@ export declare class AudioManager {
283
312
  export declare interface AudioOptions {
284
313
  /** If set, audio playback will follow the entity's position. */
285
314
  attachedToEntity?: Entity;
315
+ /** The cutoff distance between the audio source and the listener where the audio will be reduced to 0 volume. Must be greater than reference distance. Defaults to reference distance + 10. */
316
+ cutoffDistance?: number;
286
317
  /** The duration of the audio in seconds. Defaults to full duration. */
287
318
  duration?: number;
288
319
  /** The detuning of the audio in cents. */
@@ -297,7 +328,7 @@ export declare interface AudioOptions {
297
328
  position?: Vector3Like;
298
329
  /** The playback speed of the audio. Defaults to 1. */
299
330
  playbackRate?: number;
300
- /** The reference distance for reducing volume as the audio source moves away from the listener. */
331
+ /** The maximum reference distance between the audio source and the listener where the audio will still be max volume. Defaults to 10. */
301
332
  referenceDistance?: number;
302
333
  /** The URI or path to the audio asset to be played. */
303
334
  uri: string;
@@ -3537,8 +3568,8 @@ export declare type PlayerCameraOrientation = {
3537
3568
  * const playerEntity = new PlayerEntity({
3538
3569
  * player,
3539
3570
  * name: 'Player',
3540
- * modelUri: 'models/player-with-gun.gltf',
3541
- * modelLoopedAnimations: [ 'idle' ],
3571
+ * modelUri: 'models/players/player.gltf',
3572
+ * modelLoopedAnimations: [ 'idle_lower', 'idle_upper' ],
3542
3573
  * modelScale: 0.5,
3543
3574
  * });
3544
3575
  *
@@ -3765,8 +3796,6 @@ export declare class PlayerManager {
3765
3796
  static readonly instance: PlayerManager;
3766
3797
 
3767
3798
 
3768
-
3769
-
3770
3799
  /**
3771
3800
  * Get all connected players.
3772
3801
  * @returns An array of all connected players.