hytopia 0.10.20 → 0.10.22-prerelease

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.
@@ -0,0 +1,56 @@
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; [initializeBlocks](./server.chunklattice.initializeblocks.md)
4
+
5
+ ## ChunkLattice.initializeBlocks() method
6
+
7
+ Initialize all blocks in the lattice in bulk, removing all previously existing blocks. This is much more efficient than setting each block individually.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ initializeBlocks(blocks: {
13
+ [blockTypeId: number]: Vector3Like[];
14
+ }): void;
15
+ ```
16
+
17
+ ## Parameters
18
+
19
+ <table><thead><tr><th>
20
+
21
+ Parameter
22
+
23
+
24
+ </th><th>
25
+
26
+ Type
27
+
28
+
29
+ </th><th>
30
+
31
+ Description
32
+
33
+
34
+ </th></tr></thead>
35
+ <tbody><tr><td>
36
+
37
+ blocks
38
+
39
+
40
+ </td><td>
41
+
42
+ { \[blockTypeId: number\]: [Vector3Like](./server.vector3like.md)<!-- -->\[\]; }
43
+
44
+
45
+ </td><td>
46
+
47
+ The blocks to initialize.
48
+
49
+
50
+ </td></tr>
51
+ </tbody></table>
52
+
53
+ **Returns:**
54
+
55
+ void
56
+
@@ -240,6 +240,20 @@ Check if a block exists at a specific global coordinate.
240
240
  Check if a chunk exists for a given global coordinate.
241
241
 
242
242
 
243
+ </td></tr>
244
+ <tr><td>
245
+
246
+ [initializeBlocks(blocks)](./server.chunklattice.initializeblocks.md)
247
+
248
+
249
+ </td><td>
250
+
251
+
252
+ </td><td>
253
+
254
+ Initialize all blocks in the lattice in bulk, removing all previously existing blocks. This is much more efficient than setting each block individually.
255
+
256
+
243
257
  </td></tr>
244
258
  <tr><td>
245
259
 
@@ -9,7 +9,7 @@ Set global data in the data persistence service. This data is available and shar
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- setGlobalData(key: string, data: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
12
+ setGlobalData(key: string, data: Record<string, unknown>): Promise<void>;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -66,5 +66,5 @@ The data to set.
66
66
 
67
67
  **Returns:**
68
68
 
69
- Promise&lt;Record&lt;string, unknown&gt; \| undefined&gt;
69
+ Promise&lt;void&gt;
70
70
 
@@ -291,20 +291,6 @@ Joins a player to a world.
291
291
  Resets all inputs keys
292
292
 
293
293
 
294
- </td></tr>
295
- <tr><td>
296
-
297
- [scheduleNotification(type, scheduledFor)](./server.player.schedulenotification.md)
298
-
299
-
300
- </td><td>
301
-
302
-
303
- </td><td>
304
-
305
- Schedule a notification the player at a point in time in the future. This will automatically handle prompting a player (if necessary) for notification permissions in-game.
306
-
307
-
308
294
  </td></tr>
309
295
  <tr><td>
310
296
 
@@ -319,20 +305,6 @@ Schedule a notification the player at a point in time in the future. This will a
319
305
  Set the persisted data for the player. This data can later be retrieved using [Player.getPersistedData()](./server.player.getpersisteddata.md)<!-- -->, even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game.
320
306
 
321
307
 
322
- </td></tr>
323
- <tr><td>
324
-
325
- [unscheduleNotification(notificationId)](./server.player.unschedulenotification.md)
326
-
327
-
328
- </td><td>
329
-
330
-
331
- </td><td>
332
-
333
- Unschedules a scheduled notification for the player.
334
-
335
-
336
308
  </td></tr>
337
309
  </tbody></table>
338
310
 
@@ -9,7 +9,7 @@ Set the persisted data for the player. This data can later be retrieved using [P
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- setPersistedData(data: Record<string, unknown>): Record<string, unknown>;
12
+ setPersistedData(data: Record<string, unknown>): void;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -50,7 +50,7 @@ The data to set.
50
50
 
51
51
  **Returns:**
52
52
 
53
- Record&lt;string, unknown&gt;
53
+ void
54
54
 
55
55
  The persisted data for the player.
56
56
 
@@ -85,20 +85,6 @@ RECONNECTED\_WORLD
85
85
  </td><td>
86
86
 
87
87
 
88
- </td></tr>
89
- <tr><td>
90
-
91
- REQUEST\_NOTIFICATION\_PERMISSION
92
-
93
-
94
- </td><td>
95
-
96
- `"PLAYER.REQUEST_NOTIFICATION_PERMISSION"`
97
-
98
-
99
- </td><td>
100
-
101
-
102
88
  </td></tr>
103
89
  <tr><td>
104
90
 
@@ -110,25 +110,6 @@ Emitted when a player leaves a world.
110
110
  Emitted when a player reconnects to a world after a unintentional disconnect.
111
111
 
112
112
 
113
- </td></tr>
114
- <tr><td>
115
-
116
- ["PLAYER.REQUEST\_NOTIFICATION\_PERMISSION"](./server.playereventpayloads._player.request_notification_permission_.md)
117
-
118
-
119
- </td><td>
120
-
121
-
122
- </td><td>
123
-
124
- { player: [Player](./server.player.md)<!-- -->; }
125
-
126
-
127
- </td><td>
128
-
129
- Emitted when notification permission is requested by a game.
130
-
131
-
132
113
  </td></tr>
133
114
  <tr><td>
134
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.20",
3
+ "version": "0.10.22-prerelease",
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",
package/server.api.json CHANGED
@@ -7527,6 +7527,63 @@
7527
7527
  "isAbstract": false,
7528
7528
  "name": "hasChunk"
7529
7529
  },
7530
+ {
7531
+ "kind": "Method",
7532
+ "canonicalReference": "server!ChunkLattice#initializeBlocks:member(1)",
7533
+ "docComment": "/**\n * Initialize all blocks in the lattice in bulk, removing all previously existing blocks. This is much more efficient than setting each block individually.\n *\n * @param blocks - The blocks to initialize.\n */\n",
7534
+ "excerptTokens": [
7535
+ {
7536
+ "kind": "Content",
7537
+ "text": "initializeBlocks(blocks: "
7538
+ },
7539
+ {
7540
+ "kind": "Content",
7541
+ "text": "{\n [blockTypeId: number]: "
7542
+ },
7543
+ {
7544
+ "kind": "Reference",
7545
+ "text": "Vector3Like",
7546
+ "canonicalReference": "server!Vector3Like:interface"
7547
+ },
7548
+ {
7549
+ "kind": "Content",
7550
+ "text": "[];\n }"
7551
+ },
7552
+ {
7553
+ "kind": "Content",
7554
+ "text": "): "
7555
+ },
7556
+ {
7557
+ "kind": "Content",
7558
+ "text": "void"
7559
+ },
7560
+ {
7561
+ "kind": "Content",
7562
+ "text": ";"
7563
+ }
7564
+ ],
7565
+ "isStatic": false,
7566
+ "returnTypeTokenRange": {
7567
+ "startIndex": 5,
7568
+ "endIndex": 6
7569
+ },
7570
+ "releaseTag": "Public",
7571
+ "isProtected": false,
7572
+ "overloadIndex": 1,
7573
+ "parameters": [
7574
+ {
7575
+ "parameterName": "blocks",
7576
+ "parameterTypeTokenRange": {
7577
+ "startIndex": 1,
7578
+ "endIndex": 4
7579
+ },
7580
+ "isOptional": false
7581
+ }
7582
+ ],
7583
+ "isOptional": false,
7584
+ "isAbstract": false,
7585
+ "name": "initializeBlocks"
7586
+ },
7530
7587
  {
7531
7588
  "kind": "Method",
7532
7589
  "canonicalReference": "server!ChunkLattice#setBlock:member(1)",
@@ -35386,16 +35443,7 @@
35386
35443
  },
35387
35444
  {
35388
35445
  "kind": "Content",
35389
- "text": "<"
35390
- },
35391
- {
35392
- "kind": "Reference",
35393
- "text": "Record",
35394
- "canonicalReference": "!Record:type"
35395
- },
35396
- {
35397
- "kind": "Content",
35398
- "text": "<string, unknown> | undefined>"
35446
+ "text": "<void>"
35399
35447
  },
35400
35448
  {
35401
35449
  "kind": "Content",
@@ -35405,7 +35453,7 @@
35405
35453
  "isStatic": false,
35406
35454
  "returnTypeTokenRange": {
35407
35455
  "startIndex": 6,
35408
- "endIndex": 10
35456
+ "endIndex": 8
35409
35457
  },
35410
35458
  "releaseTag": "Public",
35411
35459
  "isProtected": false,
@@ -35782,75 +35830,6 @@
35782
35830
  "isAbstract": false,
35783
35831
  "name": "resetInputs"
35784
35832
  },
35785
- {
35786
- "kind": "Method",
35787
- "canonicalReference": "server!Player#scheduleNotification:member(1)",
35788
- "docComment": "/**\n * Schedule a notification the player at a point in time in the future. This will automatically handle prompting a player (if necessary) for notification permissions in-game.\n *\n * @param type - The type of notification to schedule.\n *\n * @param scheduledFor - The point in time in the future to schedule the notification for.\n *\n * @returns The id of the notification if it was scheduled successfully, undefined otherwise.\n */\n",
35789
- "excerptTokens": [
35790
- {
35791
- "kind": "Content",
35792
- "text": "scheduleNotification(type: "
35793
- },
35794
- {
35795
- "kind": "Content",
35796
- "text": "string"
35797
- },
35798
- {
35799
- "kind": "Content",
35800
- "text": ", scheduledFor: "
35801
- },
35802
- {
35803
- "kind": "Content",
35804
- "text": "number"
35805
- },
35806
- {
35807
- "kind": "Content",
35808
- "text": "): "
35809
- },
35810
- {
35811
- "kind": "Reference",
35812
- "text": "Promise",
35813
- "canonicalReference": "!Promise:interface"
35814
- },
35815
- {
35816
- "kind": "Content",
35817
- "text": "<string | void>"
35818
- },
35819
- {
35820
- "kind": "Content",
35821
- "text": ";"
35822
- }
35823
- ],
35824
- "isStatic": false,
35825
- "returnTypeTokenRange": {
35826
- "startIndex": 5,
35827
- "endIndex": 7
35828
- },
35829
- "releaseTag": "Public",
35830
- "isProtected": false,
35831
- "overloadIndex": 1,
35832
- "parameters": [
35833
- {
35834
- "parameterName": "type",
35835
- "parameterTypeTokenRange": {
35836
- "startIndex": 1,
35837
- "endIndex": 2
35838
- },
35839
- "isOptional": false
35840
- },
35841
- {
35842
- "parameterName": "scheduledFor",
35843
- "parameterTypeTokenRange": {
35844
- "startIndex": 3,
35845
- "endIndex": 4
35846
- },
35847
- "isOptional": false
35848
- }
35849
- ],
35850
- "isOptional": false,
35851
- "isAbstract": false,
35852
- "name": "scheduleNotification"
35853
- },
35854
35833
  {
35855
35834
  "kind": "Method",
35856
35835
  "canonicalReference": "server!Player#setPersistedData:member(1)",
@@ -35873,14 +35852,9 @@
35873
35852
  "kind": "Content",
35874
35853
  "text": "): "
35875
35854
  },
35876
- {
35877
- "kind": "Reference",
35878
- "text": "Record",
35879
- "canonicalReference": "!Record:type"
35880
- },
35881
35855
  {
35882
35856
  "kind": "Content",
35883
- "text": "<string, unknown>"
35857
+ "text": "void"
35884
35858
  },
35885
35859
  {
35886
35860
  "kind": "Content",
@@ -35890,7 +35864,7 @@
35890
35864
  "isStatic": false,
35891
35865
  "returnTypeTokenRange": {
35892
35866
  "startIndex": 4,
35893
- "endIndex": 6
35867
+ "endIndex": 5
35894
35868
  },
35895
35869
  "releaseTag": "Public",
35896
35870
  "isProtected": false,
@@ -35940,59 +35914,6 @@
35940
35914
  "isProtected": false,
35941
35915
  "isAbstract": false
35942
35916
  },
35943
- {
35944
- "kind": "Method",
35945
- "canonicalReference": "server!Player#unscheduleNotification:member(1)",
35946
- "docComment": "/**\n * Unschedules a scheduled notification for the player.\n *\n * @param notificationId - The id of the notification returned from {@link Player.scheduleNotification}.\n *\n * @returns boolean - True if the notification was unscheduled, false otherwise.\n */\n",
35947
- "excerptTokens": [
35948
- {
35949
- "kind": "Content",
35950
- "text": "unscheduleNotification(notificationId: "
35951
- },
35952
- {
35953
- "kind": "Content",
35954
- "text": "string"
35955
- },
35956
- {
35957
- "kind": "Content",
35958
- "text": "): "
35959
- },
35960
- {
35961
- "kind": "Reference",
35962
- "text": "Promise",
35963
- "canonicalReference": "!Promise:interface"
35964
- },
35965
- {
35966
- "kind": "Content",
35967
- "text": "<boolean>"
35968
- },
35969
- {
35970
- "kind": "Content",
35971
- "text": ";"
35972
- }
35973
- ],
35974
- "isStatic": false,
35975
- "returnTypeTokenRange": {
35976
- "startIndex": 3,
35977
- "endIndex": 5
35978
- },
35979
- "releaseTag": "Public",
35980
- "isProtected": false,
35981
- "overloadIndex": 1,
35982
- "parameters": [
35983
- {
35984
- "parameterName": "notificationId",
35985
- "parameterTypeTokenRange": {
35986
- "startIndex": 1,
35987
- "endIndex": 2
35988
- },
35989
- "isOptional": false
35990
- }
35991
- ],
35992
- "isOptional": false,
35993
- "isAbstract": false,
35994
- "name": "unscheduleNotification"
35995
- },
35996
35917
  {
35997
35918
  "kind": "Property",
35998
35919
  "canonicalReference": "server!Player#username:member",
@@ -38977,27 +38898,6 @@
38977
38898
  "releaseTag": "Public",
38978
38899
  "name": "RECONNECTED_WORLD"
38979
38900
  },
38980
- {
38981
- "kind": "EnumMember",
38982
- "canonicalReference": "server!PlayerEvent.REQUEST_NOTIFICATION_PERMISSION:member",
38983
- "docComment": "",
38984
- "excerptTokens": [
38985
- {
38986
- "kind": "Content",
38987
- "text": "REQUEST_NOTIFICATION_PERMISSION = "
38988
- },
38989
- {
38990
- "kind": "Content",
38991
- "text": "\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\""
38992
- }
38993
- ],
38994
- "initializerTokenRange": {
38995
- "startIndex": 1,
38996
- "endIndex": 2
38997
- },
38998
- "releaseTag": "Public",
38999
- "name": "REQUEST_NOTIFICATION_PERMISSION"
39000
- },
39001
38901
  {
39002
38902
  "kind": "EnumMember",
39003
38903
  "canonicalReference": "server!PlayerEvent.REQUEST_SYNC:member",
@@ -39243,51 +39143,6 @@
39243
39143
  "endIndex": 8
39244
39144
  }
39245
39145
  },
39246
- {
39247
- "kind": "PropertySignature",
39248
- "canonicalReference": "server!PlayerEventPayloads#\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\":member",
39249
- "docComment": "/**\n * Emitted when notification permission is requested by a game.\n */\n",
39250
- "excerptTokens": [
39251
- {
39252
- "kind": "Content",
39253
- "text": "["
39254
- },
39255
- {
39256
- "kind": "Reference",
39257
- "text": "PlayerEvent.REQUEST_NOTIFICATION_PERMISSION",
39258
- "canonicalReference": "server!PlayerEvent.REQUEST_NOTIFICATION_PERMISSION:member"
39259
- },
39260
- {
39261
- "kind": "Content",
39262
- "text": "]: "
39263
- },
39264
- {
39265
- "kind": "Content",
39266
- "text": "{\n player: "
39267
- },
39268
- {
39269
- "kind": "Reference",
39270
- "text": "Player",
39271
- "canonicalReference": "server!Player:class"
39272
- },
39273
- {
39274
- "kind": "Content",
39275
- "text": ";\n }"
39276
- },
39277
- {
39278
- "kind": "Content",
39279
- "text": ";"
39280
- }
39281
- ],
39282
- "isReadonly": false,
39283
- "isOptional": false,
39284
- "releaseTag": "Public",
39285
- "name": "\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\"",
39286
- "propertyTypeTokenRange": {
39287
- "startIndex": 3,
39288
- "endIndex": 6
39289
- }
39290
- },
39291
39146
  {
39292
39147
  "kind": "PropertySignature",
39293
39148
  "canonicalReference": "server!PlayerEventPayloads#\"PLAYER.REQUEST_SYNC\":member",
package/server.d.ts CHANGED
@@ -994,6 +994,15 @@ export declare class ChunkLattice extends EventRouter {
994
994
  * @returns Whether the chunk exists.
995
995
  */
996
996
  hasChunk(globalCoordinate: Vector3Like): boolean;
997
+ /**
998
+ * Initialize all blocks in the lattice in bulk, removing
999
+ * all previously existing blocks. This is much more
1000
+ * efficient than setting each block individually.
1001
+ * @param blocks - The blocks to initialize.
1002
+ */
1003
+ initializeBlocks(blocks: {
1004
+ [blockTypeId: number]: Vector3Like[];
1005
+ }): void;
997
1006
  /**
998
1007
  * Set the block at a global coordinate by block type id, automatically
999
1008
  * creating a chunk if it doesn't exist. Use block type id 0 for air (to remove a block).
@@ -4336,6 +4345,8 @@ export declare type PathfindingOptions = {
4336
4345
  */
4337
4346
  export declare class PersistenceManager {
4338
4347
  static readonly instance: PersistenceManager;
4348
+ private _saveStatesClient;
4349
+ private _playerData;
4339
4350
 
4340
4351
  /**
4341
4352
  * Get global data from the data persistence service.
@@ -4351,7 +4362,7 @@ export declare class PersistenceManager {
4351
4362
  * @param key - The key to set the data to.
4352
4363
  * @param data - The data to set.
4353
4364
  */
4354
- setGlobalData(key: string, data: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
4365
+ setGlobalData(key: string, data: Record<string, unknown>): Promise<void>;
4355
4366
 
4356
4367
 
4357
4368
  }
@@ -4424,23 +4435,6 @@ export declare class Player extends EventRouter implements protocol.Serializable
4424
4435
  * @param world - The world to join the player to.
4425
4436
  */
4426
4437
  joinWorld(world: World): void;
4427
- /**
4428
- * Schedule a notification the player at a point in time in the future.
4429
- * This will automatically handle prompting a player (if necessary) for
4430
- * notification permissions in-game.
4431
- *
4432
- * @param type - The type of notification to schedule.
4433
- * @param scheduledFor - The point in time in the future to schedule the notification for.
4434
- * @returns The id of the notification if it was scheduled successfully, undefined otherwise.
4435
- */
4436
- scheduleNotification(type: string, scheduledFor: number): Promise<string | void>;
4437
- /**
4438
- * Unschedules a scheduled notification for the player.
4439
- *
4440
- * @param notificationId - The id of the notification returned from {@link Player.scheduleNotification}.
4441
- * @returns boolean - True if the notification was unscheduled, false otherwise.
4442
- */
4443
- unscheduleNotification(notificationId: string): Promise<boolean>;
4444
4438
 
4445
4439
 
4446
4440
  /**
@@ -4464,7 +4458,7 @@ export declare class Player extends EventRouter implements protocol.Serializable
4464
4458
  * @param data - The data to set.
4465
4459
  * @returns The persisted data for the player.
4466
4460
  */
4467
- setPersistedData(data: Record<string, unknown>): Record<string, unknown>;
4461
+ setPersistedData(data: Record<string, unknown>): void;
4468
4462
 
4469
4463
 
4470
4464
 
@@ -4835,7 +4829,6 @@ export declare enum PlayerEvent {
4835
4829
  JOINED_WORLD = "PLAYER.JOINED_WORLD",
4836
4830
  LEFT_WORLD = "PLAYER.LEFT_WORLD",
4837
4831
  RECONNECTED_WORLD = "PLAYER.RECONNECTED_WORLD",
4838
- REQUEST_NOTIFICATION_PERMISSION = "PLAYER.REQUEST_NOTIFICATION_PERMISSION",
4839
4832
  REQUEST_SYNC = "PLAYER.REQUEST_SYNC"
4840
4833
  }
4841
4834
 
@@ -4861,10 +4854,6 @@ export declare interface PlayerEventPayloads {
4861
4854
  player: Player;
4862
4855
  world: World;
4863
4856
  };
4864
- /** Emitted when notification permission is requested by a game. */
4865
- [PlayerEvent.REQUEST_NOTIFICATION_PERMISSION]: {
4866
- player: Player;
4867
- };
4868
4857
  /** Emitted when a player's client requests a round trip time synchronization. */
4869
4858
  [PlayerEvent.REQUEST_SYNC]: {
4870
4859
  player: Player;