hytopia 0.1.34 → 0.1.36

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 (70) hide show
  1. package/README.md +3 -1
  2. package/docs/server.audio.md +1 -1
  3. package/docs/server.blocktype.md +1 -1
  4. package/docs/server.blocktyperegistry.md +2 -2
  5. package/docs/server.blocktyperegistry.registerblocktype.md +2 -18
  6. package/docs/server.chunk.getblock.md +55 -0
  7. package/docs/server.chunk.hasblock.md +55 -0
  8. package/docs/server.chunk.md +28 -0
  9. package/docs/server.chunklattice.getblock.md +55 -0
  10. package/docs/server.chunklattice.hasblock.md +55 -0
  11. package/docs/server.chunklattice.md +29 -1
  12. package/docs/server.chunklattice.setblock.md +2 -2
  13. package/docs/server.entity.md +35 -0
  14. package/docs/server.entity.settintcolor.md +53 -0
  15. package/docs/server.entity.tintcolor.md +13 -0
  16. package/docs/server.entityeventpayload.md +9 -0
  17. package/docs/server.entityeventpayload.settintcolor.entity.md +11 -0
  18. package/docs/server.entityeventpayload.settintcolor.md +70 -0
  19. package/docs/server.entityeventpayload.settintcolor.tintcolor.md +11 -0
  20. package/docs/server.entityeventtype.md +15 -1
  21. package/docs/server.entityoptions.md +19 -0
  22. package/docs/server.entityoptions.tintcolor.md +13 -0
  23. package/docs/server.gameserver.md +1 -1
  24. package/docs/server.hytopia.audio.md +1 -1
  25. package/docs/server.hytopia.blocktype.md +1 -1
  26. package/docs/server.hytopia.blocktyperegistry.md +2 -2
  27. package/docs/server.hytopia.blocktyperegistry.registerblocktype.md +2 -18
  28. package/docs/server.hytopia.chunk.getblock.md +55 -0
  29. package/docs/server.hytopia.chunk.hasblock.md +55 -0
  30. package/docs/server.hytopia.chunk.md +28 -0
  31. package/docs/server.hytopia.chunklattice.getblock.md +55 -0
  32. package/docs/server.hytopia.chunklattice.hasblock.md +55 -0
  33. package/docs/server.hytopia.chunklattice.md +29 -1
  34. package/docs/server.hytopia.chunklattice.setblock.md +2 -2
  35. package/docs/server.hytopia.entity.md +35 -0
  36. package/docs/server.hytopia.entity.settintcolor.md +53 -0
  37. package/docs/server.hytopia.entity.tintcolor.md +13 -0
  38. package/docs/server.hytopia.entityeventpayload.md +9 -0
  39. package/docs/server.hytopia.entityeventpayload.settintcolor.entity.md +11 -0
  40. package/docs/server.hytopia.entityeventpayload.settintcolor.md +70 -0
  41. package/docs/server.hytopia.entityeventpayload.settintcolor.tintcolor.md +11 -0
  42. package/docs/server.hytopia.entityeventtype.md +15 -1
  43. package/docs/server.hytopia.entityoptions.md +19 -0
  44. package/docs/server.hytopia.entityoptions.tintcolor.md +13 -0
  45. package/docs/server.hytopia.gameserver.md +1 -1
  46. package/docs/server.hytopia.md +11 -11
  47. package/docs/server.hytopia.rgbcolor.b.md +11 -0
  48. package/docs/server.hytopia.rgbcolor.g.md +11 -0
  49. package/docs/server.hytopia.rgbcolor.md +89 -0
  50. package/docs/server.hytopia.rgbcolor.r.md +11 -0
  51. package/docs/server.hytopia.simulation.md +14 -0
  52. package/docs/server.hytopia.simulation.setgravity.md +53 -0
  53. package/docs/server.hytopia.worldmap.blocktypes.md +1 -5
  54. package/docs/server.hytopia.worldmap.md +1 -1
  55. package/docs/server.md +11 -11
  56. package/docs/server.rgbcolor.b.md +11 -0
  57. package/docs/server.rgbcolor.g.md +11 -0
  58. package/docs/server.rgbcolor.md +89 -0
  59. package/docs/server.rgbcolor.r.md +11 -0
  60. package/docs/server.simulation.md +14 -0
  61. package/docs/server.simulation.setgravity.md +53 -0
  62. package/docs/server.worldmap.blocktypes.md +1 -5
  63. package/docs/server.worldmap.md +1 -1
  64. package/package.json +1 -1
  65. package/readme/assets/banner-2.jpeg +0 -0
  66. package/server.api.json +1277 -219
  67. package/server.d.ts +61 -42
  68. package/server.js +79 -79
  69. package/docs/server.hytopia.webserver.md +0 -20
  70. package/docs/server.webserver.md +0 -20
package/README.md CHANGED
@@ -5,12 +5,14 @@
5
5
 
6
6
  ## What is HYTOPIA?
7
7
 
8
- ![HYTOPIA Demo](./readme/assets/demo.gif)
8
+ ![HYTOPIA Banner](./readme/assets/banner-2.jpeg)
9
9
 
10
10
  HYTOPIA is a modern games platform inspired by Minecraft, Roblox, and Rec Room.
11
11
 
12
12
  HYTOPIA allows you to create your own highly-sharable, immersive, massively multiplayer games in a voxel-like style by writing TypeScript or JavaScript. All playable in a web browser on any device!
13
13
 
14
+ No need to deal with hosting or complex server infrastructure either, simply upload your game to HYTOPIA and we'll handle the scaling, server costs, and more!
15
+
14
16
  ## What is this SDK?
15
17
 
16
18
  *Note: This SDK is currently in alpha development. Expect breaking changes with new version releases.*
@@ -22,7 +22,7 @@ Audio instances are created directly as instances. They support a variety of con
22
22
 
23
23
  ```typescript
24
24
  (new Audio({
25
- uri: 'assets/music/song.mp3',
25
+ uri: 'music/song.mp3', // relative to the server's assets directory in the project root, resolves to assets/music/song.mp3
26
26
  loop: true,
27
27
  volume: 0.5,
28
28
  })).play(world);
@@ -24,7 +24,7 @@ Block types are created directly as instances. They support a variety of configu
24
24
  const stoneBlockTypeId = 10;
25
25
  world.blockTypeRegistry.registerBlockType(stoneBlockTypeId, new BlockType({
26
26
  id: stoneBlockTypeId,
27
- textureUri: 'assets/textures/stone.png',
27
+ textureUri: 'textures/stone.png',
28
28
  name: 'Stone',
29
29
  }));
30
30
 
@@ -25,7 +25,7 @@ The constructor for this class is marked as internal. Third-party code should no
25
25
  ```typescript
26
26
  world.blockTypeRegistry.registerGenericBlockType({
27
27
  id: 15,
28
- textureUri: 'assets/textures/dirt.png',
28
+ textureUri: 'textures/dirt.png',
29
29
  name: 'Dirt',
30
30
  });
31
31
  ```
@@ -124,7 +124,7 @@ Get a registered block type by its id.
124
124
  </td></tr>
125
125
  <tr><td>
126
126
 
127
- [registerBlockType(id, blockTypeReference)](./server.blocktyperegistry.registerblocktype.md)
127
+ [registerBlockType(blockType)](./server.blocktyperegistry.registerblocktype.md)
128
128
 
129
129
 
130
130
  </td><td>
@@ -9,7 +9,7 @@ Register a block type.
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- registerBlockType(id: number, blockTypeReference: BlockType): void;
12
+ registerBlockType(blockType: BlockType): void;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -32,23 +32,7 @@ Description
32
32
  </th></tr></thead>
33
33
  <tbody><tr><td>
34
34
 
35
- id
36
-
37
-
38
- </td><td>
39
-
40
- number
41
-
42
-
43
- </td><td>
44
-
45
- The id of the block type to register.
46
-
47
-
48
- </td></tr>
49
- <tr><td>
50
-
51
- blockTypeReference
35
+ blockType
52
36
 
53
37
 
54
38
  </td><td>
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Chunk](./server.chunk.md) &gt; [getBlock](./server.chunk.getblock.md)
4
+
5
+ ## Chunk.getBlock() method
6
+
7
+ Get the block type id at a specific local coordinate.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getBlock(localCoordinate: Vector3): number;
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
+ localCoordinate
36
+
37
+
38
+ </td><td>
39
+
40
+ [Vector3](./server.vector3.md)
41
+
42
+
43
+ </td><td>
44
+
45
+ The local coordinate of the block to get.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ number
53
+
54
+ The block type id.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Chunk](./server.chunk.md) &gt; [hasBlock](./server.chunk.hasblock.md)
4
+
5
+ ## Chunk.hasBlock() method
6
+
7
+ Check if a block exists at a specific local coordinate.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ hasBlock(localCoordinate: Vector3): 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
+ localCoordinate
36
+
37
+
38
+ </td><td>
39
+
40
+ [Vector3](./server.vector3.md)
41
+
42
+
43
+ </td><td>
44
+
45
+ The local coordinate of the block to check.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ boolean
53
+
54
+ Whether a block exists.
55
+
@@ -244,6 +244,20 @@ Convert a block index to a local coordinate.
244
244
  Despawn the chunk from the world.
245
245
 
246
246
 
247
+ </td></tr>
248
+ <tr><td>
249
+
250
+ [getBlock(localCoordinate)](./server.chunk.getblock.md)
251
+
252
+
253
+ </td><td>
254
+
255
+
256
+ </td><td>
257
+
258
+ Get the block type id at a specific local coordinate.
259
+
260
+
247
261
  </td></tr>
248
262
  <tr><td>
249
263
 
@@ -276,6 +290,20 @@ Convert a global coordinate to a local coordinate.
276
290
  Convert a global coordinate to an origin coordinate.
277
291
 
278
292
 
293
+ </td></tr>
294
+ <tr><td>
295
+
296
+ [hasBlock(localCoordinate)](./server.chunk.hasblock.md)
297
+
298
+
299
+ </td><td>
300
+
301
+
302
+ </td><td>
303
+
304
+ Check if a block exists at a specific local coordinate.
305
+
306
+
279
307
  </td></tr>
280
308
  <tr><td>
281
309
 
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [ChunkLattice](./server.chunklattice.md) &gt; [getBlock](./server.chunklattice.getblock.md)
4
+
5
+ ## ChunkLattice.getBlock() method
6
+
7
+ Get the block type id at a specific global coordinate.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getBlock(globalCoordinate: Vector3): number;
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
+ globalCoordinate
36
+
37
+
38
+ </td><td>
39
+
40
+ [Vector3](./server.vector3.md)
41
+
42
+
43
+ </td><td>
44
+
45
+ The global coordinate of the block to get.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ number
53
+
54
+ The block type id, 0 if no block is set.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [ChunkLattice](./server.chunklattice.md) &gt; [hasBlock](./server.chunklattice.hasblock.md)
4
+
5
+ ## ChunkLattice.hasBlock() method
6
+
7
+ Check if a block exists at a specific global coordinate.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ hasBlock(globalCoordinate: Vector3): 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
+ globalCoordinate
36
+
37
+
38
+ </td><td>
39
+
40
+ [Vector3](./server.vector3.md)
41
+
42
+
43
+ </td><td>
44
+
45
+ The global coordinate of the block to check.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ boolean
53
+
54
+ Whether a block exists.
55
+
@@ -81,6 +81,20 @@ Description
81
81
  Get all chunks in the lattice.
82
82
 
83
83
 
84
+ </td></tr>
85
+ <tr><td>
86
+
87
+ [getBlock(globalCoordinate)](./server.chunklattice.getblock.md)
88
+
89
+
90
+ </td><td>
91
+
92
+
93
+ </td><td>
94
+
95
+ Get the block type id at a specific global coordinate.
96
+
97
+
84
98
  </td></tr>
85
99
  <tr><td>
86
100
 
@@ -95,6 +109,20 @@ Get all chunks in the lattice.
95
109
  Get a chunk by its origin coordinate.
96
110
 
97
111
 
112
+ </td></tr>
113
+ <tr><td>
114
+
115
+ [hasBlock(globalCoordinate)](./server.chunklattice.hasblock.md)
116
+
117
+
118
+ </td><td>
119
+
120
+
121
+ </td><td>
122
+
123
+ Check if a block exists at a specific global coordinate.
124
+
125
+
98
126
  </td></tr>
99
127
  <tr><td>
100
128
 
@@ -120,7 +148,7 @@ Check if a chunk exists by its origin coordinate.
120
148
 
121
149
  </td><td>
122
150
 
123
- Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist.
151
+ Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist. Use block type id 0 for air.
124
152
 
125
153
 
126
154
  </td></tr>
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## ChunkLattice.setBlock() method
6
6
 
7
- Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist.
7
+ Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist. Use block type id 0 for air.
8
8
 
9
9
  **Signature:**
10
10
 
@@ -58,7 +58,7 @@ number
58
58
 
59
59
  </td><td>
60
60
 
61
- The block type id to set.
61
+ The block type id to set. Use 0 to remove the block and replace with air.
62
62
 
63
63
 
64
64
  </td></tr>
@@ -463,6 +463,27 @@ string \| undefined
463
463
  An arbitrary identifier tag of the entity. Useful for your own logic.
464
464
 
465
465
 
466
+ </td></tr>
467
+ <tr><td>
468
+
469
+ [tintColor](./server.entity.tintcolor.md)
470
+
471
+
472
+ </td><td>
473
+
474
+ `readonly`
475
+
476
+
477
+ </td><td>
478
+
479
+ [RgbColor](./server.rgbcolor.md) \| undefined
480
+
481
+
482
+ </td><td>
483
+
484
+ The tint color of the entity.
485
+
486
+
466
487
  </td></tr>
467
488
  <tr><td>
468
489
 
@@ -532,6 +553,20 @@ Despawns the entity from the world.
532
553
  Sets the character controller for the entity.
533
554
 
534
555
 
556
+ </td></tr>
557
+ <tr><td>
558
+
559
+ [setTintColor(tintColor)](./server.entity.settintcolor.md)
560
+
561
+
562
+ </td><td>
563
+
564
+
565
+ </td><td>
566
+
567
+ Sets the tint color of the entity.
568
+
569
+
535
570
  </td></tr>
536
571
  <tr><td>
537
572
 
@@ -0,0 +1,53 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Entity](./server.entity.md) &gt; [setTintColor](./server.entity.settintcolor.md)
4
+
5
+ ## Entity.setTintColor() method
6
+
7
+ Sets the tint color of the entity.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ setTintColor(tintColor: RgbColor | undefined): 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
+ tintColor
36
+
37
+
38
+ </td><td>
39
+
40
+ [RgbColor](./server.rgbcolor.md) \| undefined
41
+
42
+
43
+ </td><td>
44
+
45
+ The tint color of the entity.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ void
53
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Entity](./server.entity.md) &gt; [tintColor](./server.entity.tintcolor.md)
4
+
5
+ ## Entity.tintColor property
6
+
7
+ The tint color of the entity.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ get tintColor(): RgbColor | undefined;
13
+ ```
@@ -33,6 +33,15 @@ Description
33
33
  </td><td>
34
34
 
35
35
 
36
+ </td></tr>
37
+ <tr><td>
38
+
39
+ [SetTintColor](./server.entityeventpayload.settintcolor.md)
40
+
41
+
42
+ </td><td>
43
+
44
+
36
45
  </td></tr>
37
46
  <tr><td>
38
47
 
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [EntityEventPayload](./server.entityeventpayload.md) &gt; [SetTintColor](./server.entityeventpayload.settintcolor.md) &gt; [entity](./server.entityeventpayload.settintcolor.entity.md)
4
+
5
+ ## EntityEventPayload.SetTintColor.entity property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ entity: Entity;
11
+ ```
@@ -0,0 +1,70 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [EntityEventPayload](./server.entityeventpayload.md) &gt; [SetTintColor](./server.entityeventpayload.settintcolor.md)
4
+
5
+ ## EntityEventPayload.SetTintColor interface
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ interface SetTintColor
11
+ ```
12
+
13
+ ## Properties
14
+
15
+ <table><thead><tr><th>
16
+
17
+ Property
18
+
19
+
20
+ </th><th>
21
+
22
+ Modifiers
23
+
24
+
25
+ </th><th>
26
+
27
+ Type
28
+
29
+
30
+ </th><th>
31
+
32
+ Description
33
+
34
+
35
+ </th></tr></thead>
36
+ <tbody><tr><td>
37
+
38
+ [entity](./server.entityeventpayload.settintcolor.entity.md)
39
+
40
+
41
+ </td><td>
42
+
43
+
44
+ </td><td>
45
+
46
+ [Entity](./server.entity.md)
47
+
48
+
49
+ </td><td>
50
+
51
+
52
+ </td></tr>
53
+ <tr><td>
54
+
55
+ [tintColor](./server.entityeventpayload.settintcolor.tintcolor.md)
56
+
57
+
58
+ </td><td>
59
+
60
+
61
+ </td><td>
62
+
63
+ [RgbColor](./server.rgbcolor.md) \| undefined
64
+
65
+
66
+ </td><td>
67
+
68
+
69
+ </td></tr>
70
+ </tbody></table>
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [EntityEventPayload](./server.entityeventpayload.md) &gt; [SetTintColor](./server.entityeventpayload.settintcolor.md) &gt; [tintColor](./server.entityeventpayload.settintcolor.tintcolor.md)
4
+
5
+ ## EntityEventPayload.SetTintColor.tintColor property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ tintColor: RgbColor | undefined;
11
+ ```
@@ -43,6 +43,20 @@ DESPAWN
43
43
  </td><td>
44
44
 
45
45
 
46
+ </td></tr>
47
+ <tr><td>
48
+
49
+ SET\_TINT\_COLOR
50
+
51
+
52
+ </td><td>
53
+
54
+ `"ENTITY.SET_TINT_COLOR"`
55
+
56
+
57
+ </td><td>
58
+
59
+
46
60
  </td></tr>
47
61
  <tr><td>
48
62
 
@@ -65,7 +79,7 @@ START\_MODEL\_LOOPED\_ANIMATIONS
65
79
 
66
80
  </td><td>
67
81
 
68
- `"ENTITY.UPDATE_MODEL_LOOPED_ANIMATIONS"`
82
+ `"ENTITY.START_MODEL_LOOPED_ANIMATIONS"`
69
83
 
70
84
 
71
85
  </td><td>