hytopia 0.1.64 → 0.1.65

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/server.api.json CHANGED
@@ -6914,6 +6914,121 @@
6914
6914
  "isProtected": false,
6915
6915
  "isAbstract": false
6916
6916
  },
6917
+ {
6918
+ "kind": "Method",
6919
+ "canonicalReference": "server!Collider.optionsFromBlockHalfExtents:member(1)",
6920
+ "docComment": "/**\n * Creates a collider options object from a block's half extents.\n *\n * @param halfExtents - The half extents of the block.\n *\n * @returns The collider options object.\n */\n",
6921
+ "excerptTokens": [
6922
+ {
6923
+ "kind": "Content",
6924
+ "text": "static optionsFromBlockHalfExtents(halfExtents: "
6925
+ },
6926
+ {
6927
+ "kind": "Reference",
6928
+ "text": "Vector3Like",
6929
+ "canonicalReference": "server!Vector3Like:interface"
6930
+ },
6931
+ {
6932
+ "kind": "Content",
6933
+ "text": "): "
6934
+ },
6935
+ {
6936
+ "kind": "Reference",
6937
+ "text": "ColliderOptions",
6938
+ "canonicalReference": "server!ColliderOptions:interface"
6939
+ },
6940
+ {
6941
+ "kind": "Content",
6942
+ "text": ";"
6943
+ }
6944
+ ],
6945
+ "isStatic": true,
6946
+ "returnTypeTokenRange": {
6947
+ "startIndex": 3,
6948
+ "endIndex": 4
6949
+ },
6950
+ "releaseTag": "Public",
6951
+ "isProtected": false,
6952
+ "overloadIndex": 1,
6953
+ "parameters": [
6954
+ {
6955
+ "parameterName": "halfExtents",
6956
+ "parameterTypeTokenRange": {
6957
+ "startIndex": 1,
6958
+ "endIndex": 2
6959
+ },
6960
+ "isOptional": false
6961
+ }
6962
+ ],
6963
+ "isOptional": false,
6964
+ "isAbstract": false,
6965
+ "name": "optionsFromBlockHalfExtents"
6966
+ },
6967
+ {
6968
+ "kind": "Method",
6969
+ "canonicalReference": "server!Collider.optionsFromModelUri:member(1)",
6970
+ "docComment": "/**\n * Creates a collider options object from a modelUri with best approximate shape and size.\n *\n * @param modelUri - The URI of the model.\n *\n * @returns The collider options object.\n */\n",
6971
+ "excerptTokens": [
6972
+ {
6973
+ "kind": "Content",
6974
+ "text": "static optionsFromModelUri(modelUri: "
6975
+ },
6976
+ {
6977
+ "kind": "Content",
6978
+ "text": "string"
6979
+ },
6980
+ {
6981
+ "kind": "Content",
6982
+ "text": ", scale?: "
6983
+ },
6984
+ {
6985
+ "kind": "Content",
6986
+ "text": "number"
6987
+ },
6988
+ {
6989
+ "kind": "Content",
6990
+ "text": "): "
6991
+ },
6992
+ {
6993
+ "kind": "Reference",
6994
+ "text": "ColliderOptions",
6995
+ "canonicalReference": "server!ColliderOptions:interface"
6996
+ },
6997
+ {
6998
+ "kind": "Content",
6999
+ "text": ";"
7000
+ }
7001
+ ],
7002
+ "isStatic": true,
7003
+ "returnTypeTokenRange": {
7004
+ "startIndex": 5,
7005
+ "endIndex": 6
7006
+ },
7007
+ "releaseTag": "Public",
7008
+ "isProtected": false,
7009
+ "overloadIndex": 1,
7010
+ "parameters": [
7011
+ {
7012
+ "parameterName": "modelUri",
7013
+ "parameterTypeTokenRange": {
7014
+ "startIndex": 1,
7015
+ "endIndex": 2
7016
+ },
7017
+ "isOptional": false
7018
+ },
7019
+ {
7020
+ "parameterName": "scale",
7021
+ "parameterTypeTokenRange": {
7022
+ "startIndex": 3,
7023
+ "endIndex": 4
7024
+ },
7025
+ "isOptional": true
7026
+ }
7027
+ ],
7028
+ "isOptional": false,
7029
+ "isAbstract": false,
7030
+ "name": "optionsFromModelUri"
7031
+ },
6917
7032
  {
6918
7033
  "kind": "Property",
6919
7034
  "canonicalReference": "server!Collider#parentRigidBody:member",
@@ -9344,30 +9459,6 @@
9344
9459
  "endIndex": 2
9345
9460
  }
9346
9461
  },
9347
- {
9348
- "kind": "Variable",
9349
- "canonicalReference": "server!DEFAULT_BLOCK_ENTITY_RIGID_BODY_OPTIONS:var",
9350
- "docComment": "/**\n * The default rigid body options for a block entity when EntityOptions.rigidBodyOptions is not provided.\n *\n * @public\n */\n",
9351
- "excerptTokens": [
9352
- {
9353
- "kind": "Content",
9354
- "text": "DEFAULT_BLOCK_ENTITY_RIGID_BODY_OPTIONS: "
9355
- },
9356
- {
9357
- "kind": "Reference",
9358
- "text": "RigidBodyOptions",
9359
- "canonicalReference": "server!RigidBodyOptions:interface"
9360
- }
9361
- ],
9362
- "fileUrlPath": "src/world/entities/Entity.ts",
9363
- "isReadonly": true,
9364
- "releaseTag": "Public",
9365
- "name": "DEFAULT_BLOCK_ENTITY_RIGID_BODY_OPTIONS",
9366
- "variableTypeTokenRange": {
9367
- "startIndex": 1,
9368
- "endIndex": 2
9369
- }
9370
- },
9371
9462
  {
9372
9463
  "kind": "Variable",
9373
9464
  "canonicalReference": "server!DEFAULT_ENTITY_RIGID_BODY_OPTIONS:var",
@@ -13339,6 +13430,37 @@
13339
13430
  "isProtected": false,
13340
13431
  "isAbstract": false
13341
13432
  },
13433
+ {
13434
+ "kind": "Property",
13435
+ "canonicalReference": "server!GameServer#modelManager:member",
13436
+ "docComment": "/**\n * The model manager for the game server.\n */\n",
13437
+ "excerptTokens": [
13438
+ {
13439
+ "kind": "Content",
13440
+ "text": "get modelManager(): "
13441
+ },
13442
+ {
13443
+ "kind": "Reference",
13444
+ "text": "ModelManager",
13445
+ "canonicalReference": "server!ModelManager:class"
13446
+ },
13447
+ {
13448
+ "kind": "Content",
13449
+ "text": ";"
13450
+ }
13451
+ ],
13452
+ "isReadonly": true,
13453
+ "isOptional": false,
13454
+ "releaseTag": "Public",
13455
+ "name": "modelManager",
13456
+ "propertyTypeTokenRange": {
13457
+ "startIndex": 1,
13458
+ "endIndex": 2
13459
+ },
13460
+ "isStatic": false,
13461
+ "isProtected": false,
13462
+ "isAbstract": false
13463
+ },
13342
13464
  {
13343
13465
  "kind": "Property",
13344
13466
  "canonicalReference": "server!GameServer#playerManager:member",
@@ -13607,6 +13729,105 @@
13607
13729
  }
13608
13730
  ]
13609
13731
  },
13732
+ {
13733
+ "kind": "Class",
13734
+ "canonicalReference": "server!ModelManager:class",
13735
+ "docComment": "/**\n * Manages model data for all known models of the game.\n *\n * @remarks\n *\n * The ModelManager is created internally as a global singletone accessible with the static property `ModelManager.instance`.\n *\n * The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `ModelManager` class.\n *\n * @example\n * ```typescript\n * import { ModelManager } from 'hytopia';\n *\n * const modelManager = ModelManager.instance;\n * const boundingBox = modelManager.getBoundingBox('models/player.gltf');\n * ```\n *\n * @public\n */\n",
13736
+ "excerptTokens": [
13737
+ {
13738
+ "kind": "Content",
13739
+ "text": "export default class ModelManager "
13740
+ }
13741
+ ],
13742
+ "fileUrlPath": "src/models/ModelManager.ts",
13743
+ "releaseTag": "Public",
13744
+ "isAbstract": false,
13745
+ "name": "ModelManager",
13746
+ "preserveMemberOrder": false,
13747
+ "members": [
13748
+ {
13749
+ "kind": "Method",
13750
+ "canonicalReference": "server!ModelManager#getBoundingBox:member(1)",
13751
+ "docComment": "/**\n * Retrieves the bounding box of a model.\n *\n * @param modelUri - The URI of the model to retrieve the bounding box for.\n *\n * @returns The bounding box of the model.\n */\n",
13752
+ "excerptTokens": [
13753
+ {
13754
+ "kind": "Content",
13755
+ "text": "getBoundingBox(modelUri: "
13756
+ },
13757
+ {
13758
+ "kind": "Content",
13759
+ "text": "string"
13760
+ },
13761
+ {
13762
+ "kind": "Content",
13763
+ "text": "): "
13764
+ },
13765
+ {
13766
+ "kind": "Reference",
13767
+ "text": "ModelBoundingBox",
13768
+ "canonicalReference": "server!~ModelBoundingBox:type"
13769
+ },
13770
+ {
13771
+ "kind": "Content",
13772
+ "text": ";"
13773
+ }
13774
+ ],
13775
+ "isStatic": false,
13776
+ "returnTypeTokenRange": {
13777
+ "startIndex": 3,
13778
+ "endIndex": 4
13779
+ },
13780
+ "releaseTag": "Public",
13781
+ "isProtected": false,
13782
+ "overloadIndex": 1,
13783
+ "parameters": [
13784
+ {
13785
+ "parameterName": "modelUri",
13786
+ "parameterTypeTokenRange": {
13787
+ "startIndex": 1,
13788
+ "endIndex": 2
13789
+ },
13790
+ "isOptional": false
13791
+ }
13792
+ ],
13793
+ "isOptional": false,
13794
+ "isAbstract": false,
13795
+ "name": "getBoundingBox"
13796
+ },
13797
+ {
13798
+ "kind": "Property",
13799
+ "canonicalReference": "server!ModelManager.instance:member",
13800
+ "docComment": "/**\n * The global PlayerManager instance as a singleton.\n */\n",
13801
+ "excerptTokens": [
13802
+ {
13803
+ "kind": "Content",
13804
+ "text": "static readonly instance: "
13805
+ },
13806
+ {
13807
+ "kind": "Reference",
13808
+ "text": "ModelManager",
13809
+ "canonicalReference": "server!ModelManager:class"
13810
+ },
13811
+ {
13812
+ "kind": "Content",
13813
+ "text": ";"
13814
+ }
13815
+ ],
13816
+ "isReadonly": true,
13817
+ "isOptional": false,
13818
+ "releaseTag": "Public",
13819
+ "name": "instance",
13820
+ "propertyTypeTokenRange": {
13821
+ "startIndex": 1,
13822
+ "endIndex": 2
13823
+ },
13824
+ "isStatic": true,
13825
+ "isProtected": false,
13826
+ "isAbstract": false
13827
+ }
13828
+ ],
13829
+ "implementsTokenRanges": []
13830
+ },
13610
13831
  {
13611
13832
  "kind": "TypeAlias",
13612
13833
  "canonicalReference": "server!MoveCallback:type",
@@ -23941,7 +24162,7 @@
23941
24162
  "excerptTokens": [
23942
24163
  {
23943
24164
  "kind": "Content",
23944
- "text": "type: "
24165
+ "text": "type?: "
23945
24166
  },
23946
24167
  {
23947
24168
  "kind": "Reference",
@@ -23954,7 +24175,7 @@
23954
24175
  }
23955
24176
  ],
23956
24177
  "isReadonly": false,
23957
- "isOptional": false,
24178
+ "isOptional": true,
23958
24179
  "releaseTag": "Public",
23959
24180
  "name": "type",
23960
24181
  "propertyTypeTokenRange": {
package/server.d.ts CHANGED
@@ -890,6 +890,18 @@ export declare class Collider {
890
890
  * @param colliderOptions - The options for the collider instance.
891
891
  */
892
892
  constructor(colliderOptions: ColliderOptions);
893
+ /**
894
+ * Creates a collider options object from a block's half extents.
895
+ * @param halfExtents - The half extents of the block.
896
+ * @returns The collider options object.
897
+ */
898
+ static optionsFromBlockHalfExtents(halfExtents: Vector3Like): ColliderOptions;
899
+ /**
900
+ * Creates a collider options object from a modelUri with best approximate shape and size.
901
+ * @param modelUri - The URI of the model.
902
+ * @returns The collider options object.
903
+ */
904
+ static optionsFromModelUri(modelUri: string, scale?: number): ColliderOptions;
893
905
  /** The bounciness of the collider. */
894
906
  get bounciness(): number;
895
907
  /** The bounciness combine rule of the collider. */
@@ -1211,9 +1223,6 @@ export declare type DecodedCollisionGroups = {
1211
1223
  collidesWith: string[];
1212
1224
  };
1213
1225
 
1214
- /** The default rigid body options for a block entity when EntityOptions.rigidBodyOptions is not provided. @public */
1215
- export declare const DEFAULT_BLOCK_ENTITY_RIGID_BODY_OPTIONS: RigidBodyOptions;
1216
-
1217
1226
  /** The default rigid body options for a model entity when EntityOptions.rigidBodyOptions is not provided. @public */
1218
1227
  export declare const DEFAULT_ENTITY_RIGID_BODY_OPTIONS: RigidBodyOptions;
1219
1228
 
@@ -1720,8 +1729,11 @@ export declare class GameServer {
1720
1729
 
1721
1730
 
1722
1731
 
1732
+
1723
1733
  /** The singleton instance of the game server. */
1724
1734
  static get instance(): GameServer;
1735
+ /** The model manager for the game server. */
1736
+ get modelManager(): ModelManager;
1725
1737
  /** The player manager for the game server. */
1726
1738
  get playerManager(): PlayerManager;
1727
1739
 
@@ -1751,6 +1763,56 @@ export declare enum GameServerEventType {
1751
1763
  STOP = "GAMESERVER.STOP"
1752
1764
  }
1753
1765
 
1766
+ /** A bounding box for a model. @public */
1767
+ declare type ModelBoundingBox = {
1768
+ min: {
1769
+ x: number;
1770
+ y: number;
1771
+ z: number;
1772
+ };
1773
+ max: {
1774
+ x: number;
1775
+ y: number;
1776
+ z: number;
1777
+ };
1778
+ };
1779
+
1780
+ /**
1781
+ * Manages model data for all known models of the game.
1782
+ *
1783
+ * @remarks
1784
+ * The ModelManager is created internally as a global
1785
+ * singletone accessible with the static property
1786
+ * `ModelManager.instance`.
1787
+ *
1788
+ * @example
1789
+ * ```typescript
1790
+ * import { ModelManager } from 'hytopia';
1791
+ *
1792
+ * const modelManager = ModelManager.instance;
1793
+ * const boundingBox = modelManager.getBoundingBox('models/player.gltf');
1794
+ * ```
1795
+ *
1796
+ * @public
1797
+ */
1798
+ export declare class ModelManager {
1799
+ /** The global PlayerManager instance as a singleton. */
1800
+ static readonly instance: ModelManager;
1801
+
1802
+
1803
+
1804
+
1805
+ /**
1806
+ * Retrieves the bounding box of a model.
1807
+ *
1808
+ * @param modelUri - The URI of the model to retrieve the bounding box for.
1809
+ * @returns The bounding box of the model.
1810
+ */
1811
+ getBoundingBox(modelUri: string): ModelBoundingBox;
1812
+
1813
+
1814
+ }
1815
+
1754
1816
  /**
1755
1817
  * A callback function called when the entity associated with the
1756
1818
  * SimpleEntityController updates its position as it is
@@ -2895,7 +2957,7 @@ export declare type RigidBodyAdditionalMassProperties = {
2895
2957
  /** Options for creating a RigidBody instance. @public */
2896
2958
  export declare interface RigidBodyOptions {
2897
2959
  /** The type of the rigid body. */
2898
- type: RigidBodyType;
2960
+ type?: RigidBodyType;
2899
2961
  /** The additional mass of the rigid body. */
2900
2962
  additionalMass?: number;
2901
2963
  /** The additional mass properties of the rigid body. */