hytopia 0.3.11 → 0.3.13

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 (44) hide show
  1. package/docs/server.baseentityoptions.controller.md +13 -0
  2. package/docs/server.baseentityoptions.md +190 -0
  3. package/docs/server.baseentityoptions.name.md +13 -0
  4. package/docs/{server.entityoptions.opacity.md → server.baseentityoptions.opacity.md} +2 -2
  5. package/docs/{server.entityoptions.parent.md → server.baseentityoptions.parent.md} +2 -2
  6. package/docs/{server.entityoptions.parentnodename.md → server.baseentityoptions.parentnodename.md} +2 -2
  7. package/docs/server.baseentityoptions.rigidbodyoptions.md +13 -0
  8. package/docs/{server.entityoptions.tag.md → server.baseentityoptions.tag.md} +2 -2
  9. package/docs/server.baseentityoptions.tintcolor.md +13 -0
  10. package/docs/{server.entityoptions.blockhalfextents.md → server.blockentityoptions.blockhalfextents.md} +2 -2
  11. package/docs/{server.entityoptions.blocktextureuri.md → server.blockentityoptions.blocktextureuri.md} +2 -2
  12. package/docs/server.blockentityoptions.md +77 -0
  13. package/docs/server.entityoptions.md +4 -312
  14. package/docs/server.md +52 -19
  15. package/docs/server.modelentityoptions.md +134 -0
  16. package/docs/server.modelentityoptions.modelanimationsplaybackrate.md +13 -0
  17. package/docs/server.modelentityoptions.modelhiddennodes.md +13 -0
  18. package/docs/server.modelentityoptions.modelloopedanimations.md +13 -0
  19. package/docs/server.modelentityoptions.modelscale.md +13 -0
  20. package/docs/server.modelentityoptions.modeluri.md +13 -0
  21. package/docs/server.playerentityoptions.md +5 -46
  22. package/docs/server.playerui.lockpointer.md +1 -1
  23. package/docs/server.playerui.md +1 -1
  24. package/examples/entity-spawn/index.ts +4 -3
  25. package/examples/hygrounds/classes/ChestEntity.ts +2 -2
  26. package/examples/hygrounds/classes/GunEntity.ts +3 -3
  27. package/examples/hygrounds/classes/ItemEntity.ts +13 -9
  28. package/examples/hygrounds/classes/MeleeWeaponEntity.ts +3 -3
  29. package/examples/zombies-fps/classes/EnemyEntity.ts +2 -2
  30. package/examples/zombies-fps/classes/GunEntity.ts +3 -3
  31. package/package.json +1 -1
  32. package/server.api.json +614 -534
  33. package/server.d.ts +51 -36
  34. package/server.js +1 -1
  35. package/docs/server.entityoptions.controller.md +0 -13
  36. package/docs/server.entityoptions.modelanimationsplaybackrate.md +0 -13
  37. package/docs/server.entityoptions.modelhiddennodes.md +0 -13
  38. package/docs/server.entityoptions.modelloopedanimations.md +0 -13
  39. package/docs/server.entityoptions.modelscale.md +0 -13
  40. package/docs/server.entityoptions.modeluri.md +0 -13
  41. package/docs/server.entityoptions.name.md +0 -13
  42. package/docs/server.entityoptions.rigidbodyoptions.md +0 -13
  43. package/docs/server.entityoptions.tintcolor.md +0 -13
  44. package/docs/server.playerentityoptions.player.md +0 -13
package/server.d.ts CHANGED
@@ -453,6 +453,26 @@ export declare interface BaseEntityControllerEventPayloads {
453
453
  };
454
454
  }
455
455
 
456
+ /** The base options for an entity. @public */
457
+ export declare interface BaseEntityOptions {
458
+ /** The entity controller to use for the entity. */
459
+ controller?: BaseEntityController;
460
+ /** The opacity of the entity between 0 and 1. 0 is fully transparent, 1 is fully opaque. */
461
+ opacity?: number;
462
+ /** The parent entity of the entity, entities with a parent will ignore creating their own colliders. */
463
+ parent?: Entity;
464
+ /** The name of the parent's node (if parent is a model entity) to attach the entity to. */
465
+ parentNodeName?: string;
466
+ /** The rigid body options for the entity. */
467
+ rigidBodyOptions?: RigidBodyOptions;
468
+ /** An arbitrary identifier tag of the entity. Useful for your own logic. */
469
+ tag?: string;
470
+ /** The tint color of the entity as a hex code. */
471
+ tintColor?: RgbColor;
472
+ /** The name of the entity. */
473
+ name?: string;
474
+ }
475
+
456
476
  /** The base options for a rigid body. @public */
457
477
  export declare interface BaseRigidBodyOptions {
458
478
  /** The type of the rigid body, defaults to {@link RigidBodyType.DYNAMIC}. */
@@ -503,6 +523,14 @@ export declare interface BlockColliderOptions extends BaseColliderOptions {
503
523
  halfExtents?: Vector3Like;
504
524
  }
505
525
 
526
+ /** The options for creating a block entity. @public */
527
+ export declare interface BlockEntityOptions extends BaseEntityOptions {
528
+ /** The half extents of the visual size of the block entity when blockTextureUri is set. If no rigidBodyOptions.colliders are provided, a block collider with the size of the half extents will be created. */
529
+ blockHalfExtents?: Vector3Like;
530
+ /** The texture uri of a entity if the entity is a block entity, if set rigidBodyOptions collider shape [0] must be a block */
531
+ blockTextureUri?: string;
532
+ }
533
+
506
534
  /**
507
535
  * Represents a block type.
508
536
  *
@@ -1774,39 +1802,8 @@ export declare class EntityManager {
1774
1802
 
1775
1803
  }
1776
1804
 
1777
- /** Options for creating an Entity instance. @public */
1778
- export declare interface EntityOptions {
1779
- /** The half extents of the visual size of the block entity when blockTextureUri is set. If no rigidBodyOptions.colliders are provided, a block collider with the size of the half extents will be created. */
1780
- blockHalfExtents?: Vector3Like;
1781
- /** The texture uri of a entity if the entity is a block entity, if set rigidBodyOptions collider shape [0] must be a block */
1782
- blockTextureUri?: string;
1783
- /** The entity controller to use for the entity. */
1784
- controller?: BaseEntityController;
1785
- /** The playback rate of the entity's model animations. */
1786
- modelAnimationsPlaybackRate?: number;
1787
- /** The nodes to hide on the entity's model. */
1788
- modelHiddenNodes?: string[];
1789
- /** The looped animations to start when the entity is spawned. */
1790
- modelLoopedAnimations?: string[];
1791
- /** The scale of the entity's model. */
1792
- modelScale?: number;
1793
- /** The URI or path to the .gltf model asset to be used for the entity. */
1794
- modelUri?: string;
1795
- /** The name of the entity. */
1796
- name?: string;
1797
- /** The opacity of the entity between 0 and 1. 0 is fully transparent, 1 is fully opaque. */
1798
- opacity?: number;
1799
- /** The parent entity of the entity, entities with a parent will ignore creating their own colliders. */
1800
- parent?: Entity;
1801
- /** The name of the parent's node (if parent is a model entity) to attach the entity to. */
1802
- parentNodeName?: string;
1803
- /** The rigid body options for the entity. */
1804
- rigidBodyOptions?: RigidBodyOptions;
1805
- /** An arbitrary identifier tag of the entity. Useful for your own logic. */
1806
- tag?: string;
1807
- /** The tint color of the entity as a hex code. */
1808
- tintColor?: RgbColor;
1809
- }
1805
+ /** The options for creating an Entity instance. @public */
1806
+ export declare type EntityOptions = BlockEntityOptions | ModelEntityOptions;
1810
1807
 
1811
1808
  /**
1812
1809
  * Manages error and warning logging.
@@ -2923,6 +2920,20 @@ declare type ModelBoundingBox = {
2923
2920
  max: Vector3Like;
2924
2921
  };
2925
2922
 
2923
+ /** The options for creating a model entity. @public */
2924
+ export declare interface ModelEntityOptions extends BaseEntityOptions {
2925
+ /** The playback rate of the entity's model animations. */
2926
+ modelAnimationsPlaybackRate?: number;
2927
+ /** The nodes to hide on the entity's model. */
2928
+ modelHiddenNodes?: string[];
2929
+ /** The looped animations to start when the entity is spawned. */
2930
+ modelLoopedAnimations?: string[];
2931
+ /** The scale of the entity's model. */
2932
+ modelScale?: number;
2933
+ /** The URI or path to the .gltf model asset to be used for the entity. */
2934
+ modelUri?: string;
2935
+ }
2936
+
2926
2937
  /**
2927
2938
  * Manages model data for all known models of the game.
2928
2939
  *
@@ -3692,10 +3703,10 @@ export declare interface PlayerEntityControllerOptions {
3692
3703
  }
3693
3704
 
3694
3705
  /** Options for creating a PlayerEntity instance. @public */
3695
- export declare interface PlayerEntityOptions extends EntityOptions {
3706
+ export declare type PlayerEntityOptions = {
3696
3707
  /** The player the player entity is assigned to. */
3697
3708
  player: Player;
3698
- }
3709
+ } & EntityOptions;
3699
3710
 
3700
3711
  /** Event types a Player can emit. See {@link PlayerEventPayloads} for the payloads. @public */
3701
3712
  export declare enum PlayerEvent {
@@ -3821,7 +3832,11 @@ export declare class PlayerUI extends EventRouter {
3821
3832
  */
3822
3833
  load(htmlUri: string): void;
3823
3834
  /**
3824
- * Locks or unlocks the player's mouse pointer.
3835
+ * Locks or unlocks the player's mouse pointer. If the pointer is unlocked
3836
+ * with lockPointer(false), the player will not be able to use in-game inputs
3837
+ * or camera controls from the mouse pointer until `player.ui.lockPointer(true)`,
3838
+ * or in your game's client UI html with `hytopia.lockPointer(true)`.
3839
+ *
3825
3840
  * @param lock - Set true to lock the pointer, false to unlock it.
3826
3841
  */
3827
3842
  lockPointer(lock: boolean): void;