hytopia 0.12.0-prerelease-1 → 0.12.0-prerelease-3

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
@@ -173,6 +173,134 @@
173
173
  "name": "",
174
174
  "preserveMemberOrder": false,
175
175
  "members": [
176
+ {
177
+ "kind": "Class",
178
+ "canonicalReference": "server!AssetsLibrary:class",
179
+ "docComment": "/**\n * Manages the assets library and synchronization of assets to the local assets directory in development.\n *\n * @remarks\n *\n * The AssetsLibrary is created internally as a global singletone accessible with the static property `AssetsLibrary.instance`.\n *\n * Please note: Assets will automatically sync to local assets in development mode the first time an asset in the library is requested by the client. This means you do not need to explicitly handle calling syncAsset() yourself unless you have a specific reason to.\n *\n * @example\n * ```typescript\n * import { AssetsLibrary } from 'hytopia';\n *\n * const assetsLibrary = AssetsLibrary.instance;\n * assetsLibrary.syncAsset('assets/models/player.gltf');\n * ```\n *\n */\n",
180
+ "excerptTokens": [
181
+ {
182
+ "kind": "Content",
183
+ "text": "export default class AssetsLibrary "
184
+ }
185
+ ],
186
+ "fileUrlPath": "src/assets/AssetsLibrary.ts",
187
+ "releaseTag": "Public",
188
+ "isAbstract": false,
189
+ "name": "AssetsLibrary",
190
+ "preserveMemberOrder": false,
191
+ "members": [
192
+ {
193
+ "kind": "Property",
194
+ "canonicalReference": "server!AssetsLibrary#assetsLibraryPath:member",
195
+ "docComment": "/**\n * The path to the assets library package. Null if assets library is not available.\n */\n",
196
+ "excerptTokens": [
197
+ {
198
+ "kind": "Content",
199
+ "text": "readonly assetsLibraryPath: "
200
+ },
201
+ {
202
+ "kind": "Content",
203
+ "text": "string | null"
204
+ },
205
+ {
206
+ "kind": "Content",
207
+ "text": ";"
208
+ }
209
+ ],
210
+ "isReadonly": true,
211
+ "isOptional": false,
212
+ "releaseTag": "Public",
213
+ "name": "assetsLibraryPath",
214
+ "propertyTypeTokenRange": {
215
+ "startIndex": 1,
216
+ "endIndex": 2
217
+ },
218
+ "isStatic": false,
219
+ "isProtected": false,
220
+ "isAbstract": false
221
+ },
222
+ {
223
+ "kind": "Property",
224
+ "canonicalReference": "server!AssetsLibrary.instance:member",
225
+ "docComment": "/**\n * The global AssetsLibrary instance as a singleton.\n */\n",
226
+ "excerptTokens": [
227
+ {
228
+ "kind": "Content",
229
+ "text": "static readonly instance: "
230
+ },
231
+ {
232
+ "kind": "Reference",
233
+ "text": "AssetsLibrary",
234
+ "canonicalReference": "server!AssetsLibrary:class"
235
+ },
236
+ {
237
+ "kind": "Content",
238
+ "text": ";"
239
+ }
240
+ ],
241
+ "isReadonly": true,
242
+ "isOptional": false,
243
+ "releaseTag": "Public",
244
+ "name": "instance",
245
+ "propertyTypeTokenRange": {
246
+ "startIndex": 1,
247
+ "endIndex": 2
248
+ },
249
+ "isStatic": true,
250
+ "isProtected": false,
251
+ "isAbstract": false
252
+ },
253
+ {
254
+ "kind": "Method",
255
+ "canonicalReference": "server!AssetsLibrary#syncAsset:member(1)",
256
+ "docComment": "/**\n * Synchronizes an asset from the assets library to the local assets directory.\n *\n * @remarks\n *\n * Syncs an asset from the assets library to local assets in development. The assets library is unavailable in production, so assets must be local to the project.\n *\n * @param assetPath - The path of the asset to copy to local assets.\n */\n",
257
+ "excerptTokens": [
258
+ {
259
+ "kind": "Content",
260
+ "text": "syncAsset(assetPath: "
261
+ },
262
+ {
263
+ "kind": "Content",
264
+ "text": "string"
265
+ },
266
+ {
267
+ "kind": "Content",
268
+ "text": "): "
269
+ },
270
+ {
271
+ "kind": "Content",
272
+ "text": "void"
273
+ },
274
+ {
275
+ "kind": "Content",
276
+ "text": ";"
277
+ }
278
+ ],
279
+ "isStatic": false,
280
+ "returnTypeTokenRange": {
281
+ "startIndex": 3,
282
+ "endIndex": 4
283
+ },
284
+ "releaseTag": "Public",
285
+ "isProtected": false,
286
+ "overloadIndex": 1,
287
+ "parameters": [
288
+ {
289
+ "parameterName": "assetPath",
290
+ "parameterTypeTokenRange": {
291
+ "startIndex": 1,
292
+ "endIndex": 2
293
+ },
294
+ "isOptional": false
295
+ }
296
+ ],
297
+ "isOptional": false,
298
+ "isAbstract": false,
299
+ "name": "syncAsset"
300
+ }
301
+ ],
302
+ "implementsTokenRanges": []
303
+ },
176
304
  {
177
305
  "kind": "Class",
178
306
  "canonicalReference": "server!Audio:class",
@@ -4913,12 +5041,12 @@
4913
5041
  "members": [
4914
5042
  {
4915
5043
  "kind": "Property",
4916
- "canonicalReference": "server!BlockTextureRegistry#generateEveryStart:member",
4917
- "docComment": "/**\n * Whether to always generate the atlas on server start.\n */\n",
5044
+ "canonicalReference": "server!BlockTextureRegistry#generate:member",
5045
+ "docComment": "/**\n * Whether to generate the atlas if needed. Defaults to `true` in development, `false` in production.\n */\n",
4918
5046
  "excerptTokens": [
4919
5047
  {
4920
5048
  "kind": "Content",
4921
- "text": "generateEveryStart: "
5049
+ "text": "generate: "
4922
5050
  },
4923
5051
  {
4924
5052
  "kind": "Content",
@@ -4932,7 +5060,7 @@
4932
5060
  "isReadonly": false,
4933
5061
  "isOptional": false,
4934
5062
  "releaseTag": "Public",
4935
- "name": "generateEveryStart",
5063
+ "name": "generate",
4936
5064
  "propertyTypeTokenRange": {
4937
5065
  "startIndex": 1,
4938
5066
  "endIndex": 2
@@ -28705,6 +28833,54 @@
28705
28833
  "isAbstract": false,
28706
28834
  "name": "getWidth"
28707
28835
  },
28836
+ {
28837
+ "kind": "Method",
28838
+ "canonicalReference": "server!ModelRegistry#hasModel:member(1)",
28839
+ "docComment": "/**\n * Checks if a model is registered in the model registry.\n *\n * @param modelUri - The URI of the model to check.\n *\n * @returns Whether the model is registered.\n */\n",
28840
+ "excerptTokens": [
28841
+ {
28842
+ "kind": "Content",
28843
+ "text": "hasModel(modelUri: "
28844
+ },
28845
+ {
28846
+ "kind": "Content",
28847
+ "text": "string"
28848
+ },
28849
+ {
28850
+ "kind": "Content",
28851
+ "text": "): "
28852
+ },
28853
+ {
28854
+ "kind": "Content",
28855
+ "text": "boolean"
28856
+ },
28857
+ {
28858
+ "kind": "Content",
28859
+ "text": ";"
28860
+ }
28861
+ ],
28862
+ "isStatic": false,
28863
+ "returnTypeTokenRange": {
28864
+ "startIndex": 3,
28865
+ "endIndex": 4
28866
+ },
28867
+ "releaseTag": "Public",
28868
+ "isProtected": false,
28869
+ "overloadIndex": 1,
28870
+ "parameters": [
28871
+ {
28872
+ "parameterName": "modelUri",
28873
+ "parameterTypeTokenRange": {
28874
+ "startIndex": 1,
28875
+ "endIndex": 2
28876
+ },
28877
+ "isOptional": false
28878
+ }
28879
+ ],
28880
+ "isOptional": false,
28881
+ "isAbstract": false,
28882
+ "name": "hasModel"
28883
+ },
28708
28884
  {
28709
28885
  "kind": "Property",
28710
28886
  "canonicalReference": "server!ModelRegistry.instance:member",
@@ -28803,7 +28979,7 @@
28803
28979
  {
28804
28980
  "kind": "Property",
28805
28981
  "canonicalReference": "server!ModelRegistry#optimize:member",
28806
- "docComment": "/**\n * Whether to use optimized models when they are loaded.\n */\n",
28982
+ "docComment": "/**\n * Whether to generate optimized models if needed. Defaults to `true` in development, `false` in production.\n */\n",
28807
28983
  "excerptTokens": [
28808
28984
  {
28809
28985
  "kind": "Content",
@@ -28829,36 +29005,6 @@
28829
29005
  "isStatic": false,
28830
29006
  "isProtected": false,
28831
29007
  "isAbstract": false
28832
- },
28833
- {
28834
- "kind": "Property",
28835
- "canonicalReference": "server!ModelRegistry#optimizeEveryStart:member",
28836
- "docComment": "/**\n * Whether to always run model optimization on server start.\n */\n",
28837
- "excerptTokens": [
28838
- {
28839
- "kind": "Content",
28840
- "text": "optimizeEveryStart: "
28841
- },
28842
- {
28843
- "kind": "Content",
28844
- "text": "boolean"
28845
- },
28846
- {
28847
- "kind": "Content",
28848
- "text": ";"
28849
- }
28850
- ],
28851
- "isReadonly": false,
28852
- "isOptional": false,
28853
- "releaseTag": "Public",
28854
- "name": "optimizeEveryStart",
28855
- "propertyTypeTokenRange": {
28856
- "startIndex": 1,
28857
- "endIndex": 2
28858
- },
28859
- "isStatic": false,
28860
- "isProtected": false,
28861
- "isAbstract": false
28862
29008
  }
28863
29009
  ],
28864
29010
  "implementsTokenRanges": []
package/server.d.ts CHANGED
@@ -12,6 +12,45 @@ import type { Socket } from 'net';
12
12
  import { WebSocket as WebSocket_2 } from 'ws';
13
13
  import type { WebTransportSessionImpl } from '@fails-components/webtransport/dist/lib/types';
14
14
 
15
+ /**
16
+ * Manages the assets library and synchronization of assets
17
+ * to the local assets directory in development.
18
+ *
19
+ * @remarks
20
+ * The AssetsLibrary is created internally as a global
21
+ * singletone accessible with the static property
22
+ * `AssetsLibrary.instance`.
23
+ *
24
+ * Please note: Assets will automatically sync to local assets in
25
+ * development mode the first time an asset in the library is requested
26
+ * by the client. This means you do not need to explicitly handle
27
+ * calling syncAsset() yourself unless you have a specific reason to.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * import { AssetsLibrary } from 'hytopia';
32
+ *
33
+ * const assetsLibrary = AssetsLibrary.instance;
34
+ * assetsLibrary.syncAsset('assets/models/player.gltf');
35
+ * ```
36
+ */
37
+ export declare class AssetsLibrary {
38
+ /** The global AssetsLibrary instance as a singleton. */
39
+ static readonly instance: AssetsLibrary;
40
+ /** The path to the assets library package. Null if assets library is not available. */
41
+ readonly assetsLibraryPath: string | null;
42
+ /**
43
+ * Synchronizes an asset from the assets library to the local assets directory.
44
+ *
45
+ * @remarks
46
+ * Syncs an asset from the assets library to local assets in development.
47
+ * The assets library is unavailable in production, so assets must be local to the project.
48
+ *
49
+ * @param assetPath - The path of the asset to copy to local assets.
50
+ */
51
+ syncAsset(assetPath: string): void;
52
+ }
53
+
15
54
  /**
16
55
  * Represents a audio playback in a world.
17
56
  *
@@ -597,8 +636,8 @@ export declare type BlockTextureMetadata = {
597
636
  export declare class BlockTextureRegistry {
598
637
  /** The global BlockTextureRegistry instance as a singleton. */
599
638
  static readonly instance: BlockTextureRegistry;
600
- /** Whether to always generate the atlas on server start. */
601
- generateEveryStart: boolean;
639
+ /** Whether to generate the atlas if needed. Defaults to `true` in development, `false` in production. */
640
+ generate: boolean;
602
641
 
603
642
 
604
643
  /**
@@ -3532,10 +3571,8 @@ export declare interface ModelEntityOptions extends BaseEntityOptions {
3532
3571
  export declare class ModelRegistry {
3533
3572
  /** The global ModelRegistry instance as a singleton. */
3534
3573
  static readonly instance: ModelRegistry;
3535
- /** Whether to use optimized models when they are loaded. */
3574
+ /** Whether to generate optimized models if needed. Defaults to `true` in development, `false` in production. */
3536
3575
  optimize: boolean;
3537
- /** Whether to always run model optimization on server start. */
3538
- optimizeEveryStart: boolean;
3539
3576
 
3540
3577
 
3541
3578
 
@@ -3592,6 +3629,13 @@ export declare class ModelRegistry {
3592
3629
  * @returns The width of the model.
3593
3630
  */
3594
3631
  getWidth(modelUri: string): number;
3632
+ /**
3633
+ * Checks if a model is registered in the model registry.
3634
+ *
3635
+ * @param modelUri - The URI of the model to check.
3636
+ * @returns Whether the model is registered.
3637
+ */
3638
+ hasModel(modelUri: string): boolean;
3595
3639
  /**
3596
3640
  * Checks if a model has a node with the given name.
3597
3641
  *