@crowdedkingdoms/crowdyjs 18.29.0-dev.1 → 18.30.0-dev.1
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/MIGRATION.md +33 -0
- package/README.md +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/stores/chunks.d.ts +176 -21
- package/dist/stores/chunks.d.ts.map +1 -1
- package/dist/stores/chunks.js +593 -99
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/session.d.ts +11 -1
- package/dist/stores/session.d.ts.map +1 -1
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -120,6 +120,39 @@ super-admin's session). There is no SDK replacement.
|
|
|
120
120
|
`dev`'s SDL after #417 merged (`npm run schema:sync:paths -- --schema <that schema.gql>`, then
|
|
121
121
|
`npm run codegen`).
|
|
122
122
|
|
|
123
|
+
## 18.30.0: a ChunkStore the game can stand behind
|
|
124
|
+
|
|
125
|
+
**What it needs.** What 18.29.0 needs (ck-api `v2.68.0` for the GraphQL proxy); the box reads and
|
|
126
|
+
`since` are ck-api `v2.67.0`'s.
|
|
127
|
+
|
|
128
|
+
**What changes for a game using `session.chunks`.**
|
|
129
|
+
|
|
130
|
+
- **`ensureAround` reads only what the store does not hold, as boxes.** A step along one axis at
|
|
131
|
+
range 8 reads the 289 chunks it uncovers instead of the 4,913 of the cube, and each box is read
|
|
132
|
+
in pages of 1,000 (the size the server says it applied). Range 0 now reads one chunk; it read
|
|
133
|
+
the 27 of radius 1. A chunk a later page repeats is counted in `duplicatePageChunks`.
|
|
134
|
+
- **A refused edit is undone.** An edit the server refuses (`UNAUTHORIZED` for a voxel the player
|
|
135
|
+
may not edit), one the transport does not take (`NOT_SENT`, `SEND_FAILED`), and one whose echo
|
|
136
|
+
does not come back within `editTimeoutMs` (10 s, `TIMEOUT`) put the voxel back as it was and
|
|
137
|
+
reach `onEditRefused(listener)` as a `VoxelEditRefusal` (`coord`, `voxel`, `voxelType`, `state`,
|
|
138
|
+
`reason`, `restored`). It was left showing. A store that hydrates reads a timed-out edit's chunk
|
|
139
|
+
again, since its echo may only have been lost.
|
|
140
|
+
- **Edits are paced.** At most `maxEditsInFlight` (128) are unanswered and `maxEditsPerSecond`
|
|
141
|
+
(250) go out a second; the rest wait in order (`queuedEdits`, `editsInFlight`), already shown.
|
|
142
|
+
The server drops a session's traffic above 500 messages a second without a word. `setVoxel`
|
|
143
|
+
resolves when its edit's turn came.
|
|
144
|
+
- **`chunkChanged` reads the chunk again** (`reloadReplacedChunks`), and the server's copy replaces
|
|
145
|
+
a seeded chunk's queued write-back.
|
|
146
|
+
- **After a reconnect the store catches up** (`catchUpOnReconnect`, needs the client's `realtime`):
|
|
147
|
+
`catchUp(since)` applies the recorded edits of the last area since 30 s before the connection
|
|
148
|
+
dropped (`voxels.listByDistance`) and reads again the chunks whose stored row changed.
|
|
149
|
+
- **A read keeps this client's unanswered edits over a stored copy that predates them.** `hydrate`
|
|
150
|
+
replaces the chunk's states and overlay with the stored copy's (a `world.set_chunk` drops older
|
|
151
|
+
edits), then puts those edits back.
|
|
152
|
+
- `CachedChunk` has `voxelStatesTruncated` (the hydration got only part of the chunk's edits) and
|
|
153
|
+
`storedAt` (when the server last wrote the stored row). `WorldStoresClient` takes optional
|
|
154
|
+
`voxels` and `realtime`, which a `CrowdyClient` has.
|
|
155
|
+
|
|
123
156
|
## 18.29.0: a replaced chunk says so
|
|
124
157
|
|
|
125
158
|
**What it needs.** ck-api `v2.68.0` (cks-game-api #654) for the GraphQL proxy: the
|
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ so it needs that Game API or newer; promote the Game API before the SDK on each
|
|
|
34
34
|
|
|
35
35
|
| CrowdyJS | Needs the Game API (ck-api) |
|
|
36
36
|
| --- | --- |
|
|
37
|
+
| 18.30.0 | as 18.29.0 (`ChunkStore` reads boxes and `since`: v2.67.0) |
|
|
37
38
|
| 18.29.0 | v2.68.0 or later for the GraphQL proxy (`udpNotifications` selects `ChunkChangedNotification`) |
|
|
38
39
|
| 18.28.0 | v2.67.0 or later (`gameApps.nearbyGrids` selects `permissionKeys`) |
|
|
39
40
|
| 18.27.0 | v2.64.0 or later (`isEmailConfirmationRequiredError` reads a code v2.65.0 sends) |
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* never an untrusted browser.
|
|
47
47
|
*/
|
|
48
48
|
/** The published package version. Mirrors `package.json`. */
|
|
49
|
-
export declare const VERSION = "18.
|
|
49
|
+
export declare const VERSION = "18.30.0-dev.1";
|
|
50
50
|
export { LbCookieStore } from './lb-cookie-store.js';
|
|
51
51
|
export { CrowdyClient, createCrowdyClient, type CrowdyClientConfig, } from './crowdy-client.js';
|
|
52
52
|
export { CROWDY_DEFAULT_TIER, CROWDY_DEFAULT_HOST, CROWDY_DEFAULT_HTTP_ORIGIN, CROWDY_DEFAULT_WS_ORIGIN, } from './default-origin.js';
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* never an untrusted browser.
|
|
47
47
|
*/
|
|
48
48
|
/** The published package version. Mirrors `package.json`. */
|
|
49
|
-
export const VERSION = '18.
|
|
49
|
+
export const VERSION = '18.30.0-dev.1';
|
|
50
50
|
export { LbCookieStore } from './lb-cookie-store.js';
|
|
51
51
|
export { CrowdyClient, createCrowdyClient, } from './crowdy-client.js';
|
|
52
52
|
// The tier this build defaults to, exported so a consumer can PRINT what it is
|
package/dist/stores/chunks.d.ts
CHANGED
|
@@ -59,9 +59,46 @@ export interface CachedChunk<TVoxelState = string, TChunkState = string> {
|
|
|
59
59
|
updatedAt: number;
|
|
60
60
|
/** Whether sparse voxel states were hydrated (bulk loads omit them). */
|
|
61
61
|
hydrated: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the last hydration got only part of the chunk's recorded edits (the server returns at
|
|
64
|
+
* most 262,144 per request): the rest are missing from `voxels` and `voxelStates`.
|
|
65
|
+
*/
|
|
66
|
+
voxelStatesTruncated: boolean;
|
|
67
|
+
/** When the server last wrote the chunk's stored row (epoch ms), from the last read of it; null when unknown. */
|
|
68
|
+
storedAt: number | null;
|
|
62
69
|
/** Whether local edits are queued for write-back. */
|
|
63
70
|
dirty: boolean;
|
|
64
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* A voxel edit the store undid: the server refused it, it could not be sent, or no echo came back
|
|
74
|
+
* in time. See {@link ChunkStore.onEditRefused}.
|
|
75
|
+
*/
|
|
76
|
+
export interface VoxelEditRefusal<TVoxelState = string> {
|
|
77
|
+
readonly coord: ChunkCoord;
|
|
78
|
+
/** The within-chunk voxel. */
|
|
79
|
+
readonly voxel: {
|
|
80
|
+
readonly x: number;
|
|
81
|
+
readonly y: number;
|
|
82
|
+
readonly z: number;
|
|
83
|
+
};
|
|
84
|
+
/** The type the edit set. */
|
|
85
|
+
readonly voxelType: number;
|
|
86
|
+
/** The state the edit set, when it had one. */
|
|
87
|
+
readonly state?: TVoxelState;
|
|
88
|
+
/**
|
|
89
|
+
* The server's `UdpErrorCode` for a refusal (`UNAUTHORIZED` for a voxel the player may not edit),
|
|
90
|
+
* `NOT_SENT` when the transport did not take it, `SEND_FAILED` when the send threw, or `TIMEOUT`
|
|
91
|
+
* when no echo came back within {@link ChunkStoreConfig.editTimeoutMs}. A timed-out edit may
|
|
92
|
+
* have been applied with its echo lost: a store that hydrates reads the chunk again.
|
|
93
|
+
*/
|
|
94
|
+
readonly reason: string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the store put the voxel back as it was before the edit. It does not when a newer edit
|
|
97
|
+
* of the voxel (this client's or another's) is what the voxel shows, or the edit was sent with
|
|
98
|
+
* `optimistic: false`.
|
|
99
|
+
*/
|
|
100
|
+
readonly restored: boolean;
|
|
101
|
+
}
|
|
65
102
|
/**
|
|
66
103
|
* A chunk write-back the store stopped trying. The chunk keeps its local voxels and is
|
|
67
104
|
* no longer dirty, so it can be pruned and loaded again from the server's copy.
|
|
@@ -136,6 +173,34 @@ export interface ChunkStoreConfig<TVoxelState = string, TChunkState = string> {
|
|
|
136
173
|
* the platform, so all clients of a world just have to agree.
|
|
137
174
|
*/
|
|
138
175
|
voxelIndex?: (x: number, y: number, z: number) => number;
|
|
176
|
+
/**
|
|
177
|
+
* Edits sent and not yet answered (echoed, refused or timed out), 1-128. Further edits wait in
|
|
178
|
+
* order. Defaults to 128: the sequence number that matches an answer to its edit is one byte.
|
|
179
|
+
*/
|
|
180
|
+
maxEditsInFlight?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Voxel edits sent per second at most; a quarter second's worth may go at once. Defaults to 250,
|
|
183
|
+
* half of the 500 messages a second the server takes from one session (it drops the rest
|
|
184
|
+
* without a word), leaving the other half to actor updates and messages.
|
|
185
|
+
*/
|
|
186
|
+
maxEditsPerSecond?: number;
|
|
187
|
+
/**
|
|
188
|
+
* How long a sent edit waits for its echo before the store undoes it and reports `TIMEOUT`.
|
|
189
|
+
* Defaults to 10 000 ms.
|
|
190
|
+
*/
|
|
191
|
+
editTimeoutMs?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Read a tracked chunk again when the server reports it was replaced as a whole (`chunkChanged`:
|
|
194
|
+
* a hub's or mod's `world.set_chunk`). The server's copy also replaces a seeded chunk's queued
|
|
195
|
+
* write-back. Defaults to true.
|
|
196
|
+
*/
|
|
197
|
+
reloadReplacedChunks?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* When the realtime connection comes back, read what changed in the last area
|
|
200
|
+
* {@link ChunkStore.ensureAround} loaded while it was down (see {@link ChunkStore.catchUp}).
|
|
201
|
+
* Needs the client's `realtime` (a `CrowdyClient` has it). Defaults to true.
|
|
202
|
+
*/
|
|
203
|
+
catchUpOnReconnect?: boolean;
|
|
139
204
|
/** Clock override for tests. Defaults to `Date.now`. */
|
|
140
205
|
now?: () => number;
|
|
141
206
|
}
|
|
@@ -160,23 +225,30 @@ export interface SetVoxelInput<TVoxelState> {
|
|
|
160
225
|
* The SDK-managed **chunk/voxel cache** — the client-side source of truth
|
|
161
226
|
* for terrain:
|
|
162
227
|
*
|
|
163
|
-
* - `ensureAround(center, radius)`
|
|
164
|
-
*
|
|
165
|
-
*
|
|
228
|
+
* - `ensureAround(center, radius)` reads only the chunks it does not hold yet,
|
|
229
|
+
* as boxes (`chunks.byDistance` with `lowChunk`/`highChunk`, paged): a step
|
|
230
|
+
* reads the slab it uncovers. It hydrates sparse voxel states, marks chunks
|
|
231
|
+
* the server never stored as `missing`, and hands them to your `onMissing`
|
|
166
232
|
* worldgen hook.
|
|
167
233
|
* - Realtime `voxelUpdate` notifications merge into the cache automatically
|
|
168
234
|
* (dense grid write + typed state decode + revision bump + change event; an
|
|
169
235
|
* edit with a type outside 0-255 or a position outside 0-15 goes to the
|
|
170
|
-
* chunk's `overlay` instead).
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
236
|
+
* chunk's `overlay` instead). A `chunkChanged` (a hub's or mod's
|
|
237
|
+
* `world.set_chunk`) reads the chunk again.
|
|
238
|
+
* - `setVoxel` applies locally (optimistic) and replicates via the UDP path,
|
|
239
|
+
* paced: at most 128 edits unanswered and 250 a second by default. The
|
|
240
|
+
* server delivers every accepted edit back to its sender: that echo is
|
|
241
|
+
* matched (sender uuid + sequence number + voxel) and not applied again, so a
|
|
242
|
+
* local edit fires one change event, and an older echo never rolls back a
|
|
243
|
+
* newer local edit. It is applied only when another client's edit of that
|
|
244
|
+
* voxel arrived in between (the server ordered yours last) or the edit was
|
|
245
|
+
* sent with `optimistic: false`. An edit the server refuses, or whose echo
|
|
246
|
+
* does not come back in time, is undone and reported ({@link onEditRefused}).
|
|
247
|
+
* - After the realtime connection drops and comes back, it reads what changed
|
|
248
|
+
* in the area meanwhile ({@link catchUp}).
|
|
178
249
|
* - `seed`/`flush` implement deterministic-worldgen write-back through
|
|
179
|
-
* `chunks.update`, one throttled chunk at a time.
|
|
250
|
+
* `chunks.update`, one throttled chunk at a time. Only seeded chunks are
|
|
251
|
+
* written back: realtime edits are recorded by the server.
|
|
180
252
|
*
|
|
181
253
|
* All reads are synchronous; writes land on WebSocket events, so render
|
|
182
254
|
* loops and background tabs behave (see the module docs).
|
|
@@ -196,16 +268,35 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
196
268
|
private readonly writeBackDueAt;
|
|
197
269
|
private readonly changeListeners;
|
|
198
270
|
private readonly writeBackFailureListeners;
|
|
271
|
+
private readonly editRefusedListeners;
|
|
199
272
|
private readonly voxelStateCodec;
|
|
200
273
|
private readonly chunkStateCodec;
|
|
201
274
|
private readonly hydrateStates;
|
|
202
275
|
private readonly now;
|
|
203
276
|
private readonly fallbackUuid;
|
|
204
277
|
private readonly voxelIndex;
|
|
278
|
+
private readonly maxInFlight;
|
|
279
|
+
private readonly editsPerSecond;
|
|
280
|
+
private readonly sendBurst;
|
|
281
|
+
private readonly editTimeoutMs;
|
|
205
282
|
private revisionValue;
|
|
206
283
|
private sequence;
|
|
207
284
|
/** This client's edits not yet echoed back, oldest first, per `chunkKey|voxelKey`. */
|
|
208
285
|
private readonly pendingEdits;
|
|
286
|
+
/** Edits waiting to be sent, in order. */
|
|
287
|
+
private readonly sendQueue;
|
|
288
|
+
/** Sent edits not yet answered, by sequence number. */
|
|
289
|
+
private readonly inFlightEdits;
|
|
290
|
+
private sendTokens;
|
|
291
|
+
private tokensAt;
|
|
292
|
+
/** Chunks being read again; a key mapped to true is read once more when that read ends. */
|
|
293
|
+
private readonly reloading;
|
|
294
|
+
/** The area the last {@link ensureAround} covered, for a catch-up. */
|
|
295
|
+
private lastArea;
|
|
296
|
+
/** When the realtime connection was last lost (while the store had loaded an area). */
|
|
297
|
+
private disconnectedAt;
|
|
298
|
+
private wasConnected;
|
|
299
|
+
private disposed;
|
|
209
300
|
constructor(ctx: WorldSessionContext, config?: ChunkStoreConfig<TVoxelState, TChunkState>);
|
|
210
301
|
/** Bumped on every cache change — poll it cheaply from a render loop. */
|
|
211
302
|
get revision(): number;
|
|
@@ -230,15 +321,32 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
230
321
|
*/
|
|
231
322
|
onWriteBackFailed(listener: (failure: ChunkWriteBackFailure<TVoxelState, TChunkState>) => void): () => void;
|
|
232
323
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
324
|
+
* Subscribe to the voxel edits the store undid: the server refused one (a voxel the player may
|
|
325
|
+
* not edit is `UNAUTHORIZED`), the transport did not take it, or its echo did not come back
|
|
326
|
+
* within {@link ChunkStoreConfig.editTimeoutMs}. The voxel already shows what it held before
|
|
327
|
+
* (see {@link VoxelEditRefusal.restored}) when the listener runs. A refusal is matched to its
|
|
328
|
+
* edit by the one-byte sequence number, which other stores' sends share, so it is best effort: an
|
|
329
|
+
* edit undone for another send's refusal comes back with its echo. @returns off.
|
|
330
|
+
*/
|
|
331
|
+
onEditRefused(listener: (refusal: VoxelEditRefusal<TVoxelState>) => void): () => void;
|
|
332
|
+
/** Edits sent and not yet echoed, refused or timed out. */
|
|
333
|
+
get editsInFlight(): number;
|
|
334
|
+
/** Edits waiting for their turn to be sent (see {@link ChunkStoreConfig.maxEditsPerSecond}). */
|
|
335
|
+
get queuedEdits(): number;
|
|
336
|
+
/**
|
|
337
|
+
* Ensure every chunk within `radius` (Chebyshev, 0-8) of `center` is
|
|
338
|
+
* tracked: reads the untracked ones, hydrates sparse voxel states when
|
|
235
339
|
* configured, marks server-unknown chunks `missing`, and seeds them via
|
|
236
340
|
* `onMissing`. In-flight requests are deduped; safe to call every time the
|
|
237
341
|
* player crosses a chunk boundary.
|
|
238
342
|
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
343
|
+
* Only chunks the store does not hold are read, as boxes of chunks
|
|
344
|
+
* (`chunks.byDistance` with `lowChunk` and `highChunk`, ck-api v2.67.0): a
|
|
345
|
+
* step along one axis at range 8 reads the 289 chunks it uncovers, not 4,913.
|
|
346
|
+
* Each box is read in pages, following the page size the server says it
|
|
347
|
+
* applied; a chunk a later page repeats is counted in
|
|
348
|
+
* {@link duplicatePageChunks} and not applied twice. A chunk the store
|
|
349
|
+
* already holds keeps what it has: prune it to load it afresh.
|
|
242
350
|
*
|
|
243
351
|
* Requests the platform refuses as busy are asked again with backoff, and
|
|
244
352
|
* at most 8 hydrations run at once. Hydration is best effort: a chunk whose
|
|
@@ -250,15 +358,37 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
250
358
|
ensureAround(center: ChunkCoord, radius: number): Promise<void>;
|
|
251
359
|
/** Hydrates chunks with at most {@link HYDRATE_CONCURRENCY} requests in flight. */
|
|
252
360
|
private hydrateAll;
|
|
361
|
+
/** Chunks a region read returned twice (on two of its pages); each was applied once. */
|
|
362
|
+
get duplicatePageChunks(): number;
|
|
363
|
+
private duplicatePageCount;
|
|
364
|
+
/**
|
|
365
|
+
* Read every stored chunk of a box, page by page, handing each to `take` once. A page shorter
|
|
366
|
+
* than the size the server applied is the last.
|
|
367
|
+
*/
|
|
368
|
+
private readBox;
|
|
253
369
|
/**
|
|
254
370
|
* Hydrate one chunk's sparse voxel states (and chunk state) via a
|
|
255
|
-
* single-chunk fetch — bulk loads omit them.
|
|
371
|
+
* single-chunk fetch — bulk loads omit them. This client's edits the server has not echoed yet
|
|
372
|
+
* stay over the stored copy, which may predate them.
|
|
256
373
|
*/
|
|
257
374
|
hydrate(coord: ChunkCoord): Promise<void>;
|
|
375
|
+
/**
|
|
376
|
+
* Read the chunks in the last area {@link ensureAround} loaded that changed since `since`: the
|
|
377
|
+
* recorded edits (`voxels.listByDistance`, when the client has `voxels`) are applied to the
|
|
378
|
+
* chunks the store holds, and a chunk whose stored row was written since then
|
|
379
|
+
* (`chunks.byDistance` with `since`: `updateChunk`, `world.set_chunk`) is read again. The store
|
|
380
|
+
* calls it when the realtime connection comes back ({@link ChunkStoreConfig.catchUpOnReconnect}),
|
|
381
|
+
* from 30 s before the connection dropped. Needs ck-api v2.67.0.
|
|
382
|
+
*/
|
|
383
|
+
catchUp(since: Date): Promise<void>;
|
|
258
384
|
/**
|
|
259
385
|
* Edit one voxel: applies to the cache immediately (optimistic) and
|
|
260
|
-
* replicates via the realtime voxel path.
|
|
261
|
-
*
|
|
386
|
+
* replicates via the realtime voxel path. Sends are paced
|
|
387
|
+
* ({@link ChunkStoreConfig.maxEditsInFlight},
|
|
388
|
+
* {@link ChunkStoreConfig.maxEditsPerSecond}); the promise resolves with
|
|
389
|
+
* the transport's acceptance once this edit's turn came. An edit the server
|
|
390
|
+
* refuses, or whose echo does not come back in time, is undone and reported
|
|
391
|
+
* through {@link onEditRefused}.
|
|
262
392
|
*/
|
|
263
393
|
setVoxel(input: SetVoxelInput<TVoxelState>): Promise<boolean>;
|
|
264
394
|
/**
|
|
@@ -286,10 +416,33 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
286
416
|
*/
|
|
287
417
|
private persistNext;
|
|
288
418
|
private forgetWriteBack;
|
|
419
|
+
/** Stop writing a chunk back: the server's copy replaced it. */
|
|
420
|
+
private dropWriteBack;
|
|
421
|
+
/**
|
|
422
|
+
* Read a chunk again (a `chunkChanged`, a catch-up, an edit whose echo never came). A request for
|
|
423
|
+
* a chunk already being read makes that read run once more when it ends, so the last answer is
|
|
424
|
+
* the newest. Failures leave what the store holds, marked for the next hydration.
|
|
425
|
+
*/
|
|
426
|
+
private reload;
|
|
289
427
|
private applyServerChunk;
|
|
428
|
+
/**
|
|
429
|
+
* Put this client's unanswered optimistic edits of a chunk back over a stored copy just applied,
|
|
430
|
+
* which may predate them. What the copy holds for each such voxel becomes what an undo restores.
|
|
431
|
+
*/
|
|
432
|
+
private reapplyPendingEdits;
|
|
433
|
+
/** Send queued edits while the pace and the in-flight limit allow. */
|
|
434
|
+
private pump;
|
|
435
|
+
private transmit;
|
|
436
|
+
/** Undo and report the sent edits whose echo did not come back in time. */
|
|
437
|
+
private expireEdits;
|
|
438
|
+
/**
|
|
439
|
+
* Forget an edit the server will not apply and put its voxel back as it was before it, unless a
|
|
440
|
+
* newer edit is what the voxel shows. Reports it, then lets the next queued edit go.
|
|
441
|
+
*/
|
|
442
|
+
private undoEdit;
|
|
290
443
|
private markMissing;
|
|
291
444
|
private rememberEdit;
|
|
292
|
-
/** The
|
|
445
|
+
/** The pending edits for one voxel, oldest first, after undoing the ones that timed out. */
|
|
293
446
|
private livePendingEdits;
|
|
294
447
|
/**
|
|
295
448
|
* Match a realtime voxel edit against this client's pending edits. Returns whether to apply it.
|
|
@@ -300,6 +453,8 @@ export declare class ChunkStore<TVoxelState = string, TChunkState = string> {
|
|
|
300
453
|
*/
|
|
301
454
|
private takeEcho;
|
|
302
455
|
private applyVoxel;
|
|
456
|
+
/** Set one voxel's type and state, in the dense grid or the overlay, without a change event. */
|
|
457
|
+
private writeVoxel;
|
|
303
458
|
/**
|
|
304
459
|
* Keep a voxel the dense grid cannot hold in the overlay. An in-grid position with a wide type
|
|
305
460
|
* leaves 0 in the grid and no dense state; one outside the grid never touches the grid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../../src/stores/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAUL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../../src/stores/chunks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAUL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,mBAAmB,EAAE,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