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/bin/scripts.js +13 -18
- package/docs/server.assetslibrary.assetslibrarypath.md +13 -0
- package/docs/server.assetslibrary.instance.md +13 -0
- package/docs/server.assetslibrary.md +133 -0
- package/docs/server.assetslibrary.syncasset.md +58 -0
- package/docs/server.blocktextureregistry.generate.md +13 -0
- package/docs/server.blocktextureregistry.md +2 -2
- package/docs/server.md +11 -0
- package/docs/server.modelregistry.hasmodel.md +56 -0
- package/docs/server.modelregistry.md +15 -20
- package/docs/server.modelregistry.optimize.md +1 -1
- package/package.json +1 -1
- package/server.api.json +181 -35
- package/server.d.ts +49 -5
- package/server.mjs +155 -155
- package/docs/server.blocktextureregistry.generateeverystart.md +0 -13
- package/docs/server.modelregistry.optimizeeverystart.md +0 -13
package/bin/scripts.js
CHANGED
|
@@ -41,6 +41,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
41
41
|
'init-mcp': initMcp,
|
|
42
42
|
'package': packageProject,
|
|
43
43
|
'start': start,
|
|
44
|
+
'upgrade-assets-library': () => upgradeAssetsLibrary(process.argv[3] || 'latest'),
|
|
44
45
|
'upgrade-cli': () => upgradeCli(process.argv[3] || 'latest'),
|
|
45
46
|
'upgrade-project': () => upgradeProject(process.argv[3] || 'latest'),
|
|
46
47
|
'version': displayVersion,
|
|
@@ -142,9 +143,6 @@ function init() {
|
|
|
142
143
|
// Update SDK to latest (sets package.json requirement)
|
|
143
144
|
upgradeProject();
|
|
144
145
|
|
|
145
|
-
// Copy assets into project, not overwriting existing files
|
|
146
|
-
copyAssets(destDir);
|
|
147
|
-
|
|
148
146
|
// Display success message
|
|
149
147
|
displayInitSuccessMessage();
|
|
150
148
|
|
|
@@ -175,7 +173,8 @@ function installProjectDependencies() {
|
|
|
175
173
|
}, null, 2))
|
|
176
174
|
|
|
177
175
|
// install hytopia sdk and hytopia assets
|
|
178
|
-
execSync('npm install --force hytopia@latest
|
|
176
|
+
execSync('npm install --force hytopia@latest', { stdio: 'inherit' });
|
|
177
|
+
execSync('npm install --save-optional --force @hytopia.com/assets@latest', { stdio: 'inherit' });
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
/**
|
|
@@ -210,18 +209,6 @@ function initFromBoilerplate(destDir) {
|
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
|
|
213
|
-
/**
|
|
214
|
-
* Copies assets to the project directory
|
|
215
|
-
*/
|
|
216
|
-
function copyAssets(destDir) {
|
|
217
|
-
const assetsSource = path.join(destDir, 'node_modules', '@hytopia.com', 'assets');
|
|
218
|
-
const assetsDest = path.join(destDir, 'assets');
|
|
219
|
-
|
|
220
|
-
if (!copyDirectoryContents(assetsSource, assetsDest, { recursive: true, force: false })) {
|
|
221
|
-
console.error('❌ Error: Could not copy assets from @hytopia.com/assets package');
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
212
|
/**
|
|
226
213
|
* Displays success message after project initialization
|
|
227
214
|
*/
|
|
@@ -579,6 +566,13 @@ async function fetchLatestVersion(signal) {
|
|
|
579
566
|
}
|
|
580
567
|
}
|
|
581
568
|
|
|
569
|
+
function upgradeAssetsLibrary(versionArg = 'latest') {
|
|
570
|
+
const version = versionArg.trim();
|
|
571
|
+
console.log(`🔄 Upgrading @hytopia.com/assets package to: ${version} ...`);
|
|
572
|
+
execSync(`npm install --save-optional --force @hytopia.com/assets@${version}`, { stdio: 'inherit' });
|
|
573
|
+
console.log('✅ Upgrade complete.');
|
|
574
|
+
}
|
|
575
|
+
|
|
582
576
|
function upgradeCli(versionArg = 'latest') {
|
|
583
577
|
const version = versionArg.trim();
|
|
584
578
|
console.log(`🔄 Upgrading HYTOPIA CLI to: hytopia@${version} ...`);
|
|
@@ -613,8 +607,9 @@ function displayHelp() {
|
|
|
613
607
|
console.log(' init [--template NAME] Initialize a new project');
|
|
614
608
|
console.log(' init-mcp Setup MCP integrations');
|
|
615
609
|
console.log(' package Create a zip of the project for uploading to the HYTOPIA create portal.');
|
|
616
|
-
console.log(' upgrade-
|
|
617
|
-
console.log(' upgrade-
|
|
610
|
+
console.log(' upgrade-assets-library [VERSION] Upgrade the @hytopia.com/assets package (default: latest)');
|
|
611
|
+
console.log(' upgrade-cli [VERSION] Upgrade the HYTOPIA CLI (default: latest)');
|
|
612
|
+
console.log(' upgrade-project [VERSION] Upgrade project SDK dependency (default: latest)');
|
|
618
613
|
console.log('');
|
|
619
614
|
console.log('Examples:');
|
|
620
615
|
console.log(' hytopia init --template zombies-fps');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [AssetsLibrary](./server.assetslibrary.md) > [assetsLibraryPath](./server.assetslibrary.assetslibrarypath.md)
|
|
4
|
+
|
|
5
|
+
## AssetsLibrary.assetsLibraryPath property
|
|
6
|
+
|
|
7
|
+
The path to the assets library package. Null if assets library is not available.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
readonly assetsLibraryPath: string | null;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [AssetsLibrary](./server.assetslibrary.md) > [instance](./server.assetslibrary.instance.md)
|
|
4
|
+
|
|
5
|
+
## AssetsLibrary.instance property
|
|
6
|
+
|
|
7
|
+
The global AssetsLibrary instance as a singleton.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
static readonly instance: AssetsLibrary;
|
|
13
|
+
```
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [AssetsLibrary](./server.assetslibrary.md)
|
|
4
|
+
|
|
5
|
+
## AssetsLibrary class
|
|
6
|
+
|
|
7
|
+
Manages the assets library and synchronization of assets to the local assets directory in development.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export default class AssetsLibrary
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
The AssetsLibrary is created internally as a global singletone accessible with the static property `AssetsLibrary.instance`<!-- -->.
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { AssetsLibrary } from 'hytopia';
|
|
26
|
+
|
|
27
|
+
const assetsLibrary = AssetsLibrary.instance;
|
|
28
|
+
assetsLibrary.syncAsset('assets/models/player.gltf');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Properties
|
|
32
|
+
|
|
33
|
+
<table><thead><tr><th>
|
|
34
|
+
|
|
35
|
+
Property
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</th><th>
|
|
39
|
+
|
|
40
|
+
Modifiers
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</th><th>
|
|
44
|
+
|
|
45
|
+
Type
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</th><th>
|
|
49
|
+
|
|
50
|
+
Description
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</th></tr></thead>
|
|
54
|
+
<tbody><tr><td>
|
|
55
|
+
|
|
56
|
+
[assetsLibraryPath](./server.assetslibrary.assetslibrarypath.md)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
`readonly`
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td><td>
|
|
65
|
+
|
|
66
|
+
string \| null
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
</td><td>
|
|
70
|
+
|
|
71
|
+
The path to the assets library package. Null if assets library is not available.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
</td></tr>
|
|
75
|
+
<tr><td>
|
|
76
|
+
|
|
77
|
+
[instance](./server.assetslibrary.instance.md)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</td><td>
|
|
81
|
+
|
|
82
|
+
`static`
|
|
83
|
+
|
|
84
|
+
`readonly`
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</td><td>
|
|
88
|
+
|
|
89
|
+
[AssetsLibrary](./server.assetslibrary.md)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
</td><td>
|
|
93
|
+
|
|
94
|
+
The global AssetsLibrary instance as a singleton.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</td></tr>
|
|
98
|
+
</tbody></table>
|
|
99
|
+
|
|
100
|
+
## Methods
|
|
101
|
+
|
|
102
|
+
<table><thead><tr><th>
|
|
103
|
+
|
|
104
|
+
Method
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
</th><th>
|
|
108
|
+
|
|
109
|
+
Modifiers
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
</th><th>
|
|
113
|
+
|
|
114
|
+
Description
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
</th></tr></thead>
|
|
118
|
+
<tbody><tr><td>
|
|
119
|
+
|
|
120
|
+
[syncAsset(assetPath)](./server.assetslibrary.syncasset.md)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
</td><td>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
</td><td>
|
|
127
|
+
|
|
128
|
+
Synchronizes an asset from the assets library to the local assets directory.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
</td></tr>
|
|
132
|
+
</tbody></table>
|
|
133
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [AssetsLibrary](./server.assetslibrary.md) > [syncAsset](./server.assetslibrary.syncasset.md)
|
|
4
|
+
|
|
5
|
+
## AssetsLibrary.syncAsset() method
|
|
6
|
+
|
|
7
|
+
Synchronizes an asset from the assets library to the local assets directory.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
syncAsset(assetPath: string): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
assetPath
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The path of the asset to copy to local assets.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
|
|
51
|
+
**Returns:**
|
|
52
|
+
|
|
53
|
+
void
|
|
54
|
+
|
|
55
|
+
## Remarks
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [BlockTextureRegistry](./server.blocktextureregistry.md) > [generate](./server.blocktextureregistry.generate.md)
|
|
4
|
+
|
|
5
|
+
## BlockTextureRegistry.generate property
|
|
6
|
+
|
|
7
|
+
Whether to generate the atlas if needed. Defaults to `true` in development, `false` in production.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
generate: boolean;
|
|
13
|
+
```
|
|
@@ -53,7 +53,7 @@ Description
|
|
|
53
53
|
</th></tr></thead>
|
|
54
54
|
<tbody><tr><td>
|
|
55
55
|
|
|
56
|
-
[
|
|
56
|
+
[generate](./server.blocktextureregistry.generate.md)
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
</td><td>
|
|
@@ -66,7 +66,7 @@ boolean
|
|
|
66
66
|
|
|
67
67
|
</td><td>
|
|
68
68
|
|
|
69
|
-
Whether to
|
|
69
|
+
Whether to generate the atlas if needed. Defaults to `true` in development, `false` in production.
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
</td></tr>
|
package/docs/server.md
CHANGED
|
@@ -19,6 +19,17 @@ Description
|
|
|
19
19
|
</th></tr></thead>
|
|
20
20
|
<tbody><tr><td>
|
|
21
21
|
|
|
22
|
+
[AssetsLibrary](./server.assetslibrary.md)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</td><td>
|
|
26
|
+
|
|
27
|
+
Manages the assets library and synchronization of assets to the local assets directory in development.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</td></tr>
|
|
31
|
+
<tr><td>
|
|
32
|
+
|
|
22
33
|
[Audio](./server.audio.md)
|
|
23
34
|
|
|
24
35
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [ModelRegistry](./server.modelregistry.md) > [hasModel](./server.modelregistry.hasmodel.md)
|
|
4
|
+
|
|
5
|
+
## ModelRegistry.hasModel() method
|
|
6
|
+
|
|
7
|
+
Checks if a model is registered in the model registry.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
hasModel(modelUri: string): boolean;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
modelUri
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The URI of the model to check.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
|
|
51
|
+
**Returns:**
|
|
52
|
+
|
|
53
|
+
boolean
|
|
54
|
+
|
|
55
|
+
Whether the model is registered.
|
|
56
|
+
|
|
@@ -89,26 +89,7 @@ boolean
|
|
|
89
89
|
|
|
90
90
|
</td><td>
|
|
91
91
|
|
|
92
|
-
Whether to
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</td></tr>
|
|
96
|
-
<tr><td>
|
|
97
|
-
|
|
98
|
-
[optimizeEveryStart](./server.modelregistry.optimizeeverystart.md)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</td><td>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</td><td>
|
|
105
|
-
|
|
106
|
-
boolean
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</td><td>
|
|
110
|
-
|
|
111
|
-
Whether to always run model optimization on server start.
|
|
92
|
+
Whether to generate optimized models if needed. Defaults to `true` in development, `false` in production.
|
|
112
93
|
|
|
113
94
|
|
|
114
95
|
</td></tr>
|
|
@@ -229,6 +210,20 @@ Retrieves the trimesh of a model.
|
|
|
229
210
|
Retrieves the X-axis width of a model for a scale of 1.
|
|
230
211
|
|
|
231
212
|
|
|
213
|
+
</td></tr>
|
|
214
|
+
<tr><td>
|
|
215
|
+
|
|
216
|
+
[hasModel(modelUri)](./server.modelregistry.hasmodel.md)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
</td><td>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
</td><td>
|
|
223
|
+
|
|
224
|
+
Checks if a model is registered in the model registry.
|
|
225
|
+
|
|
226
|
+
|
|
232
227
|
</td></tr>
|
|
233
228
|
<tr><td>
|
|
234
229
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hytopia",
|
|
3
|
-
"version": "0.12.0-prerelease-
|
|
3
|
+
"version": "0.12.0-prerelease-3",
|
|
4
4
|
"description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server.mjs",
|