Connect tables/fences across chunk boundaries in the editor.
Neighbor-connect refresh now reads and updates adjacent chunks, and saving persists those edge-mask fixes with the selected chunk.
@@ -26,7 +26,9 @@ import
26
26
computeNeighborConnectMask,
27
27
composeNeighborConnectState,
28
28
definitionUsesNeighborConnect,
29
neighborConnectBlocksMatch
29
neighborConnectBlocksMatch,
30
neighborConnectRefreshTiles,
31
worldTileToChunkLocal
30
32
} from "/shared/world/neighborConnect.js";
31
33
import { GameSocket, defaultSocketUrl } from "../net/socket.js";
32
34
import { fetchAuthStatus, loginUrl, logoutUrl } from "../net/auth.js";
@@ -52,6 +54,14 @@ let view;
52
54
let draft = null;
53
55
/** @type {string|null} JSON snapshot of last loaded/saved draft (grounds/blocks/spawners/open). */
54
56
let draftBaseline = null;
57
/**
58
* Neighbor chunks whose connect masks were updated while editing the selected chunk.
59
* Key `"chunkX,chunkY"` → `{ open, grounds, blocks, spawners }`.
60
* @type {Map<string, { open: boolean, grounds: object[], blocks: object[], spawners: object[] }>}
61
*/
62
let dirtyNeighborChunks = new Map();
63
/** Spawners for loaded non-selected chunks (needed when saving edge-mask fixes). */
64
let neighborSpawnersByChunk = new Map();
55
65
/** @type {{ chunkX: number, chunkY: number, dimensionId?: string }|null} */
56
66
let pendingNavigate = null;
57
67
/** When true, next matching editorChunk after save should navigate to pendingNavigate. */
@@ -287,8 +297,15 @@ function captureDraftBaseline ()
287
297
syncSaveButton();
288
298
}
289
299
300
function chunkKey (cx, cy)
301
{
302
return `${cx},${cy}`;
303
}
304
290
305
function isDraftDirty ()
291
306
{
307
if (dirtyNeighborChunks.size > 0)
308
{ return true; }
292
309
if (!draft || draftBaseline == null)
293
310
{ return false; }
294
311
return JSON.stringify(draftPersistable()) !== draftBaseline;
@@ -315,6 +332,70 @@ function afterDraftMutation ()
315
332
syncSaveButton();
316
333
}
317
334
335
function clearNeighborEditState ()
336
{
337
dirtyNeighborChunks.clear();
338
}
339
340
function blockAtWorld (tileX, tileY)
341
{
342
const { chunkX: cx, chunkY: cy, localX, localY } = worldTileToChunkLocal(tileX, tileY, CHUNK_SIZE);
343
if (cx === chunkX && cy === chunkY && draft)
344
{ return draft.blocks[localY * CHUNK_SIZE + localX] ?? null; }
345
const dirty = dirtyNeighborChunks.get(chunkKey(cx, cy));
346
if (dirty)
347
{ return dirty.blocks[localY * CHUNK_SIZE + localX] ?? null; }
348
const snapshot = view?.chunks.get(chunkKey(cx, cy));
349
return snapshot?.blocks?.[localY * CHUNK_SIZE + localX] ?? null;
350
}
351
352
function ensureDirtyNeighborChunk (cx, cy)
353
{
354
const key = chunkKey(cx, cy);
355
let data = dirtyNeighborChunks.get(key);
356
if (data)
357
{ return data; }
358
const snapshot = view?.chunks.get(key);
359
if (!snapshot)
360
{ return null; }
361
data = {
362
open: !!snapshot.open,
363
grounds: (snapshot.grounds ?? []).map((ground) => normalizeGround(ground)),
364
blocks: (snapshot.blocks ?? []).map((block) => (block ? { ...block, config: block.config ?? null } : null)),
365
spawners: structuredClone(neighborSpawnersByChunk.get(key) ?? [])
366
};
367
dirtyNeighborChunks.set(key, data);
368
return data;
369
}
370
371
function writeBlockAtWorld (tileX, tileY, block)
372
{
373
const { chunkX: cx, chunkY: cy, localX, localY } = worldTileToChunkLocal(tileX, tileY, CHUNK_SIZE);
374
const index = localY * CHUNK_SIZE + localX;
375
if (cx === chunkX && cy === chunkY && draft)
376
{
377
draft.blocks[index] = block;
378
view.updateAuthoredTile(cx, cy, localX, localY, {
379
ground: draft.grounds[index],
380
block: draft.blocks[index],
381
light: draft.light[index]
382
});
383
return true;
384
}
385
const data = ensureDirtyNeighborChunk(cx, cy);
386
if (!data)
387
{ return false; }
388
data.blocks[index] = block;
389
const snapshot = view?.chunks.get(chunkKey(cx, cy));
390
const light = snapshot?.light?.[index];
391
view.updateAuthoredTile(cx, cy, localX, localY, {
392
ground: data.grounds[index],
393
block: data.blocks[index],
394
light
395
});
396
return true;
397
}
398
318
399
function showUnsavedModal (target)
319
400
{
320
401
pendingNavigate = target;
@@ -340,6 +421,8 @@ function saveSelectedChunk ()
340
421
$("error").textContent = "";
341
422
$("apply-status").textContent = "";
342
423
$("apply-status").className = "hint";
424
const neighborSaves = [...dirtyNeighborChunks.entries()];
425
clearNeighborEditState();
343
426
socket.send({
344
427
type: MessageType.editorSaveChunk,
345
428
chunkX,
@@ -352,6 +435,22 @@ function saveSelectedChunk ()
352
435
spawners: draft.spawners ?? []
353
436
}
354
437
});
438
for (const [key, data] of neighborSaves)
439
{
440
const [cx, cy] = key.split(",").map(Number);
441
socket.send({
442
type: MessageType.editorSaveChunk,
443
chunkX: cx,
444
chunkY: cy,
445
dimensionId: selectedDimensionId,
446
draft: {
447
open: data.open,
448
grounds: data.grounds,
449
blocks: data.blocks,
450
spawners: data.spawners ?? []
451
}
452
});
453
}
355
454
requestNeighbors();
356
455
return true;
357
456
}
@@ -459,6 +558,8 @@ function clearNeighborhoodView ()
459
558
{
460
559
draft = null;
461
560
draftBaseline = null;
561
clearNeighborEditState();
562
neighborSpawnersByChunk.clear();
462
563
if (!view)
463
564
{ return; }
464
565
for (const key of [...view.chunks.keys()])
@@ -560,38 +661,28 @@ function paintAt (localX, localY)
560
661
afterDraftMutation();
561
662
}
562
663
563
/** Recompute neighbor-connect masks for a type around a local tile (same chunk). */
664
/** Recompute neighbor-connect masks around a local tile, including across chunk edges. */
564
665
function refreshNeighborConnect (localX, localY, typeId)
565
666
{
566
667
const def = BLOCK_DEFINITIONS[typeId];
567
668
if (!draft || !definitionUsesNeighborConnect(def))
568
669
{ return; }
569
const cells = [[localX, localY]];
570
for (const [dx, dy] of [[0, -1], [1, 0], [0, 1], [-1, 0]])
571
{ cells.push([localX + dx, localY + dy]); }
572
for (const [lx, ly] of cells)
670
const originTileX = chunkX * CHUNK_SIZE + localX;
671
const originTileY = chunkY * CHUNK_SIZE + localY;
672
for (const [tileX, tileY] of neighborConnectRefreshTiles(originTileX, originTileY))
573
673
{
574
if (lx < 0 || ly < 0 || lx >= CHUNK_SIZE || ly >= CHUNK_SIZE)
575
{ continue; }
576
const index = ly * CHUNK_SIZE + lx;
577
const block = draft.blocks[index];
674
const block = blockAtWorld(tileX, tileY);
578
675
if (!block || block.typeId !== typeId)
579
676
{ continue; }
580
677
const mask = computeNeighborConnectMask((dx, dy) =>
581
678
{
582
const nx = lx + dx;
583
const ny = ly + dy;
584
if (nx < 0 || ny < 0 || nx >= CHUNK_SIZE || ny >= CHUNK_SIZE)
585
{ return false; }
586
const neighbor = draft.blocks[ny * CHUNK_SIZE + nx];
679
const neighbor = blockAtWorld(tileX + dx, tileY + dy);
587
680
return neighborConnectBlocksMatch(block, neighbor, def);
588
681
});
589
block.state = composeNeighborConnectState(def, block.state, mask);
590
view.updateAuthoredTile(chunkX, chunkY, lx, ly, {
591
ground: draft.grounds[index],
592
block: draft.blocks[index],
593
light: draft.light[index]
594
});
682
const nextState = composeNeighborConnectState(def, block.state, mask);
683
if (block.state === nextState)
684
{ continue; }
685
writeBlockAtWorld(tileX, tileY, { ...block, state: nextState });
595
686
}
596
687
}
597
688
@@ -619,6 +710,7 @@ function setRevisionState ({ activeRevisionId: active, pendingRevisionId: pendin
619
710
620
711
function showSelectedChunk (payload)
621
712
{
713
clearNeighborEditState();
622
714
draft = {
623
715
open: payload.data.open,
624
716
grounds: payload.data.grounds.map((ground) => normalizeGround(ground)),
@@ -678,7 +770,11 @@ function pruneView ()
678
770
{
679
771
const [x, y] = key.split(",").map(Number);
680
772
if (!inEditorView(x, y))
681
{ view.removeChunk(x, y); }
773
{
774
view.removeChunk(x, y);
775
neighborSpawnersByChunk.delete(key);
776
dirtyNeighborChunks.delete(key);
777
}
682
778
}
683
779
}
684
780
@@ -1158,8 +1254,13 @@ async function main ()
1158
1254
{ showSelectedChunk(message); }
1159
1255
else
1160
1256
{
1161
view.applySnapshot(snapshotFromPayload(message));
1162
syncSpawnersOverlay(message.chunkX, message.chunkY, message.data.spawners);
1257
const key = chunkKey(message.chunkX, message.chunkY);
1258
neighborSpawnersByChunk.set(key, message.data.spawners ?? []);
1259
if (!dirtyNeighborChunks.has(key))
1260
{
1261
view.applySnapshot(snapshotFromPayload(message));
1262
syncSpawnersOverlay(message.chunkX, message.chunkY, message.data.spawners);
1263
}
1163
1264
}
1164
1265
pruneView();
1165
1266
}
@@ -26,7 +26,9 @@ import26
computeNeighborConnectMask,26
computeNeighborConnectMask,27
composeNeighborConnectState,27
composeNeighborConnectState,28
definitionUsesNeighborConnect,28
definitionUsesNeighborConnect,29
neighborConnectBlocksMatch29
neighborConnectBlocksMatch,30
neighborConnectRefreshTiles,31
worldTileToChunkLocal30
} from "/shared/world/neighborConnect.js";32
} from "/shared/world/neighborConnect.js";31
import { GameSocket, defaultSocketUrl } from "../net/socket.js";33
import { GameSocket, defaultSocketUrl } from "../net/socket.js";32
import { fetchAuthStatus, loginUrl, logoutUrl } from "../net/auth.js";34
import { fetchAuthStatus, loginUrl, logoutUrl } from "../net/auth.js";@@ -52,6 +54,14 @@ let view;52
let draft = null;54
let draft = null;53
/** @type {string|null} JSON snapshot of last loaded/saved draft (grounds/blocks/spawners/open). */55
/** @type {string|null} JSON snapshot of last loaded/saved draft (grounds/blocks/spawners/open). */54
let draftBaseline = null;56
let draftBaseline = null;57
/**58
* Neighbor chunks whose connect masks were updated while editing the selected chunk.59
* Key `"chunkX,chunkY"` → `{ open, grounds, blocks, spawners }`.60
* @type {Map<string, { open: boolean, grounds: object[], blocks: object[], spawners: object[] }>}61
*/62
let dirtyNeighborChunks = new Map();63
/** Spawners for loaded non-selected chunks (needed when saving edge-mask fixes). */64
let neighborSpawnersByChunk = new Map();55
/** @type {{ chunkX: number, chunkY: number, dimensionId?: string }|null} */65
/** @type {{ chunkX: number, chunkY: number, dimensionId?: string }|null} */56
let pendingNavigate = null;66
let pendingNavigate = null;57
/** When true, next matching editorChunk after save should navigate to pendingNavigate. */67
/** When true, next matching editorChunk after save should navigate to pendingNavigate. */@@ -287,8 +297,15 @@ function captureDraftBaseline ()287
syncSaveButton();297
syncSaveButton();288
}298
}289
299
300
function chunkKey (cx, cy)301
{302
return `${cx},${cy}`;303
}304
290
function isDraftDirty ()305
function isDraftDirty ()291
{306
{307
if (dirtyNeighborChunks.size > 0)308
{ return true; }292
if (!draft || draftBaseline == null)309
if (!draft || draftBaseline == null)293
{ return false; }310
{ return false; }294
return JSON.stringify(draftPersistable()) !== draftBaseline;311
return JSON.stringify(draftPersistable()) !== draftBaseline;@@ -315,6 +332,70 @@ function afterDraftMutation ()315
syncSaveButton();332
syncSaveButton();316
}333
}317
334
335
function clearNeighborEditState ()336
{337
dirtyNeighborChunks.clear();338
}339
340
function blockAtWorld (tileX, tileY)341
{342
const { chunkX: cx, chunkY: cy, localX, localY } = worldTileToChunkLocal(tileX, tileY, CHUNK_SIZE);343
if (cx === chunkX && cy === chunkY && draft)344
{ return draft.blocks[localY * CHUNK_SIZE + localX] ?? null; }345
const dirty = dirtyNeighborChunks.get(chunkKey(cx, cy));346
if (dirty)347
{ return dirty.blocks[localY * CHUNK_SIZE + localX] ?? null; }348
const snapshot = view?.chunks.get(chunkKey(cx, cy));349
return snapshot?.blocks?.[localY * CHUNK_SIZE + localX] ?? null;350
}351
352
function ensureDirtyNeighborChunk (cx, cy)353
{354
const key = chunkKey(cx, cy);355
let data = dirtyNeighborChunks.get(key);356
if (data)357
{ return data; }358
const snapshot = view?.chunks.get(key);359
if (!snapshot)360
{ return null; }361
data = {362
open: !!snapshot.open,363
grounds: (snapshot.grounds ?? []).map((ground) => normalizeGround(ground)),364
blocks: (snapshot.blocks ?? []).map((block) => (block ? { ...block, config: block.config ?? null } : null)),365
spawners: structuredClone(neighborSpawnersByChunk.get(key) ?? [])366
};367
dirtyNeighborChunks.set(key, data);368
return data;369
}370
371
function writeBlockAtWorld (tileX, tileY, block)372
{373
const { chunkX: cx, chunkY: cy, localX, localY } = worldTileToChunkLocal(tileX, tileY, CHUNK_SIZE);374
const index = localY * CHUNK_SIZE + localX;375
if (cx === chunkX && cy === chunkY && draft)376
{377
draft.blocks[index] = block;378
view.updateAuthoredTile(cx, cy, localX, localY, {379
ground: draft.grounds[index],380
block: draft.blocks[index],381
light: draft.light[index]382
});383
return true;384
}385
const data = ensureDirtyNeighborChunk(cx, cy);386
if (!data)387
{ return false; }388
data.blocks[index] = block;389
const snapshot = view?.chunks.get(chunkKey(cx, cy));390
const light = snapshot?.light?.[index];391
view.updateAuthoredTile(cx, cy, localX, localY, {392
ground: data.grounds[index],393
block: data.blocks[index],394
light395
});396
return true;397
}398
318
function showUnsavedModal (target)399
function showUnsavedModal (target)319
{400
{320
pendingNavigate = target;401
pendingNavigate = target;@@ -340,6 +421,8 @@ function saveSelectedChunk ()340
$("error").textContent = "";421
$("error").textContent = "";341
$("apply-status").textContent = "";422
$("apply-status").textContent = "";342
$("apply-status").className = "hint";423
$("apply-status").className = "hint";424
const neighborSaves = [...dirtyNeighborChunks.entries()];425
clearNeighborEditState();343
socket.send({426
socket.send({344
type: MessageType.editorSaveChunk,427
type: MessageType.editorSaveChunk,345
chunkX,428
chunkX,@@ -352,6 +435,22 @@ function saveSelectedChunk ()352
spawners: draft.spawners ?? []435
spawners: draft.spawners ?? []353
}436
}354
});437
});438
for (const [key, data] of neighborSaves)439
{440
const [cx, cy] = key.split(",").map(Number);441
socket.send({442
type: MessageType.editorSaveChunk,443
chunkX: cx,444
chunkY: cy,445
dimensionId: selectedDimensionId,446
draft: {447
open: data.open,448
grounds: data.grounds,449
blocks: data.blocks,450
spawners: data.spawners ?? []451
}452
});453
}355
requestNeighbors();454
requestNeighbors();356
return true;455
return true;357
}456
}@@ -459,6 +558,8 @@ function clearNeighborhoodView ()459
{558
{460
draft = null;559
draft = null;461
draftBaseline = null;560
draftBaseline = null;561
clearNeighborEditState();562
neighborSpawnersByChunk.clear();462
if (!view)563
if (!view)463
{ return; }564
{ return; }464
for (const key of [...view.chunks.keys()])565
for (const key of [...view.chunks.keys()])@@ -560,38 +661,28 @@ function paintAt (localX, localY)560
afterDraftMutation();661
afterDraftMutation();561
}662
}562
663
563
/** Recompute neighbor-connect masks for a type around a local tile (same chunk). */664
/** Recompute neighbor-connect masks around a local tile, including across chunk edges. */564
function refreshNeighborConnect (localX, localY, typeId)665
function refreshNeighborConnect (localX, localY, typeId)565
{666
{566
const def = BLOCK_DEFINITIONS[typeId];667
const def = BLOCK_DEFINITIONS[typeId];567
if (!draft || !definitionUsesNeighborConnect(def))668
if (!draft || !definitionUsesNeighborConnect(def))568
{ return; }669
{ return; }569
const cells = [[localX, localY]];670
const originTileX = chunkX * CHUNK_SIZE + localX;570
for (const [dx, dy] of [[0, -1], [1, 0], [0, 1], [-1, 0]])671
const originTileY = chunkY * CHUNK_SIZE + localY;571
{ cells.push([localX + dx, localY + dy]); }672
for (const [tileX, tileY] of neighborConnectRefreshTiles(originTileX, originTileY))572
for (const [lx, ly] of cells)573
{673
{574
if (lx < 0 || ly < 0 || lx >= CHUNK_SIZE || ly >= CHUNK_SIZE)674
const block = blockAtWorld(tileX, tileY);575
{ continue; }576
const index = ly * CHUNK_SIZE + lx;577
const block = draft.blocks[index];578
if (!block || block.typeId !== typeId)675
if (!block || block.typeId !== typeId)579
{ continue; }676
{ continue; }580
const mask = computeNeighborConnectMask((dx, dy) =>677
const mask = computeNeighborConnectMask((dx, dy) =>581
{678
{582
const nx = lx + dx;679
const neighbor = blockAtWorld(tileX + dx, tileY + dy);583
const ny = ly + dy;584
if (nx < 0 || ny < 0 || nx >= CHUNK_SIZE || ny >= CHUNK_SIZE)585
{ return false; }586
const neighbor = draft.blocks[ny * CHUNK_SIZE + nx];587
return neighborConnectBlocksMatch(block, neighbor, def);680
return neighborConnectBlocksMatch(block, neighbor, def);588
});681
});589
block.state = composeNeighborConnectState(def, block.state, mask);682
const nextState = composeNeighborConnectState(def, block.state, mask);590
view.updateAuthoredTile(chunkX, chunkY, lx, ly, {683
if (block.state === nextState)591
ground: draft.grounds[index],684
{ continue; }592
block: draft.blocks[index],685
writeBlockAtWorld(tileX, tileY, { ...block, state: nextState });593
light: draft.light[index]594
});595
}686
}596
}687
}597
688
@@ -619,6 +710,7 @@ function setRevisionState ({ activeRevisionId: active, pendingRevisionId: pendin619
710
620
function showSelectedChunk (payload)711
function showSelectedChunk (payload)621
{712
{713
clearNeighborEditState();622
draft = {714
draft = {623
open: payload.data.open,715
open: payload.data.open,624
grounds: payload.data.grounds.map((ground) => normalizeGround(ground)),716
grounds: payload.data.grounds.map((ground) => normalizeGround(ground)),@@ -678,7 +770,11 @@ function pruneView ()678
{770
{679
const [x, y] = key.split(",").map(Number);771
const [x, y] = key.split(",").map(Number);680
if (!inEditorView(x, y))772
if (!inEditorView(x, y))681
{ view.removeChunk(x, y); }773
{774
view.removeChunk(x, y);775
neighborSpawnersByChunk.delete(key);776
dirtyNeighborChunks.delete(key);777
}682
}778
}683
}779
}684
780
@@ -1158,8 +1254,13 @@ async function main ()1158
{ showSelectedChunk(message); }1254
{ showSelectedChunk(message); }1159
else1255
else1160
{1256
{1161
view.applySnapshot(snapshotFromPayload(message));1257
const key = chunkKey(message.chunkX, message.chunkY);1162
syncSpawnersOverlay(message.chunkX, message.chunkY, message.data.spawners);1258
neighborSpawnersByChunk.set(key, message.data.spawners ?? []);1259
if (!dirtyNeighborChunks.has(key))1260
{1261
view.applySnapshot(snapshotFromPayload(message));1262
syncSpawnersOverlay(message.chunkX, message.chunkY, message.data.spawners);1263
}1163
}1264
}1164
pruneView();1265
pruneView();1165
}1266
}@@ -7,7 +7,9 @@ import {
7
7
parseNeighborConnectMask,
8
8
composeNeighborConnectState,
9
9
neighborConnectBlocksMatch,
10
parseMaterialNeighborConnectState
10
parseMaterialNeighborConnectState,
11
worldTileToChunkLocal,
12
neighborConnectRefreshTiles
11
13
} from "../../shared/world/neighborConnect.js";
12
14
import { CENTRAL_EXCHANGE_STAFF, pickExchangeClerk } from "../../shared/market/exchange.js";
13
15
import { MobId, normalizeSpawnerConfig, isCentralExchangeSpawner } from "../../shared/definitions/mobs.js";
@@ -55,6 +57,21 @@ test("wooden fences use the same material neighbor-connect as tables", () =>
55
57
assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);
56
58
});
57
59
60
test("world tiles map to chunk locals across boundaries", () =>
61
{
62
assert.deepEqual(worldTileToChunkLocal(15, 8, 16), {
63
chunkX: 0, chunkY: 0, localX: 15, localY: 8
64
});
65
assert.deepEqual(worldTileToChunkLocal(16, 8, 16), {
66
chunkX: 1, chunkY: 0, localX: 0, localY: 8
67
});
68
assert.deepEqual(worldTileToChunkLocal(-1, 0, 16), {
69
chunkX: -1, chunkY: 0, localX: 15, localY: 0
70
});
71
const tiles = neighborConnectRefreshTiles(15, 8);
72
assert.deepEqual(tiles[2], [16, 8]);
73
});
74
58
75
test("CE staff entries include sex labels and pickExchangeClerk returns a name", () =>
59
76
{
60
77
assert.ok(CENTRAL_EXCHANGE_STAFF.length >= 2);
@@ -7,7 +7,9 @@ import {7
parseNeighborConnectMask,7
parseNeighborConnectMask,8
composeNeighborConnectState,8
composeNeighborConnectState,9
neighborConnectBlocksMatch,9
neighborConnectBlocksMatch,10
parseMaterialNeighborConnectState10
parseMaterialNeighborConnectState,11
worldTileToChunkLocal,12
neighborConnectRefreshTiles11
} from "../../shared/world/neighborConnect.js";13
} from "../../shared/world/neighborConnect.js";12
import { CENTRAL_EXCHANGE_STAFF, pickExchangeClerk } from "../../shared/market/exchange.js";14
import { CENTRAL_EXCHANGE_STAFF, pickExchangeClerk } from "../../shared/market/exchange.js";13
import { MobId, normalizeSpawnerConfig, isCentralExchangeSpawner } from "../../shared/definitions/mobs.js";15
import { MobId, normalizeSpawnerConfig, isCentralExchangeSpawner } from "../../shared/definitions/mobs.js";@@ -55,6 +57,21 @@ test("wooden fences use the same material neighbor-connect as tables", () =>55
assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);57
assert.equal(neighborConnectBlocksMatch(pine, oakNeighbor, def), false);56
});58
});57
59
60
test("world tiles map to chunk locals across boundaries", () =>61
{62
assert.deepEqual(worldTileToChunkLocal(15, 8, 16), {63
chunkX: 0, chunkY: 0, localX: 15, localY: 864
});65
assert.deepEqual(worldTileToChunkLocal(16, 8, 16), {66
chunkX: 1, chunkY: 0, localX: 0, localY: 867
});68
assert.deepEqual(worldTileToChunkLocal(-1, 0, 16), {69
chunkX: -1, chunkY: 0, localX: 15, localY: 070
});71
const tiles = neighborConnectRefreshTiles(15, 8);72
assert.deepEqual(tiles[2], [16, 8]);73
});74
58
test("CE staff entries include sex labels and pickExchangeClerk returns a name", () =>75
test("CE staff entries include sex labels and pickExchangeClerk returns a name", () =>59
{76
{60
assert.ok(CENTRAL_EXCHANGE_STAFF.length >= 2);77
assert.ok(CENTRAL_EXCHANGE_STAFF.length >= 2);