hytopia 0.14.0 → 0.14.2

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 (27) hide show
  1. package/README.md +1 -1
  2. package/client-docs/client.hytopiaui.camerafar.md +13 -0
  3. package/client-docs/client.hytopiaui.cameranear.md +13 -0
  4. package/client-docs/client.hytopiaui.filterprofanity.md +56 -0
  5. package/client-docs/client.hytopiaui.getsceneuitemplaterenderer.md +56 -0
  6. package/client-docs/client.hytopiaui.gltfloader.md +13 -0
  7. package/client-docs/client.hytopiaui.hasprofanity.md +56 -0
  8. package/client-docs/client.hytopiaui.hassceneuitemplaterenderer.md +56 -0
  9. package/client-docs/client.hytopiaui.ismobile.md +13 -0
  10. package/client-docs/client.hytopiaui.lockpointer.md +70 -0
  11. package/client-docs/client.hytopiaui.md +374 -0
  12. package/client-docs/client.hytopiaui.offalldata.md +17 -0
  13. package/client-docs/client.hytopiaui.offdata.md +54 -0
  14. package/client-docs/client.hytopiaui.ondata.md +54 -0
  15. package/client-docs/client.hytopiaui.pressinput.md +70 -0
  16. package/client-docs/client.hytopiaui.registersceneuitemplate.md +70 -0
  17. package/client-docs/client.hytopiaui.senddata.md +54 -0
  18. package/client-docs/client.hytopiaui.setentitycolorcorrection.md +74 -0
  19. package/client-docs/client.hytopiaui.setmousesensitivitymultiplier.md +54 -0
  20. package/client-docs/client.hytopiaui.three.md +13 -0
  21. package/client-docs/client.hytopiaui.unregisterloadedsceneuitemplates.md +17 -0
  22. package/client-docs/client.hytopiaui.unregistersceneuitemplate.md +54 -0
  23. package/client-docs/client.md +58 -0
  24. package/client-docs/client.templaterenderer.md +13 -0
  25. package/client-docs/index.md +30 -0
  26. package/package.json +1 -1
  27. package/server.mjs +1 -1
@@ -0,0 +1,374 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md)
4
+
5
+ ## HytopiaUI class
6
+
7
+ Global API for interacting with the HYTOPIA game client. Access via the `hytopia` global variable in your client-side HTML UI code.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare class HytopiaUI
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Property
20
+
21
+
22
+ </th><th>
23
+
24
+ Modifiers
25
+
26
+
27
+ </th><th>
28
+
29
+ Type
30
+
31
+
32
+ </th><th>
33
+
34
+ Description
35
+
36
+
37
+ </th></tr></thead>
38
+ <tbody><tr><td>
39
+
40
+ [cameraFar](./client.hytopiaui.camerafar.md)
41
+
42
+
43
+ </td><td>
44
+
45
+ `readonly`
46
+
47
+
48
+ </td><td>
49
+
50
+ number
51
+
52
+
53
+ </td><td>
54
+
55
+ Maximum render distance of the camera in world units. Objects beyond this distance are not rendered.
56
+
57
+
58
+ </td></tr>
59
+ <tr><td>
60
+
61
+ [cameraNear](./client.hytopiaui.cameranear.md)
62
+
63
+
64
+ </td><td>
65
+
66
+ `readonly`
67
+
68
+
69
+ </td><td>
70
+
71
+ number
72
+
73
+
74
+ </td><td>
75
+
76
+ Minimum render distance of the camera in world units. Objects closer than this distance are not rendered.
77
+
78
+
79
+ </td></tr>
80
+ <tr><td>
81
+
82
+ [gltfLoader](./client.hytopiaui.gltfloader.md)
83
+
84
+
85
+ </td><td>
86
+
87
+ `readonly`
88
+
89
+
90
+ </td><td>
91
+
92
+ typeof GLTFLoader
93
+
94
+
95
+ </td><td>
96
+
97
+ Access to a THREE.js GLTFLoader instance for loading 3D models, useful if you want to render models in your UI.
98
+
99
+
100
+ </td></tr>
101
+ <tr><td>
102
+
103
+ [isMobile](./client.hytopiaui.ismobile.md)
104
+
105
+
106
+ </td><td>
107
+
108
+ `readonly`
109
+
110
+
111
+ </td><td>
112
+
113
+ boolean
114
+
115
+
116
+ </td><td>
117
+
118
+ Detects if the player is on a mobile device. Use this to adjust UI layout or controls, etc.
119
+
120
+
121
+ </td></tr>
122
+ <tr><td>
123
+
124
+ [three](./client.hytopiaui.three.md)
125
+
126
+
127
+ </td><td>
128
+
129
+ `readonly`
130
+
131
+
132
+ </td><td>
133
+
134
+ typeof THREE
135
+
136
+
137
+ </td><td>
138
+
139
+ Access to the THREE.js library for advanced 3D rendering. Use for custom visual effects in your UI.
140
+
141
+
142
+ </td></tr>
143
+ </tbody></table>
144
+
145
+ ## Methods
146
+
147
+ <table><thead><tr><th>
148
+
149
+ Method
150
+
151
+
152
+ </th><th>
153
+
154
+ Modifiers
155
+
156
+
157
+ </th><th>
158
+
159
+ Description
160
+
161
+
162
+ </th></tr></thead>
163
+ <tbody><tr><td>
164
+
165
+ [filterProfanity(text)](./client.hytopiaui.filterprofanity.md)
166
+
167
+
168
+ </td><td>
169
+
170
+
171
+ </td><td>
172
+
173
+ Filters inappropriate language from text by replacing profanity with asterisks. Use this to sanitize user-generated content displayed in your UI (e.g., chat messages, usernames).
174
+
175
+
176
+ </td></tr>
177
+ <tr><td>
178
+
179
+ [getSceneUITemplateRenderer(templateId)](./client.hytopiaui.getsceneuitemplaterenderer.md)
180
+
181
+
182
+ </td><td>
183
+
184
+
185
+ </td><td>
186
+
187
+ Retrieves a registered Scene UI template renderer function.
188
+
189
+
190
+ </td></tr>
191
+ <tr><td>
192
+
193
+ [hasProfanity(text)](./client.hytopiaui.hasprofanity.md)
194
+
195
+
196
+ </td><td>
197
+
198
+
199
+ </td><td>
200
+
201
+ Checks if text contains inappropriate language. Useful for validating input before sending to the server.
202
+
203
+
204
+ </td></tr>
205
+ <tr><td>
206
+
207
+ [hasSceneUITemplateRenderer(templateId)](./client.hytopiaui.hassceneuitemplaterenderer.md)
208
+
209
+
210
+ </td><td>
211
+
212
+
213
+ </td><td>
214
+
215
+ Checks whether a Scene UI template is currently registered.
216
+
217
+
218
+ </td></tr>
219
+ <tr><td>
220
+
221
+ [lockPointer(lock, maintainInput)](./client.hytopiaui.lockpointer.md)
222
+
223
+
224
+ </td><td>
225
+
226
+
227
+ </td><td>
228
+
229
+ Controls pointer lock for your UI. When locked, the cursor is hidden and mouse movement controls the camera. Call with `true` when hiding your UI so players can control the camera, `false` when showing UI that needs cursor interaction.
230
+
231
+
232
+ </td></tr>
233
+ <tr><td>
234
+
235
+ [offAllData()](./client.hytopiaui.offalldata.md)
236
+
237
+
238
+ </td><td>
239
+
240
+
241
+ </td><td>
242
+
243
+ Removes all registered data event listeners.
244
+
245
+
246
+ </td></tr>
247
+ <tr><td>
248
+
249
+ [offData(callback)](./client.hytopiaui.offdata.md)
250
+
251
+
252
+ </td><td>
253
+
254
+
255
+ </td><td>
256
+
257
+ Removes a specific data event listener. Pass the same callback function used in `onData()`<!-- -->.
258
+
259
+
260
+ </td></tr>
261
+ <tr><td>
262
+
263
+ [onData(callback)](./client.hytopiaui.ondata.md)
264
+
265
+
266
+ </td><td>
267
+
268
+
269
+ </td><td>
270
+
271
+ Registers a listener for data received by the server from `player.ui.sendData()`<!-- -->.
272
+
273
+
274
+ </td></tr>
275
+ <tr><td>
276
+
277
+ [pressInput(input, pressed)](./client.hytopiaui.pressinput.md)
278
+
279
+
280
+ </td><td>
281
+
282
+
283
+ </td><td>
284
+
285
+ Simulates player input programmatically. Useful for creating custom UI controls that trigger game actions, such as for mobile UI buttons.
286
+
287
+
288
+ </td></tr>
289
+ <tr><td>
290
+
291
+ [registerSceneUITemplate(templateId, templateRenderer)](./client.hytopiaui.registersceneuitemplate.md)
292
+
293
+
294
+ </td><td>
295
+
296
+
297
+ </td><td>
298
+
299
+ Registers a custom Scene UI template that will instantiate when a SceneUI on the server for the given templateId is loaded. Templates define how your UI should render for each Scene UI instance created by the server.
300
+
301
+
302
+ </td></tr>
303
+ <tr><td>
304
+
305
+ [sendData(data)](./client.hytopiaui.senddata.md)
306
+
307
+
308
+ </td><td>
309
+
310
+
311
+ </td><td>
312
+
313
+ Sends data from your UI to the game server. The server receives this via `player.ui.on(PlayerUIEvent.DATA, callback)`<!-- -->. Use this to notify the server of player actions taken in your custom UI.
314
+
315
+
316
+ </td></tr>
317
+ <tr><td>
318
+
319
+ [setEntityColorCorrection(entityId, color)](./client.hytopiaui.setentitycolorcorrection.md)
320
+
321
+
322
+ </td><td>
323
+
324
+
325
+ </td><td>
326
+
327
+ Applies color tint to an entity on the client only (does not affect other players' view). Use for client-side visual effects like highlighting, damage indicators, or team colors.
328
+
329
+
330
+ </td></tr>
331
+ <tr><td>
332
+
333
+ [setMouseSensitivityMultiplier(multiplier)](./client.hytopiaui.setmousesensitivitymultiplier.md)
334
+
335
+
336
+ </td><td>
337
+
338
+
339
+ </td><td>
340
+
341
+ Adjusts the user's base mouse sensitivity for camera rotation. Values above 1.0 increase sensitivity, below 1.0 decrease it. Useful for providing sensitivity settings in your UI options menu.
342
+
343
+
344
+ </td></tr>
345
+ <tr><td>
346
+
347
+ [unregisterLoadedSceneUITemplates()](./client.hytopiaui.unregisterloadedsceneuitemplates.md)
348
+
349
+
350
+ </td><td>
351
+
352
+
353
+ </td><td>
354
+
355
+ Removes all custom Scene UI templates. Built-in HYTOPIA templates (prefixed with `hytopia:`<!-- -->) are preserved. Use this when cleaning up your game code on disconnect or world change.
356
+
357
+
358
+ </td></tr>
359
+ <tr><td>
360
+
361
+ [unregisterSceneUITemplate(templateId)](./client.hytopiaui.unregistersceneuitemplate.md)
362
+
363
+
364
+ </td><td>
365
+
366
+
367
+ </td><td>
368
+
369
+ Removes a registered Scene UI template. The template will no longer be available for new Scene UI instances. Existing instances using this template are not affected.
370
+
371
+
372
+ </td></tr>
373
+ </tbody></table>
374
+
@@ -0,0 +1,17 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [offAllData](./client.hytopiaui.offalldata.md)
4
+
5
+ ## HytopiaUI.offAllData() method
6
+
7
+ Removes all registered data event listeners.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ offAllData(): void;
13
+ ```
14
+ **Returns:**
15
+
16
+ void
17
+
@@ -0,0 +1,54 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [offData](./client.hytopiaui.offdata.md)
4
+
5
+ ## HytopiaUI.offData() method
6
+
7
+ Removes a specific data event listener. Pass the same callback function used in `onData()`<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ offData(callback: (data: object) => void): 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
+ callback
36
+
37
+
38
+ </td><td>
39
+
40
+ (data: object) =&gt; void
41
+
42
+
43
+ </td><td>
44
+
45
+ The callback function to remove
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ void
54
+
@@ -0,0 +1,54 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [onData](./client.hytopiaui.ondata.md)
4
+
5
+ ## HytopiaUI.onData() method
6
+
7
+ Registers a listener for data received by the server from `player.ui.sendData()`<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ onData(callback: (data: object) => void): 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
+ callback
36
+
37
+
38
+ </td><td>
39
+
40
+ (data: object) =&gt; void
41
+
42
+
43
+ </td><td>
44
+
45
+ Function to call when data is received from the server.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ void
54
+
@@ -0,0 +1,70 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [pressInput](./client.hytopiaui.pressinput.md)
4
+
5
+ ## HytopiaUI.pressInput() method
6
+
7
+ Simulates player input programmatically. Useful for creating custom UI controls that trigger game actions, such as for mobile UI buttons.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ pressInput(input: string, pressed: boolean): 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
+ input
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ Input name (e.g., 'forward', 'backward', 'left', 'right', 'jump', 'sprint')
46
+
47
+
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ pressed
52
+
53
+
54
+ </td><td>
55
+
56
+ boolean
57
+
58
+
59
+ </td><td>
60
+
61
+ `true` to press and hold the input, `false` to release it
62
+
63
+
64
+ </td></tr>
65
+ </tbody></table>
66
+
67
+ **Returns:**
68
+
69
+ void
70
+
@@ -0,0 +1,70 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [registerSceneUITemplate](./client.hytopiaui.registersceneuitemplate.md)
4
+
5
+ ## HytopiaUI.registerSceneUITemplate() method
6
+
7
+ Registers a custom Scene UI template that will instantiate when a SceneUI on the server for the given templateId is loaded. Templates define how your UI should render for each Scene UI instance created by the server.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ registerSceneUITemplate(templateId: string, templateRenderer: TemplateRenderer): 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
+ templateId
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ Unique identifier for this template (must match the templateId used server-side when creating a SceneUI)
46
+
47
+
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ templateRenderer
52
+
53
+
54
+ </td><td>
55
+
56
+ [TemplateRenderer](./client.templaterenderer.md)
57
+
58
+
59
+ </td><td>
60
+
61
+ Function that creates and returns the HTML element for this UI. This is effectively the factory function.
62
+
63
+
64
+ </td></tr>
65
+ </tbody></table>
66
+
67
+ **Returns:**
68
+
69
+ void
70
+
@@ -0,0 +1,54 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [sendData](./client.hytopiaui.senddata.md)
4
+
5
+ ## HytopiaUI.sendData() method
6
+
7
+ Sends data from your UI to the game server. The server receives this via `player.ui.on(PlayerUIEvent.DATA, callback)`<!-- -->. Use this to notify the server of player actions taken in your custom UI.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ sendData(data: object): 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
+ data
36
+
37
+
38
+ </td><td>
39
+
40
+ object
41
+
42
+
43
+ </td><td>
44
+
45
+ Data object to send to the server
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ void
54
+