hytopia 0.6.6 → 0.6.8

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 (31) hide show
  1. package/README.md +3 -3
  2. package/bun-server.mjs +146 -146
  3. package/docs/server.collisiongroup.md +15 -15
  4. package/docs/server.entity.md +35 -0
  5. package/docs/server.entity.modeltextureuri.md +13 -0
  6. package/docs/server.entity.setmodeltextureuri.md +53 -0
  7. package/docs/server.entityevent.md +14 -0
  8. package/docs/server.entityeventpayloads._entity.set_model_texture_uri_.md +16 -0
  9. package/docs/server.entityeventpayloads.md +19 -0
  10. package/docs/server.modelentityoptions.md +19 -0
  11. package/docs/server.modelentityoptions.modeltextureuri.md +13 -0
  12. package/docs/server.moveoptions.md +1 -0
  13. package/docs/server.pathfindingentitycontroller._constructor_.md +49 -0
  14. package/docs/server.pathfindingentitycontroller.md +34 -0
  15. package/docs/server.playercamera.md +35 -0
  16. package/docs/server.playercamera.setshoulderangle.md +53 -0
  17. package/docs/server.playercamera.shoulderangle.md +13 -0
  18. package/docs/server.playercameraevent.md +14 -0
  19. package/docs/server.playercameraeventpayloads._player_camera.set_shoulder_angle_.md +16 -0
  20. package/docs/server.playercameraeventpayloads.md +19 -0
  21. package/docs/{server.rigidbody.createandaddchildcolliderstosimulation.md → server.rigidbody.createandaddchildcolliders.md} +7 -3
  22. package/docs/server.rigidbody.md +1 -1
  23. package/docs/server.simpleentitycontroller._constructor_.md +49 -0
  24. package/docs/server.simpleentitycontroller.md +62 -0
  25. package/docs/server.simpleentitycontroller.stopface.md +17 -0
  26. package/docs/server.simpleentitycontroller.stopmove.md +17 -0
  27. package/docs/server.supported_input_keys.md +1 -1
  28. package/node-server.mjs +150 -150
  29. package/package.json +1 -1
  30. package/server.api.json +472 -29
  31. package/server.d.ts +97 -20
package/server.d.ts CHANGED
@@ -1287,19 +1287,19 @@ export declare enum CollisionGroup {
1287
1287
  BLOCK = 1,
1288
1288
  ENTITY = 2,
1289
1289
  ENTITY_SENSOR = 4,
1290
- PLAYER = 8,
1291
- GROUP_1 = 16,
1292
- GROUP_2 = 32,
1293
- GROUP_3 = 64,
1294
- GROUP_4 = 128,
1295
- GROUP_5 = 256,
1296
- GROUP_6 = 512,
1297
- GROUP_7 = 1024,
1298
- GROUP_8 = 2048,
1299
- GROUP_9 = 4096,
1300
- GROUP_10 = 8192,
1301
- GROUP_11 = 16384,
1302
- GROUP_12 = 32768,
1290
+ ENVIRONMENT_ENTITY = 8,
1291
+ PLAYER = 16,
1292
+ GROUP_1 = 32,
1293
+ GROUP_2 = 64,
1294
+ GROUP_3 = 128,
1295
+ GROUP_4 = 256,
1296
+ GROUP_5 = 512,
1297
+ GROUP_6 = 1024,
1298
+ GROUP_7 = 2048,
1299
+ GROUP_8 = 4096,
1300
+ GROUP_9 = 8192,
1301
+ GROUP_10 = 16384,
1302
+ GROUP_11 = 32768,
1303
1303
  ALL = 65535
1304
1304
  }
1305
1305
 
@@ -1749,6 +1749,7 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1749
1749
 
1750
1750
 
1751
1751
 
1752
+
1752
1753
 
1753
1754
 
1754
1755
  /**
@@ -1775,6 +1776,8 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1775
1776
  get modelPreferredShape(): ColliderShape | undefined;
1776
1777
  /** The scale of the entity's model. */
1777
1778
  get modelScale(): number;
1779
+ /** The URI or path to the texture that overrides the model entity's default texture. */
1780
+ get modelTextureUri(): string | undefined;
1778
1781
  /** The URI or path to the .gltf model asset to be used for the entity. */
1779
1782
  get modelUri(): string | undefined;
1780
1783
  /** The name of the entity. */
@@ -1808,6 +1811,11 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1808
1811
  * Despawns the entity and all children from the world.
1809
1812
  */
1810
1813
  despawn(): void;
1814
+ /**
1815
+ * Sets the controller for the entity.
1816
+ * @param controller - The controller to set.
1817
+ */
1818
+ setController(controller: BaseEntityController | undefined): void;
1811
1819
  /**
1812
1820
  * Sets the playback rate of all animations on the entity's model.
1813
1821
  *
@@ -1819,11 +1827,6 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1819
1827
  * @param playbackRate - The playback rate of the entity's model animations.
1820
1828
  */
1821
1829
  setModelAnimationsPlaybackRate(playbackRate: number): void;
1822
- /**
1823
- * Sets the controller for the entity.
1824
- * @param controller - The controller to set.
1825
- */
1826
- setController(controller: BaseEntityController | undefined): void;
1827
1830
  /**
1828
1831
  * Sets the nodes to hide on the entity's model. Matched nodes
1829
1832
  * will be hidden for all players. Uses case insensitive
@@ -1831,6 +1834,12 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1831
1834
  * @param modelHiddenNodes - The nodes to hide on the entity's model.
1832
1835
  */
1833
1836
  setModelHiddenNodes(modelHiddenNodes: string[]): void;
1837
+ /**
1838
+ * Sets the texture uri of the entity's model. Setting
1839
+ * this overrides the model's default texture.
1840
+ * @param modelTextureUri - The texture uri of the entity's model.
1841
+ */
1842
+ setModelTextureUri(modelTextureUri: string | undefined): void;
1834
1843
  /**
1835
1844
  * Sets the opacity of the entity.
1836
1845
  * @param opacity - The opacity of the entity between 0 and 1. 0 is fully transparent, 1 is fully opaque.
@@ -1929,6 +1938,7 @@ export declare enum EntityEvent {
1929
1938
  ENTITY_CONTACT_FORCE = "ENTITY.ENTITY_CONTACT_FORCE",
1930
1939
  SET_MODEL_ANIMATIONS_PLAYBACK_RATE = "ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",
1931
1940
  SET_MODEL_HIDDEN_NODES = "ENTITY.SET_MODEL_HIDDEN_NODES",
1941
+ SET_MODEL_TEXTURE_URI = "ENTITY.SET_MODEL_TEXTURE_URI",
1932
1942
  SET_OPACITY = "ENTITY.SET_OPACITY",
1933
1943
  SET_PARENT = "ENTITY.SET_PARENT",
1934
1944
  SET_TINT_COLOR = "ENTITY.SET_TINT_COLOR",
@@ -1985,6 +1995,11 @@ export declare interface EntityEventPayloads {
1985
1995
  entity: Entity;
1986
1996
  modelHiddenNodes: Set<string>;
1987
1997
  };
1998
+ /** Emitted when the texture uri of the entity's model is set. */
1999
+ [EntityEvent.SET_MODEL_TEXTURE_URI]: {
2000
+ entity: Entity;
2001
+ modelTextureUri: string | undefined;
2002
+ };
1988
2003
  /** Emitted when the opacity of the entity is set. */
1989
2004
  [EntityEvent.SET_OPACITY]: {
1990
2005
  entity: Entity;
@@ -3230,6 +3245,8 @@ export declare interface ModelEntityOptions extends BaseEntityOptions {
3230
3245
  modelPreferredShape?: ColliderShape;
3231
3246
  /** The scale of the entity's model. */
3232
3247
  modelScale?: number;
3248
+ /** The texture uri of the entity's model. Setting this overrides the model's default texture. */
3249
+ modelTextureUri?: string;
3233
3250
  /** The URI or path to the .gltf model asset to be used for the entity. */
3234
3251
  modelUri?: string;
3235
3252
  }
@@ -3362,6 +3379,8 @@ export declare type MoveOptions = {
3362
3379
  };
3363
3380
  /** Whether to start the idle animations when the entity finishes moving. Defaults to true. */
3364
3381
  moveStartIdleAnimationsOnCompletion?: boolean;
3382
+ /** The distance from the target at which the entity will stop moving and consider movement complete. Defaults to 0.316~ blocks away from target. */
3383
+ moveStoppingDistance?: number;
3365
3384
  };
3366
3385
 
3367
3386
  /** The options for an error type "none" collider. @public */
@@ -3409,6 +3428,10 @@ export declare class PathfindingEntityController extends SimpleEntityController
3409
3428
 
3410
3429
 
3411
3430
 
3431
+ /**
3432
+ * @param options - Options for the controller.
3433
+ */
3434
+ constructor(options?: PathfindingEntityControllerOptions);
3412
3435
  /** Whether to enable debug mode or not. When debug mode is enabled, the pathfinding algorithm will log debug information to the console. Defaults to false. */
3413
3436
  get debug(): boolean;
3414
3437
  /** The maximum fall distance the entity can fall. */
@@ -3446,7 +3469,10 @@ export declare class PathfindingEntityController extends SimpleEntityController
3446
3469
 
3447
3470
 
3448
3471
 
3472
+ }
3449
3473
 
3474
+ /** Options for creating a PathfindingEntityController instance. @public */
3475
+ declare interface PathfindingEntityControllerOptions extends SimpleEntityControllerOptions {
3450
3476
  }
3451
3477
 
3452
3478
  /**
@@ -3646,6 +3672,7 @@ export declare class PlayerCamera extends EventRouter implements protocol.Serial
3646
3672
 
3647
3673
 
3648
3674
 
3675
+
3649
3676
  /** The entity the camera is attached to. */
3650
3677
  get attachedToEntity(): Entity | undefined;
3651
3678
  /** The position the camera is attached to. */
@@ -3666,6 +3693,8 @@ export declare class PlayerCamera extends EventRouter implements protocol.Serial
3666
3693
  get offset(): Vector3Like;
3667
3694
  /** The current orientation of the camera. */
3668
3695
  get orientation(): PlayerCameraOrientation;
3696
+ /** The shoulder angle of the camera in degrees. */
3697
+ get shoulderAngle(): number;
3669
3698
  /** The entity the camera will constantly look at, even if the camera attached or tracked entity moves. */
3670
3699
  get trackedEntity(): Entity | undefined;
3671
3700
  /** The position the camera will constantly look at, even if the camera attached entity moves. */
@@ -3739,6 +3768,14 @@ export declare class PlayerCamera extends EventRouter implements protocol.Serial
3739
3768
  setOffset(offset: Vector3Like): void;
3740
3769
 
3741
3770
 
3771
+ /**
3772
+ * Only used in third-person mode. Sets the shoulder angle
3773
+ * of the camera in degrees. A positive value shifts the
3774
+ * camera to the right, a negative value shifts it to the
3775
+ * left.
3776
+ * @param shoulderAngle - The shoulder angle to set in degrees.
3777
+ */
3778
+ setShoulderAngle(shoulderAngle: number): void;
3742
3779
  /**
3743
3780
  * Sets the entity the camera will constantly look at,
3744
3781
  * even if the camera attached or tracked entity moves.
@@ -3772,6 +3809,7 @@ export declare enum PlayerCameraEvent {
3772
3809
  SET_MODEL_HIDDEN_NODES = "PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",
3773
3810
  SET_MODE = "PLAYER_CAMERA.SET_MODE",
3774
3811
  SET_OFFSET = "PLAYER_CAMERA.SET_OFFSET",
3812
+ SET_SHOULDER_ANGLE = "PLAYER_CAMERA.SET_SHOULDER_ANGLE",
3775
3813
  SET_TRACKED_ENTITY = "PLAYER_CAMERA.SET_TRACKED_ENTITY",
3776
3814
  SET_TRACKED_POSITION = "PLAYER_CAMERA.SET_TRACKED_POSITION",
3777
3815
  SET_ZOOM = "PLAYER_CAMERA.SET_ZOOM"
@@ -3829,6 +3867,11 @@ export declare interface PlayerCameraEventPayloads {
3829
3867
  playerCamera: PlayerCamera;
3830
3868
  offset: Vector3Like;
3831
3869
  };
3870
+ /** Emitted when the shoulder angle of the camera is set. */
3871
+ [PlayerCameraEvent.SET_SHOULDER_ANGLE]: {
3872
+ playerCamera: PlayerCamera;
3873
+ shoulderAngle: number;
3874
+ };
3832
3875
  /** Emitted when the tracked entity of the camera is set. */
3833
3876
  [PlayerCameraEvent.SET_TRACKED_ENTITY]: {
3834
3877
  playerCamera: PlayerCamera;
@@ -4631,10 +4674,15 @@ export declare class RigidBody extends EventRouter {
4631
4674
  createAndAddChildCollider(colliderOptions: ColliderOptions): Collider | null;
4632
4675
  /**
4633
4676
  * Creates and adds multiple child colliders to the rigid body for the simulation it belongs to.
4677
+ *
4678
+ * @remarks
4679
+ * If the rigid body is not simulated, the colliders will be added to the rigid body as pending child colliders
4680
+ * and also simulated when the rigid body is simulated.
4681
+ *
4634
4682
  * @param colliderOptions - The options for the child colliders to add to the rigid body.
4635
4683
  * @returns The child colliders that were added to the rigid body.
4636
4684
  */
4637
- createAndAddChildCollidersToSimulation(colliderOptions: ColliderOptions[]): Collider[];
4685
+ createAndAddChildColliders(colliderOptions: ColliderOptions[]): Collider[];
4638
4686
  /**
4639
4687
  * Gets the colliders of the rigid body by tag.
4640
4688
  * @param tag - The tag to filter by.
@@ -4990,6 +5038,13 @@ export declare class SimpleEntityController extends BaseEntityController {
4990
5038
 
4991
5039
 
4992
5040
 
5041
+
5042
+
5043
+
5044
+ /**
5045
+ * @param options - Options for the controller.
5046
+ */
5047
+ constructor(options?: SimpleEntityControllerOptions);
4993
5048
  /**
4994
5049
  * Override of the {@link BaseEntityController.spawn} method. Starts
4995
5050
  * the set idle animations (if any) when the entity is spawned.
@@ -5029,10 +5084,32 @@ export declare class SimpleEntityController extends BaseEntityController {
5029
5084
  * @param options - Additional options for the move operation, such as callbacks.
5030
5085
  */
5031
5086
  move(target: Vector3Like, speed: number, options?: MoveOptions): void;
5087
+ /**
5088
+ * Stops the entity from attempting to face a target coordinate.
5089
+ */
5090
+ stopFace(): void;
5091
+ /**
5092
+ * Stops the entity from continuing to move it's current target coordinate.
5093
+ */
5094
+ stopMove(): void;
5095
+
5032
5096
 
5033
5097
 
5034
5098
 
5099
+ }
5035
5100
 
5101
+ /** Options for creating a SimpleEntityController instance. @public */
5102
+ declare interface SimpleEntityControllerOptions {
5103
+ /** The animations to loop when the entity is idle. */
5104
+ idleLoopedAnimations?: string[];
5105
+ /** The speed at which to loop the idle animations. */
5106
+ idleLoopedAnimationsSpeed?: number;
5107
+ /** The animations to play when the entity jumps. */
5108
+ jumpOneshotAnimations?: string[];
5109
+ /** The animations to loop when the entity is moving. */
5110
+ moveLoopedAnimations?: string[];
5111
+ /** The speed at which to loop the move animations. */
5112
+ moveLoopedAnimationsSpeed?: number;
5036
5113
  }
5037
5114
 
5038
5115
  /**
@@ -5185,7 +5262,7 @@ export declare interface SpdMatrix3 extends SdpMatrix3 {
5185
5262
  export declare function startServer(init: ((() => void) | ((world: World) => void))): void;
5186
5263
 
5187
5264
  /** The input keys that are included in the PlayerInput. @public */
5188
- export declare const SUPPORTED_INPUT_KEYS: readonly ["w", "a", "s", "d", "sp", "sh", "tb", "ml", "mr", "q", "e", "r", "f", "z", "x", "c", "v", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
5265
+ export declare const SUPPORTED_INPUT_KEYS: readonly ["w", "a", "s", "d", "sp", "sh", "tb", "ml", "mr", "q", "e", "r", "f", "z", "x", "c", "v", "u", "i", "o", "j", "k", "l", "n", "m", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
5189
5266
 
5190
5267
  /** The options for a trimesh collider. @public */
5191
5268
  export declare interface TrimeshColliderOptions extends BaseColliderOptions {