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.
- package/docs/server.audio.cutoffdistance.md +13 -0
- package/docs/server.audio.md +36 -1
- package/docs/server.audio.referencedistance.md +1 -1
- package/docs/server.audio.setcutoffdistance.md +57 -0
- package/docs/server.audio.setreferencedistance.md +4 -0
- package/docs/server.audioevent.md +14 -0
- package/docs/server.audioeventpayloads._audio.set_cutoff_distance_.md +16 -0
- package/docs/server.audioeventpayloads.md +19 -0
- package/docs/server.audiooptions.cutoffdistance.md +13 -0
- package/docs/server.audiooptions.md +20 -1
- package/docs/server.audiooptions.referencedistance.md +1 -1
- package/docs/server.playerentity.md +2 -2
- package/examples/hygrounds/assets/icons/ranks/bronze-1.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/bronze-2.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/bronze-3.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/bronze-4.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/bronze-5.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/diamond-1.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/diamond-2.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/diamond-3.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/diamond-4.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/diamond-5.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/elite-1.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/elite-2.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/elite-3.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/elite-4.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/elite-5.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/gold-1.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/gold-2.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/gold-3.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/gold-4.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/gold-5.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/platinum-1.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/platinum-2.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/platinum-3.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/platinum-4.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/platinum-5.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/silver-1.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/silver-2.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/silver-3.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/silver-4.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/silver-5.png +0 -0
- package/examples/hygrounds/assets/icons/ranks/unranked.png +0 -0
- package/examples/hygrounds/assets/ui/index.html +305 -44
- package/examples/hygrounds/classes/ChestEntity.ts +1 -0
- package/examples/hygrounds/classes/GameManager.ts +17 -7
- package/examples/hygrounds/classes/GamePlayerEntity.ts +103 -3
- package/examples/hygrounds/classes/GunEntity.ts +3 -0
- package/examples/hygrounds/classes/ItemEntity.ts +1 -0
- package/examples/hygrounds/classes/MeleeWeaponEntity.ts +2 -0
- package/examples/hygrounds/classes/weapons/PistolEntity.ts +1 -1
- package/examples/hygrounds/classes/weapons/RocketLauncherEntity.ts +2 -1
- package/examples/hygrounds/dev/persistence/player-player-1.json +3 -0
- package/examples/hygrounds/dev/persistence/player-player-2.json +3 -0
- package/examples/hygrounds/dev/persistence/player-player-3.json +3 -0
- package/examples/hygrounds/gameConfig.ts +281 -21
- package/package.json +1 -1
- package/server.api.json +175 -4
- package/server.d.ts +36 -7
- 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
|
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
|
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
|
3541
|
-
* modelLoopedAnimations: [ '
|
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.
|