hytopia 0.1.58 → 0.1.60

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 (48) hide show
  1. package/docs/server.audio._constructor_.md +2 -0
  2. package/docs/server.audio.setattachedtoentity.md +1 -1
  3. package/docs/server.audiomanager.md +28 -0
  4. package/docs/server.audiomanager.unregisteraudio.md +53 -0
  5. package/docs/server.audiomanager.unregisterentityattachedaudios.md +53 -0
  6. package/docs/server.blocktype.isliquid.md +13 -0
  7. package/docs/server.blocktype.md +21 -0
  8. package/docs/server.blocktypeoptions.isliquid.md +11 -0
  9. package/docs/server.blocktypeoptions.md +19 -0
  10. package/docs/{server.chunk.getblock.md → server.chunk.getblockid.md} +3 -3
  11. package/docs/server.chunk.md +1 -1
  12. package/docs/{server.chunklattice.getblock.md → server.chunklattice.getblockid.md} +3 -3
  13. package/docs/server.chunklattice.getblocktype.md +55 -0
  14. package/docs/server.chunklattice.md +15 -1
  15. package/docs/server.md +33 -0
  16. package/docs/server.sceneui._constructor_.md +49 -0
  17. package/docs/server.sceneui.attachedtoentity.md +11 -0
  18. package/docs/server.sceneui.id.md +11 -0
  19. package/docs/server.sceneui.isloaded.md +11 -0
  20. package/docs/server.sceneui.load.md +53 -0
  21. package/docs/server.sceneui.md +344 -0
  22. package/docs/server.sceneui.offset.md +11 -0
  23. package/docs/server.sceneui.position.md +11 -0
  24. package/docs/server.sceneui.setattachedtoentity.md +53 -0
  25. package/docs/server.sceneui.setoffset.md +53 -0
  26. package/docs/server.sceneui.setposition.md +53 -0
  27. package/docs/server.sceneui.setstate.md +53 -0
  28. package/docs/server.sceneui.state.md +11 -0
  29. package/docs/server.sceneui.templateid.md +11 -0
  30. package/docs/server.sceneui.unload.md +17 -0
  31. package/docs/server.sceneui.world.md +11 -0
  32. package/docs/server.sceneuimanager.getallentityattachedsceneuis.md +55 -0
  33. package/docs/server.sceneuimanager.getallsceneuis.md +19 -0
  34. package/docs/server.sceneuimanager.md +127 -0
  35. package/docs/server.sceneuimanager.unloadentityattachedsceneuis.md +53 -0
  36. package/docs/server.sceneuimanager.world.md +13 -0
  37. package/docs/server.sceneuioptions.attachedtoentity.md +13 -0
  38. package/docs/server.sceneuioptions.md +133 -0
  39. package/docs/server.sceneuioptions.offset.md +13 -0
  40. package/docs/server.sceneuioptions.position.md +13 -0
  41. package/docs/server.sceneuioptions.state.md +13 -0
  42. package/docs/server.sceneuioptions.templateid.md +13 -0
  43. package/docs/server.world.md +21 -0
  44. package/docs/server.world.sceneuimanager.md +13 -0
  45. package/package.json +1 -1
  46. package/server.api.json +1235 -44
  47. package/server.d.ts +169 -12
  48. package/server.js +83 -83
package/server.d.ts CHANGED
@@ -47,7 +47,7 @@ export declare class Audio implements protocol.Serializable {
47
47
 
48
48
 
49
49
  /**
50
- * @param audioData - The options for the audio instance.
50
+ * @param options - The options for the Audio instance.
51
51
  */
52
52
  constructor(options: AudioOptions);
53
53
  /** The unique identifier for the audio. */
@@ -98,7 +98,7 @@ export declare class Audio implements protocol.Serializable {
98
98
  /**
99
99
  * Sets the entity to which the audio is attached, following its position.
100
100
  *
101
- * @param entity - The entity to attach the audio to.
101
+ * @param entity - The entity to attach the Audio to.
102
102
  */
103
103
  setAttachedToEntity(entity: Entity): void;
104
104
  /**
@@ -221,8 +221,6 @@ export declare class AudioManager {
221
221
 
222
222
  /** The world the audio manager is for. */
223
223
  get world(): World;
224
-
225
-
226
224
  /**
227
225
  * Retrieves all loaded audio instances for the world.
228
226
  *
@@ -248,6 +246,19 @@ export declare class AudioManager {
248
246
  * @returns An array of audio instances.
249
247
  */
250
248
  getAllOneshotAudios(): Audio[];
249
+
250
+ /**
251
+ * Unregisters and stops an audio instance from the audio manager.
252
+ *
253
+ * @param audio - The audio instance to pause and unregister.
254
+ */
255
+ unregisterAudio(audio: Audio): void;
256
+ /**
257
+ * Unregisters and stops all audio instances attached to a specific entity.
258
+ *
259
+ * @param entity - The entity to pause and unregister audio instances for.
260
+ */
261
+ unregisterEntityAttachedAudios(entity: Entity): void;
251
262
  }
252
263
 
253
264
  /** Options for creating an Audio instance. @public */
@@ -453,6 +464,7 @@ export declare class BlockType implements protocol.Serializable {
453
464
 
454
465
 
455
466
 
467
+
456
468
  /**
457
469
  * Creates a new block type instance.
458
470
  * @param world - The world the block type is for.
@@ -463,12 +475,14 @@ export declare class BlockType implements protocol.Serializable {
463
475
  get id(): number;
464
476
  /** The collider options for the block type. */
465
477
  get colliderOptions(): ColliderOptions;
466
- /** The URI of the texture for the block type. */
467
- get textureUri(): string;
468
- /** The name of the block type. */
469
- get name(): string;
478
+ /** Whether the block type is a liquid. */
479
+ get isLiquid(): boolean;
470
480
  /** Whether the block type is meshable. */
471
481
  get isMeshable(): boolean;
482
+ /** The name of the block type. */
483
+ get name(): string;
484
+ /** The URI of the texture for the block type. */
485
+ get textureUri(): string;
472
486
 
473
487
 
474
488
  }
@@ -476,9 +490,10 @@ export declare class BlockType implements protocol.Serializable {
476
490
  /** Options for creating a block type instance. @public */
477
491
  export declare interface BlockTypeOptions {
478
492
  id: number;
479
- textureUri: string;
480
- name: string;
481
493
  customColliderOptions?: ColliderOptions;
494
+ isLiquid?: boolean;
495
+ name: string;
496
+ textureUri: string;
482
497
  }
483
498
 
484
499
  /**
@@ -727,7 +742,7 @@ export declare class Chunk implements protocol.Serializable {
727
742
  * @param localCoordinate - The local coordinate of the block to get.
728
743
  * @returns The block type id.
729
744
  */
730
- getBlock(localCoordinate: Vector3Like): number;
745
+ getBlockId(localCoordinate: Vector3Like): number;
731
746
  /**
732
747
  * Check if a block exists at a specific local coordinate.
733
748
  * @param localCoordinate - The local coordinate of the block to check.
@@ -796,7 +811,13 @@ export declare class ChunkLattice {
796
811
  * @param globalCoordinate - The global coordinate of the block to get.
797
812
  * @returns The block type id, 0 if no block is set.
798
813
  */
799
- getBlock(globalCoordinate: Vector3Like): number;
814
+ getBlockId(globalCoordinate: Vector3Like): number;
815
+ /**
816
+ * Get the block type at a specific global coordinate.
817
+ * @param globalCoordinate - The global coordinate of the block to get.
818
+ * @returns The block type, null if no block is set.
819
+ */
820
+ getBlockType(globalCoordinate: Vector3Like): BlockType | null;
800
821
  /**
801
822
  * Get a chunk by its origin coordinate.
802
823
  * @param originCoordinate - The origin coordinate of the chunk to get.
@@ -2887,6 +2908,139 @@ export declare enum RigidBodyType {
2887
2908
  KINEMATIC_VELOCITY = "kinematic_velocity"
2888
2909
  }
2889
2910
 
2911
+ /**
2912
+ * UI rendered within the 3D space of a world's
2913
+ * game scene.
2914
+ *
2915
+ * @remarks
2916
+ * SceneUI instances are created directly as instances.
2917
+ * They support a variety of configuration options through
2918
+ * the {@link SceneUIOptions} constructor argument.
2919
+ *
2920
+ * @example
2921
+ * ```typescript
2922
+ * const sceneUI = new SceneUI({
2923
+ * templateId: 'player-health-bar',
2924
+ * attachedToEntity: playerEntity,
2925
+ * offset: { x: 0, y: 1, z: 0 },
2926
+ * });
2927
+ * ```
2928
+ *
2929
+ * @public
2930
+ */
2931
+ export declare class SceneUI implements protocol.Serializable {
2932
+
2933
+
2934
+
2935
+
2936
+
2937
+
2938
+
2939
+ /**
2940
+ * @param options - The options for the SceneUI instance.
2941
+ */
2942
+ constructor(options: SceneUIOptions);
2943
+ get id(): number | undefined;
2944
+ get attachedToEntity(): Entity | undefined;
2945
+ get isLoaded(): boolean;
2946
+ get offset(): Vector3Like | undefined;
2947
+ get position(): Vector3Like | undefined;
2948
+ get state(): Readonly<object>;
2949
+ get templateId(): string;
2950
+ get world(): World | undefined;
2951
+ /**
2952
+ * Loads the SceneUI into the world.
2953
+ *
2954
+ * @param world - The world to load the SceneUI into.
2955
+ */
2956
+ load(world: World): void;
2957
+ /**
2958
+ * Sets the entity to which the SceneUI is attached, following its position.
2959
+ *
2960
+ * @param entity - The entity to attach the SceneUI to.
2961
+ */
2962
+ setAttachedToEntity(entity: Entity): void;
2963
+ /**
2964
+ * Sets the spatial offset of the SceneUI relative to the attached entity or position.
2965
+ *
2966
+ * @param offset - The offset in the world.
2967
+ */
2968
+ setOffset(offset: Vector3Like): void;
2969
+ /**
2970
+ * Sets the position of the SceneUI. Will detach from entity if attached.
2971
+ *
2972
+ * @param position - The position in the world.
2973
+ */
2974
+ setPosition(position: Vector3Like): void;
2975
+ /**
2976
+ * Sets the state of the SceneUI by performing a shallow merge with existing state.
2977
+ *
2978
+ * @param state - The state to set.
2979
+ */
2980
+ setState(state: object): void;
2981
+ /**
2982
+ * Unloads the SceneUI from the world.
2983
+ */
2984
+ unload(): void;
2985
+
2986
+ }
2987
+
2988
+ /**
2989
+ * Manages SceneUI instances in a world.
2990
+ *
2991
+ * @remarks
2992
+ * The SceneUIManager is created internally as a singleton
2993
+ * for each {@link World} instance in a game server.
2994
+ * It allows retrieval of all loaded SceneUI instances,
2995
+ * entity attached SceneUI instances, and more.
2996
+ *
2997
+ * @public
2998
+ */
2999
+ export declare class SceneUIManager {
3000
+
3001
+
3002
+
3003
+
3004
+ /** The world the SceneUIManager is for. */
3005
+ get world(): World;
3006
+ /**
3007
+ * Retrieves all loaded SceneUI instances for the world.
3008
+ *
3009
+ * @returns An array of SceneUI instances.
3010
+ */
3011
+ getAllSceneUIs(): SceneUI[];
3012
+ /**
3013
+ * Retrieves all loaded SceneUI instances attached to a specific entity.
3014
+ *
3015
+ * @param entity - The entity to get attached SceneUI instances for.
3016
+ * @returns An array of SceneUI instances.
3017
+ */
3018
+ getAllEntityAttachedSceneUIs(entity: Entity): SceneUI[];
3019
+
3020
+ /**
3021
+ * Unloads and unregisters all SceneUI instances attached to a specific entity.
3022
+ *
3023
+ * @param entity - The entity to unload and unregister SceneUI instances for.
3024
+ */
3025
+ unloadEntityAttachedSceneUIs(entity: Entity): void;
3026
+
3027
+
3028
+ }
3029
+
3030
+ /** Options for creating a SceneUI instance. @public */
3031
+ export declare interface SceneUIOptions {
3032
+ /** If set, SceneUI will follow the entity's position */
3033
+ attachedToEntity?: Entity;
3034
+ /** The offset of the SceneUI from the attached entity or position */
3035
+ offset?: Vector3Like;
3036
+ /** If set, SceneUI will be attached at this position */
3037
+ position?: Vector3Like;
3038
+ /** The state of the SceneUI */
3039
+ state?: object;
3040
+ /** The template ID to use for this SceneUI */
3041
+ templateId: string;
3042
+ }
3043
+
2890
3044
  /**
2891
3045
  * A simple entity controller with basic movement functions.
2892
3046
  *
@@ -3327,6 +3481,7 @@ export declare class World implements protocol.Serializable {
3327
3481
 
3328
3482
 
3329
3483
 
3484
+
3330
3485
  /**
3331
3486
  * @param options - The options for the world.
3332
3487
  */
@@ -3352,6 +3507,8 @@ export declare class World implements protocol.Serializable {
3352
3507
  /** The world loop for the world. */
3353
3508
  get loop(): WorldLoop;
3354
3509
 
3510
+ /** The scene UI manager for the world. */
3511
+ get sceneUIManager(): SceneUIManager;
3355
3512
  /** The simulation for the world. */
3356
3513
  get simulation(): Simulation;
3357
3514
  /**