@wildshard/engine 0.1.21 → 0.1.23
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/CHANGELOG.md +16 -0
- package/lint/engine-sides.json +5 -0
- package/lint/shardfile-boundaries.mjs +4 -2
- package/lint/sim-players.json +2 -13
- package/lint/wildshard-plugin.js +1 -1
- package/package.json +10 -2
- package/scripts/apfs-clone.mjs +5 -2
- package/scripts/app-build/catalogue.ts +39 -8
- package/scripts/app-build/serviceWorker.ts +4 -1
- package/scripts/app-build/splitOutput.mjs +33 -11
- package/scripts/audio-download-proof.mjs +1 -1
- package/scripts/check-spelled-paths.mjs +6 -3
- package/scripts/ci-pack.mjs +3 -3
- package/scripts/committed-fast-checks.mjs +2 -2
- package/scripts/engine-ci-shard.mjs +11 -0
- package/scripts/failmode-cases.mjs +1 -1
- package/scripts/failmode-proof.mjs +35 -11
- package/scripts/fight-page-census.mjs +131 -0
- package/scripts/goldens/board.py +44 -11
- package/scripts/goldens/native-residency.d.mts +1 -0
- package/scripts/goldens/native-residency.mjs +18 -4
- package/scripts/grid-crossing-walk-proof.mjs +3 -3
- package/scripts/hover-speed-probe.mjs +2 -2
- package/scripts/keep-copy.mjs +120 -0
- package/scripts/land.mjs +36 -6
- package/scripts/lane-live.mjs +136 -0
- package/scripts/leftovers-report.mjs +47 -0
- package/scripts/loading-card-proof.mjs +42 -9
- package/scripts/loading-flow/benchmax.mjs +57 -7
- package/scripts/loading-flow/stalls.d.mts +2 -0
- package/scripts/loading-flow/stalls.mjs +13 -0
- package/scripts/mmo-bots.mjs +11 -5
- package/scripts/mmo-grid-proof.mjs +74 -0
- package/scripts/mmo-seat-proof.mjs +43 -0
- package/scripts/net-lag-proof.mjs +1 -1
- package/scripts/nightly-heads.ts +13 -13
- package/scripts/nightly-model.ts +26 -12
- package/scripts/nightly.proof.ts +18 -5
- package/scripts/nightly.ts +13 -8
- package/scripts/no-astc-boot.mjs +77 -0
- package/scripts/online-rig.mjs +7 -7
- package/scripts/parity/boot-smoke.mjs +1 -1
- package/scripts/physics-route.json +6 -6
- package/scripts/pins-reuse.mjs +1 -0
- package/scripts/pins-staging.ts +54 -0
- package/scripts/pins.ts +5 -0
- package/scripts/release-cook.mjs +6 -2
- package/scripts/ring3.proof.ts +71 -0
- package/scripts/ring3.ts +100 -0
- package/scripts/scratch-dir.mjs +31 -12
- package/scripts/scratch-sweep.mjs +15 -23
- package/scripts/server-release/items.d.mts +7 -0
- package/scripts/server-release/items.mjs +28 -0
- package/scripts/server-release/publish.mjs +9 -1
- package/scripts/side-parity.mjs +1 -1
- package/scripts/test-products.json +1 -21
- package/scripts/tsconfig.json +2 -0
- package/scripts/vitest-ci-files.ts +5 -1
- package/scripts/vps/cook-follow.d.mts +6 -0
- package/scripts/vps/cook-follow.mjs +45 -0
- package/scripts/vps/harden-apply.sh +10 -1
- package/scripts/vps/rebuild.sh +104 -36
- package/scripts/vps/wildshard-config +106 -3
- package/scripts/warm-native-chrome.mjs +9 -3
- package/scripts/worker-client-fights.mjs +9 -3
- package/scripts/worktree-reap.mjs +15 -131
- package/scripts/worktree.mjs +92 -12
- package/src/client/app/entry.ts +2 -3
- package/src/client/engine/audio/audioLog.ts +7 -2
- package/src/client/engine/boot/contentRead.ts +24 -4
- package/src/client/engine/boot/diagnostics.ts +69 -1
- package/src/client/engine/boot/downloadGiveUp.ts +34 -0
- package/src/client/engine/combat/EquipmentService.ts +2 -0
- package/src/client/engine/core/Game.ts +6 -2
- package/src/client/engine/core/ktx2.ts +5 -3
- package/src/client/engine/core/ktx2Zstd.ts +2 -1
- package/src/client/engine/pwa/sw.js +26 -8
- package/src/client/engine/render/dataLook.ts +14 -7
- package/src/client/engine/render/lookLight.ts +64 -20
- package/src/client/engine/ui/Loading.ts +6 -8
- package/src/client/engine/ui/downloadFailed.ts +54 -0
- package/src/client/engine/ui/lookLightOption.ts +1 -1
- package/src/client/game/audio/cueDirector.ts +2 -1
- package/src/client/game/boot/spawnDownload.ts +12 -1
- package/src/client/game/boss/arenaRoom.ts +4 -3
- package/src/client/game/boss/roamingProjection.ts +1 -1
- package/src/client/game/devScene/hook.ts +1 -1
- package/src/client/game/devScene/liveLook.ts +1 -1
- package/src/client/game/grid/copyPrompts.ts +3 -4
- package/src/client/game/grid/dataCellKit.ts +99 -0
- package/src/client/game/grid/enteredEquipment.ts +11 -2
- package/src/client/game/grid/live.ts +9 -299
- package/src/client/game/grid/liveSession.ts +31 -8
- package/src/client/game/grid/neighbourLife.ts +50 -32
- package/src/client/game/grid/products.ts +21 -7
- package/src/client/game/grid/reveal.ts +7 -2
- package/src/client/game/grid/session.ts +10 -74
- package/src/client/game/plugin/weaponFamily.ts +6 -0
- package/src/client/game/population/signals.ts +1 -1
- package/src/client/game/quest/chapterDirector.ts +1 -0
- package/src/client/game/shardfile/clientBossTelegraph.ts +4 -3
- package/src/client/game/shardfile/clientWorker.ts +35 -9
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/runtimeProduct.ts +9 -5
- package/src/client/game/shardfile/wirePage.ts +5 -2
- package/src/client/game/shardfile/worldSceneTextures.ts +15 -9
- package/src/client/host/online/shell.ts +37 -13
- package/src/cook/game/cookWorker.ts +8 -5
- package/src/cook/game/tierTextures.ts +5 -3
- package/src/server/engine/net/simWorld.ts +3 -4
- package/src/server/game/grid/cellHome.ts +58 -0
- package/src/server/game/grid/room.ts +2 -38
- package/src/server/game/grid/simulation.ts +5 -4
- package/src/server/game/plugin/mover.ts +18 -14
- package/src/server/game/shardfile/declaredKitItems.ts +39 -9
- package/src/server/host/bake/headlessWorker.ts +3 -3
- package/src/server/host/dedicated/cellHost.ts +2 -2
- package/src/server/host/dedicated/cellProtocol.ts +1 -1
- package/src/server/host/dedicated/cellWorker.ts +5 -3
- package/src/server/host/dedicated/dedicatedRoom.ts +8 -3
- package/src/server/host/dedicated/gridCells.ts +5 -3
- package/src/server/host/dedicated/main.ts +12 -7
- package/src/server/host/dedicated/packReader.ts +15 -2
- package/src/server/host/dedicated/playerStore.ts +1 -1
- package/src/server/host/dedicated/workerTable.ts +0 -10
- package/src/server/host/dedicated/world.ts +39 -5
- package/src/server/host/headlessRuntime.ts +11 -6
- package/src/server/host/standalone/cellWorld.ts +21 -7
- package/src/server/host/standalone/gridServer.ts +3 -1
- package/src/server/host/standalone/roadWorld.ts +6 -0
- package/src/shared/engine/physics/gridBorders.ts +15 -1
- package/src/shared/engine/saves/shape.ts +17 -2
- package/src/shared/engine/sim/snapshot.ts +5 -5
- package/src/shared/engine/strings.ts +10 -0
- package/src/shared/game/grid/placementRows.ts +4 -3
- package/src/shared/game/ledger.ts +13 -4
- package/src/shared/game/loot/platformCatalogue.ts +14 -0
- package/src/shared/game/quest/ledger.ts +3 -3
- package/src/shared/game/shardfile/items.ts +9 -1
- package/src/shared/host/headlessJourney.ts +3 -3
- package/src/shared/host/headlessTape.ts +7 -6
- package/src/shared/host/releaseRows.ts +4 -1
- package/src/client/game/grid/cellLoading.ts +0 -110
- package/src/client/game/grid/cellScreens.ts +0 -48
|
@@ -49,7 +49,6 @@ import type { NeighbourRegion } from './neighbourLife';
|
|
|
49
49
|
import type { ResidencyAllocator } from '../../../shared/game/grid/allocator';
|
|
50
50
|
import type { HomeResidencyClaim } from './pageResidency';
|
|
51
51
|
import { LiveGridHost, type LiveGridAdmission, type LiveGridFrame, type LiveGridRegion, type LiveGridState } from './live';
|
|
52
|
-
import { prepareApproachProductInputs } from './approachProductInputs';
|
|
53
52
|
import { installGridCrossing, type GridCheckpointResult, type GridCrossingSession, type GridCrossingState } from '../../../shared/game/grid/crossing';
|
|
54
53
|
import { GridWallet, stowGridMount } from '../../../shared/game/grid/wallet';
|
|
55
54
|
import type { LedgerCatalogueItem } from '../../../shared/game/ledger';
|
|
@@ -78,6 +77,7 @@ import { copyPrompts, enteredCopy } from './copyPrompts';
|
|
|
78
77
|
import { yieldGridAdmission, yieldGridConstruction } from './admissionYield';
|
|
79
78
|
import { HybridRuntimeSession, type HybridResident } from '../shardfile/hybrid';
|
|
80
79
|
|
|
80
|
+
import { enterDataCellKit, holdsItems } from './dataCellKit';
|
|
81
81
|
import { enterPlotAudio, pagePlotAudioPorts, plotAudioScene, type PlotAudioPorts, type PlotAudioScene } from './plotAudio';
|
|
82
82
|
import { shardProductFromAdmission } from '../shardfile/runtimeProduct';
|
|
83
83
|
import { createRegionalRuntimeFactory, regionalRuntimeAccountedBytes, type PreparedRegionalRuntime, type RegionalRuntimePage, type RegionalRuntimeTextures } from './regionalRuntime';
|
|
@@ -235,9 +235,13 @@ export class LiveGridSession {
|
|
|
235
235
|
private readonly applied = new Vector3();
|
|
236
236
|
private readonly roadWallet: GridWallet;
|
|
237
237
|
/** each admitted region's authored spawn (its level's player start) and its ground / water queries, local */
|
|
238
|
-
private readonly regions = new Map<string, { readonly spawn: LiveGridSpawn; readonly items: Shardfile['items']['rows']; readonly queries: PlayerFrameQueries; readonly colliders: PanelRegion['colliders']; readonly prompts: ReturnType<typeof copyPrompts>; readonly audio: PlotAudioScene | null
|
|
238
|
+
private readonly regions = new Map<string, { readonly spawn: LiveGridSpawn; readonly items: Shardfile['items']['rows']; readonly queries: PlayerFrameQueries; readonly colliders: PanelRegion['colliders']; readonly prompts: ReturnType<typeof copyPrompts>; readonly audio: PlotAudioScene | null;
|
|
239
|
+
/** TC-E1b: the copy's admitted source and assets, its declared kit built from them on entry */
|
|
240
|
+
readonly kit: { readonly source: Shardfile; readonly assets: ReadonlyMap<string, Uint8Array> } | null }>();
|
|
239
241
|
/** AU20: the entered data cell's own audio scene (an Open Plot's score, bed and loops), live while the feet are in it. */
|
|
240
242
|
private plotAudio: { readonly instance: string; readonly scope: Scope } | null = null;
|
|
243
|
+
/** TC-E1b: the entered data cell's held kit, disposed when the feet leave it */
|
|
244
|
+
private dataKit: { readonly instance: string; readonly scope: Scope } | null = null;
|
|
241
245
|
private readonly plotBanks = new Map<string, ReturnType<PlotAudioPorts['bank']>>();
|
|
242
246
|
private readonly runtimeScope: Scope;
|
|
243
247
|
private readonly runtimeRegions = new Map<string, PreparedRegionalRuntime>();
|
|
@@ -273,9 +277,9 @@ export class LiveGridSession {
|
|
|
273
277
|
this.runtimeScope = scope.child('grid.runtime.residents');
|
|
274
278
|
this.hybrid = new HybridRuntimeSession(this.runtimeResidents, scope, { pause: yieldGridConstruction });
|
|
275
279
|
scope.onDispose(gridCells.onLeave(() => { this.hybrid.leave(); this.prepareDeferredEntries(); }));
|
|
276
|
-
scope.onDispose(gridCells.onLeave(() => { this.leavePlotAudio(); }));
|
|
280
|
+
scope.onDispose(gridCells.onLeave(() => { this.leavePlotAudio(); this.leaveDataKit(); }));
|
|
277
281
|
scope.onDispose(gridCells.onEnter(cell => {
|
|
278
|
-
if (!this.runtimeResidents.has(cell.instance)) { this.enterPlotAudio(cell.instance); ports.lightingSettled?.(); return; }
|
|
282
|
+
if (!this.runtimeResidents.has(cell.instance)) { this.enterPlotAudio(cell.instance); this.enterDataKit(cell.instance); ports.lightingSettled?.(); return; }
|
|
279
283
|
this.startedRuntimes.add(cell.instance);
|
|
280
284
|
const activation = this.hybrid.enter(cell);
|
|
281
285
|
this.activation = activation;
|
|
@@ -309,8 +313,6 @@ export class LiveGridSession {
|
|
|
309
313
|
return { physics: ports.physics, walls: ports.walls, dispose: () => { highwayScope.dispose(); } };
|
|
310
314
|
} },
|
|
311
315
|
admit: (cell, required) => this.admit(cell, required),
|
|
312
|
-
buildAhead: true, // GC5 / GC36: the road builds the world ahead of its line
|
|
313
|
-
prepareTransport: (cell, signal) => prepareApproachProductInputs(cell.slug, { allocator: ports.allocator, scope }, signal, assembly.local(traveller.position, cell)),
|
|
314
316
|
...(ports.prepareNeighbourTiles === undefined ? {} : { prepareNeighbour: ports.prepareNeighbourTiles }),
|
|
315
317
|
prioritize: (cell) => prioritizeGridProduct(cell.slug, { allocator: ports.allocator, scope }),
|
|
316
318
|
pause: () => yieldGridAdmission(scope),
|
|
@@ -711,10 +713,12 @@ export class LiveGridSession {
|
|
|
711
713
|
transfer.sync(); this.transferWalls.set(cell.instance, transfer);
|
|
712
714
|
this.regions.set(cell.instance, { spawn: { x: start.at.x, y: undefined, z: start.at.z, yaw: start.yaw },
|
|
713
715
|
// the admitted terrain inside the cell (one source of truth); its strips are road level (the terrain tile ends at the cell edge)
|
|
714
|
-
queries: { heightAt: (x, z) => (Math.max(Math.abs(x), Math.abs(z)) <= CHUNK_HALF ? heightAt(x, z) : 0), waterSurfaceAt: (x, z) => water.restAt(x, z), platforms: [] }, colliders, items: copySource.items.rows, prompts: copyPrompts(copySource),
|
|
716
|
+
queries: { heightAt: (x, z) => (Math.max(Math.abs(x), Math.abs(z)) <= CHUNK_HALF ? heightAt(x, z) : 0), waterSurfaceAt: (x, z) => water.restAt(x, z), platforms: [] }, colliders, items: copySource.items.rows, prompts: copyPrompts(copySource), kit: holdsItems(copySource) ? { source: copySource, assets } : null,
|
|
715
717
|
// AU20: the cell's declared audio scene, bound only while the feet stand in it (no entered hooks run here)
|
|
716
718
|
audio: source.runtime === null && source.audio.scene !== undefined ? plotAudioScene(source, ((plot) => plot.has('client/plan') ? plot.section('client/plan') : undefined)(shardProductFromAdmission(retained.admitted, shell.scope))) : null });
|
|
717
719
|
this.respawnCells.set(cell.instance, { instance: cell.instance, origin: cell.origin, entryways: source.entryways });
|
|
720
|
+
// TC-E1b: feet that entered before this admission finished get the cell's kit now
|
|
721
|
+
if (gridCells.cell?.instance === cell.instance && this.dataKit === null) this.enterDataKit(cell.instance);
|
|
718
722
|
// G321: its own sky inside its cell (its data look's dome and light), laid while it is resident
|
|
719
723
|
{
|
|
720
724
|
const request = { instance: cell.instance, slug: cell.slug, look: copySource.look, assets, page: this.page.runtimePage?.() ?? null, allocator: this.ports.allocator, scope: shell.scope };
|
|
@@ -722,7 +726,7 @@ export class LiveGridSession {
|
|
|
722
726
|
try { await hangCellDataSky(request); } catch (error) { console.warn(`[region sky] ${cell.instance}`, error); }
|
|
723
727
|
})();
|
|
724
728
|
}
|
|
725
|
-
const unlist = (): void => { if (this.plotAudio?.instance === cell.instance) this.leavePlotAudio(); this.plotBanks.delete(cell.instance); this.regions.delete(cell.instance); this.transferWalls.delete(cell.instance); };
|
|
729
|
+
const unlist = (): void => { if (this.plotAudio?.instance === cell.instance) this.leavePlotAudio(); if (this.dataKit?.instance === cell.instance) this.leaveDataKit(); this.plotBanks.delete(cell.instance); this.regions.delete(cell.instance); this.transferWalls.delete(cell.instance); };
|
|
726
730
|
return { host: shell, shell, dispose: () => {
|
|
727
731
|
unlist();
|
|
728
732
|
try { shell.dispose(); } finally { retained.release(); }
|
|
@@ -856,6 +860,25 @@ export class LiveGridSession {
|
|
|
856
860
|
try { enterPlotAudio(scene, owner, ports); }
|
|
857
861
|
catch (error) { this.leavePlotAudio(); ports.fault(error); }
|
|
858
862
|
}
|
|
863
|
+
/** TC-E1b: the feet entered a data cell; its declared items are the page's held kit until they leave. */
|
|
864
|
+
private enterDataKit(instance: string): void {
|
|
865
|
+
this.leaveDataKit();
|
|
866
|
+
const kit = this.regions.get(instance)?.kit ?? null, page = this.page.runtimePage?.() ?? null;
|
|
867
|
+
if (kit === null || page === null) return;
|
|
868
|
+
const entry = this.ports.scope.child(`grid.data-kit.${instance}`);
|
|
869
|
+
this.dataKit = { instance, scope: entry };
|
|
870
|
+
const enter = async (): Promise<void> => {
|
|
871
|
+
try { await enterDataCellKit(kit.source, kit.assets, page, entry, () => this.wire === null || this.wire.site() === instance); } catch (error: unknown) {
|
|
872
|
+
if (this.dataKit?.scope === entry) this.leaveDataKit();
|
|
873
|
+
console.error(`[grid] ${instance}'s declared kit refused`, error);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
void enter();
|
|
877
|
+
}
|
|
878
|
+
private leaveDataKit(): void {
|
|
879
|
+
const entered = this.dataKit; this.dataKit = null;
|
|
880
|
+
entered?.scope.dispose();
|
|
881
|
+
}
|
|
859
882
|
private leavePlotAudio(): void {
|
|
860
883
|
const entered = this.plotAudio; this.plotAudio = null;
|
|
861
884
|
entered?.scope.dispose();
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A cell's client life (SHARD-PLATFORM SF25 render side):
|
|
3
|
-
*
|
|
2
|
+
* A cell's client life (SHARD-PLATFORM SF25 render side): a shardfile cell gets its creatures drawn in its cell root (the
|
|
3
|
+
* SF9c skins, following its regional host's authoritative entities): the ones its `clientScripts` bind, and in a data cell
|
|
4
|
+
* (no runtime, no declared client page: the templates) every spawn with a skin look, bound or not (TEMPLATE-E2E TC-E1a:
|
|
5
|
+
* Brasscap binds only particles, so its bandits were never drawn). A cell that declares `clientScripts` also gets its own
|
|
4
6
|
* isolated client lane (`createShardfileClientScripts`, sp-x5) stepped on the page's fixed tick; `ClientScriptViews`
|
|
5
|
-
* composes its frames on top of the views and draws its particles.
|
|
7
|
+
* composes its frames on top of the views and draws its particles. A lane that fails to build leaves the creatures drawn.
|
|
8
|
+
* Nothing here writes a simulation.
|
|
6
9
|
*
|
|
7
10
|
* Only while the traveller is inside the cell (G663, tile streaming T7: a neighbour is scene-graph level of detail, with
|
|
8
11
|
* no logic or runtime; it replaced G66's "frozen, but alive-looking" neighbours): a frozen cell's lane never steps and its
|
|
@@ -15,6 +18,7 @@ import type { ClientScriptTarget } from '@wildshard/format/clientScripts';
|
|
|
15
18
|
import { loadClientSkins, SkinDriver, type ClientSkin, type SkinDriveState } from '../shardfile/clientSkins';
|
|
16
19
|
import { ClientScriptViews, type ClientScriptViewTarget, type ClientScriptViewState } from "../plugin/ui";
|
|
17
20
|
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
21
|
+
import { hasDeclaredClientPage } from '@wildshard/format/runtimeBinds';
|
|
18
22
|
import type { GridCell } from '../../../shared/game/grid/assembly';
|
|
19
23
|
|
|
20
24
|
/** One creature as a view draws it (E6): a page reads the region's sim entity, a client reads its row. */
|
|
@@ -37,7 +41,8 @@ export interface NeighbourLifeCell { readonly instance: string; readonly creatur
|
|
|
37
41
|
interface CreatureView { readonly id: string; readonly mesh: SkinnedMesh; readonly driver: SkinDriver; readonly spawn: { at: readonly [number, number, number]; yaw: number; scale: number }; readonly bodyY: number; t: number; phase: number }
|
|
38
42
|
interface CellLife {
|
|
39
43
|
readonly cell: GridCell; readonly root: Group; readonly creatures: ReadonlyMap<string, CreatureView>;
|
|
40
|
-
|
|
44
|
+
/** null: the cell binds no script (or its lane failed to build, `failed` says why); its creatures still draw */
|
|
45
|
+
lane: { readonly scripts: ReturnType<typeof createShardfileClientScripts>; readonly views: ClientScriptViews } | null; failed: string | null;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
/** A static view of one skin: the factory's bone layout (positions relative to the parent), bound once. */
|
|
@@ -68,17 +73,19 @@ export class NeighbourLife {
|
|
|
68
73
|
|
|
69
74
|
/** Admit one neighbour's life once its product and materials are ready (the session's shared per-slug load). */
|
|
70
75
|
async admit(cell: GridCell, root: Group, source: Shardfile, assets: ReadonlyMap<string, Uint8Array>, compile: Parameters<typeof loadClientSkins>[2], skinsBySlug: Map<string, Promise<ReadonlyMap<string, ClientSkin>>>): Promise<void> {
|
|
71
|
-
const declared = source.clientScripts;
|
|
72
|
-
|
|
76
|
+
const declared = source.clientScripts, data = source.runtime === null && !hasDeclaredClientPage(source);
|
|
77
|
+
// the creatures this page draws: the script-bound ones, and in a data cell every spawn (its runtime draws a native cell's)
|
|
78
|
+
const drawn = [...new Set([...declared.bindings.flatMap((binding) => binding.target.kind === 'creature' ? [binding.target.id] : []),
|
|
79
|
+
...(data ? source.creatures.spawns.map((row) => row.id) : [])])];
|
|
80
|
+
if ((declared.bindings.length === 0 && drawn.length === 0) || this.cells.has(cell.instance)) return;
|
|
73
81
|
const scope = this.ports.scope;
|
|
74
82
|
let loading = skinsBySlug.get(cell.slug);
|
|
75
83
|
if (loading === undefined) { loading = loadClientSkins(source, assets, compile, scope); skinsBySlug.set(cell.slug, loading); }
|
|
76
84
|
const skins = await loading;
|
|
77
85
|
if (scope.disposed) return;
|
|
78
86
|
const creatures = new Map<string, CreatureView>();
|
|
79
|
-
for (const
|
|
80
|
-
|
|
81
|
-
const id = binding.target.id, spawn = source.creatures.spawns.find((row) => row.id === id);
|
|
87
|
+
for (const id of drawn) {
|
|
88
|
+
const spawn = source.creatures.spawns.find((row) => row.id === id);
|
|
82
89
|
const species = spawn === undefined ? undefined : source.rows.species.find((row) => row.id === spawn.species);
|
|
83
90
|
const look = species === undefined ? undefined : source.rows.looks.find((row) => row.species === species.id);
|
|
84
91
|
const skin = look === undefined ? undefined : skins.get(look.id);
|
|
@@ -89,6 +96,20 @@ export class NeighbourLife {
|
|
|
89
96
|
root.add(mesh); creatures.set(id, view);
|
|
90
97
|
}
|
|
91
98
|
const instance = cell.instance;
|
|
99
|
+
const life: CellLife = { cell, root, creatures, lane: null, failed: null };
|
|
100
|
+
if (declared.bindings.length > 0) {
|
|
101
|
+
try { life.lane = this.lane(instance, source, assets, root, creatures); } catch (error) { life.failed = error instanceof Error ? error.message : String(error); }
|
|
102
|
+
}
|
|
103
|
+
this.cells.set(instance, life);
|
|
104
|
+
scope.onDispose(() => {
|
|
105
|
+
life.lane?.scripts.dispose();
|
|
106
|
+
for (const view of creatures.values()) { view.mesh.removeFromParent(); view.mesh.skeleton.dispose(); const m = view.mesh.material; if (!Array.isArray(m)) m.dispose(); }
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The cell's own client lane and the views its frames compose on (throws when its scripts are refused). */
|
|
111
|
+
private lane(instance: string, source: Shardfile, assets: ReadonlyMap<string, Uint8Array>, root: Group, creatures: ReadonlyMap<string, CreatureView>): NonNullable<CellLife['lane']> {
|
|
112
|
+
const declared = source.clientScripts;
|
|
92
113
|
const observe = (target: ClientScriptTarget): { position: readonly [number, number, number]; frozen: boolean } => {
|
|
93
114
|
const frozen = !this.ports.active(instance);
|
|
94
115
|
if (target.kind === 'particles') return { position: target.at, frozen };
|
|
@@ -97,39 +118,36 @@ export class NeighbourLife {
|
|
|
97
118
|
const p = view.mesh.position; return { position: [p.x, p.y, p.z], frozen };
|
|
98
119
|
};
|
|
99
120
|
const scripts = createShardfileClientScripts(source, assets, { actorId: 'actor.neighbour', observe });
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
scope.onDispose(() => {
|
|
115
|
-
scripts.dispose();
|
|
116
|
-
for (const view of creatures.values()) { view.mesh.removeFromParent(); view.mesh.skeleton.dispose(); const m = view.mesh.material; if (!Array.isArray(m)) m.dispose(); }
|
|
117
|
-
});
|
|
121
|
+
try {
|
|
122
|
+
const targets = scripts.targets.map(({ entity, target }): ClientScriptViewTarget => {
|
|
123
|
+
const view = target.kind === 'creature' ? creatures.get(target.id) : undefined;
|
|
124
|
+
const emitters = declared.bindings.find((b) => b.entity === entity)?.emitters.map((e) => ({ id: e.id, live: e.live, colour: e.colour, size: e.size, velocity: e.velocity, gravity: e.gravity })) ?? [];
|
|
125
|
+
const anchor = (out: Vector3): Vector3 => {
|
|
126
|
+
if (target.kind === 'particles') return out.fromArray(target.at);
|
|
127
|
+
if (view === undefined) return out.set(0, 0, 0);
|
|
128
|
+
return out.copy(view.mesh.position).setY(view.mesh.position.y + view.bodyY * 1.6);
|
|
129
|
+
};
|
|
130
|
+
const object: Object3D | null = view?.mesh ?? null;
|
|
131
|
+
return { entity, object, anchor, emitters };
|
|
132
|
+
});
|
|
133
|
+
return { scripts, views: new ClientScriptViews(scripts.lane, targets, { root, scope: this.ports.scope }) };
|
|
134
|
+
} catch (error) { scripts.dispose(); throw error; }
|
|
118
135
|
}
|
|
119
136
|
|
|
120
137
|
/** The page's fixed step: the entered cell's lane advances on the page tick. */
|
|
121
138
|
fixed(): void {
|
|
122
139
|
const tick = this.tick++;
|
|
123
140
|
for (const life of this.cells.values()) {
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
const { lane } = life;
|
|
142
|
+
if (lane === null || life.failed !== null || !this.ports.active(life.cell.instance)) continue; // G663: no neighbour logic
|
|
143
|
+
try { lane.scripts.step(tick); } catch (error) { life.failed = error instanceof Error ? error.message : String(error); lane.views.restore(); }
|
|
126
144
|
}
|
|
127
145
|
}
|
|
128
146
|
|
|
129
147
|
/** The page's late phase: views back to base, follow the region (if admitted), then compose the scripts on top. */
|
|
130
148
|
late(dt: number): void {
|
|
131
149
|
for (const life of this.cells.values()) {
|
|
132
|
-
life.views.restore();
|
|
150
|
+
life.lane?.views.restore();
|
|
133
151
|
const region = this.ports.simulation(life.cell.instance), live = this.ports.active(life.cell.instance);
|
|
134
152
|
// G663: a frozen cell draws none of its creatures and composes no lane
|
|
135
153
|
if (!live) { for (const view of life.creatures.values()) view.mesh.visible = false; continue; }
|
|
@@ -141,11 +159,11 @@ export class NeighbourLife {
|
|
|
141
159
|
view.phase = (view.phase + dt * Math.hypot(speed, strafe) * 0.6) % 1;
|
|
142
160
|
view.driver.step({ dt, t: view.t, alive: sim?.alive ?? true, flinch: 0, attack: sim?.attackPhase ?? -1, speed, strafe, scale: sim?.scale ?? view.spawn.scale, phase: view.phase, state: sim?.state ?? 'idle' });
|
|
143
161
|
}
|
|
144
|
-
if (life.failed === null) life.views.apply(dt);
|
|
162
|
+
if (life.failed === null) life.lane?.views.apply(dt);
|
|
145
163
|
}
|
|
146
164
|
}
|
|
147
165
|
|
|
148
166
|
state(): readonly NeighbourLifeCell[] {
|
|
149
|
-
return [...this.cells.values()].map((life) => ({ instance: life.cell.instance, creatures: life.creatures.size, frozen: !this.ports.active(life.cell.instance), views: life.views.state(), failed: life.failed }));
|
|
167
|
+
return [...this.cells.values()].map((life) => ({ instance: life.cell.instance, creatures: life.creatures.size, frozen: !this.ports.active(life.cell.instance), views: life.lane?.views.state() ?? { targets: 0, posed: 0, particles: 0, capacity: 0, tick: 0 }, failed: life.failed }));
|
|
150
168
|
}
|
|
151
169
|
}
|
|
@@ -179,24 +179,38 @@ export function gridShardfileFarBytes(slug: string): Promise<number | null> | nu
|
|
|
179
179
|
* GLB), look/look (the haze colour) and world/collision sections, and the far files, each hash-verified, without admitting
|
|
180
180
|
* the whole product first (its admission, ~8-20 s a product at 4x CPU, held every shardfile neighbour's far proxy and so the
|
|
181
181
|
* grid reveal's ringsReady). No residency claim: the far ring's own lease charges the proxy. Null when the slug has no
|
|
182
|
-
* shardfile or no mesh-collision world (its far proxy is the baked folder's)
|
|
182
|
+
* shardfile or no mesh-collision world (its far proxy is the baked folder's), unless `anyWorld` (no baked folder): then
|
|
183
|
+
* null only when the product's tiles carry no far row.
|
|
183
184
|
*/
|
|
184
|
-
export function readGridShardfileFar(slug: string): Promise<GridShardfileFar | null> {
|
|
185
|
+
export function readGridShardfileFar(slug: string, anyWorld = false): Promise<GridShardfileFar | null> {
|
|
185
186
|
const descriptor = findShard(slug)?.shardfile;
|
|
186
187
|
if (descriptor === undefined) return Promise.resolve(null);
|
|
187
188
|
const url = new URL(descriptor, location.href);
|
|
188
|
-
return readGridProductFar(url.href, slug, browserShardfileOptions(new URL('.', url).href, true));
|
|
189
|
+
return readGridProductFar(url.href, slug, browserShardfileOptions(new URL('.', url).href, true), anyWorld);
|
|
189
190
|
}
|
|
190
191
|
/** A shardfile far proxy's rows and a verified reader for its declared far files. */
|
|
191
192
|
export interface GridShardfileFar { readonly rows: ShardfileFarRows; readonly read: (ref: string) => Promise<Uint8Array> }
|
|
192
|
-
/** `readGridShardfileFar` for one product URL (null: no mesh-collision world, so its far proxy is the baked folder's).
|
|
193
|
-
|
|
193
|
+
/** `readGridShardfileFar` for one product URL (null: no mesh-collision world, unless `anyWorld`, so its far proxy is the baked folder's).
|
|
194
|
+
* `anyWorld`: the build baked no far folder for this slug, so any world's own far row is read (TEMPLATE-E2E: Brasscap rev 5
|
|
195
|
+
* has no mesh collision and no repo bake; null then only when its tiles carry no far row). */
|
|
196
|
+
export async function readGridProductFar(url: string, identity: string, options: ProductOptions, anyWorld = false): Promise<GridShardfileFar | null> {
|
|
194
197
|
const at = await readGridProductIndex(url, identity, options);
|
|
195
198
|
const collision = await readGridSection(at, 'world/collision');
|
|
196
|
-
|
|
199
|
+
const mesh = collision !== null && v.parse(farRows.collision, collision).meshCollision !== null;
|
|
200
|
+
if (!mesh && !anyWorld) return null;
|
|
197
201
|
const [tiles, props, look] = await Promise.all([readGridSection(at, 'world/tiles'), readGridSection(at, 'world/props'), readGridSection(at, 'look/look')]);
|
|
198
202
|
const fog = look === null ? null : v.parse(farRows.look, look).look.keys[0]?.fog.colour ?? null;
|
|
199
|
-
const
|
|
203
|
+
const far = tiles === null ? null : v.parse(farRows.tiles, tiles).far;
|
|
204
|
+
const declared = props === null ? null : v.parse(farRows.props, props).props?.far ?? null;
|
|
205
|
+
const isGlb = (ref: string): boolean => {
|
|
206
|
+
const hash = ref.replace(/^commons:/u, ''), commons = ref.startsWith('commons:');
|
|
207
|
+
return at.index.files.some(row => row.hash === hash && (row.commons === true) === commons && row.kind === 'glb');
|
|
208
|
+
};
|
|
209
|
+
// A mesh-collision world keeps its rows as they are. Any other world (a scene upload) has no props row naming its far GLB,
|
|
210
|
+
// so it is the first far file the index lists as a GLB; with none, its far proxy is the baked folder's after all.
|
|
211
|
+
const farRef = declared ?? (mesh || far === null ? null : far.files.find(isGlb) ?? null);
|
|
212
|
+
if (!mesh && (far === null || farRef === null)) return null;
|
|
213
|
+
const rows: ShardfileFarRows = { far, farRef, fog };
|
|
200
214
|
const read = (ref: string): Promise<Uint8Array> => {
|
|
201
215
|
const hash = ref.replace(/^commons:/u, ''), commons = ref.startsWith('commons:');
|
|
202
216
|
const file = at.index.files.find(row => row.hash === hash && (row.commons === true) === commons);
|
|
@@ -70,7 +70,10 @@ export function installGridReveal(host: GridRevealHost): () => boolean {
|
|
|
70
70
|
let pathEnd: number | null = null, ringsAt: number | null = null, homeAt: number | null = null, endedAt: number | null = null;
|
|
71
71
|
let layer: HTMLElement | null = null;
|
|
72
72
|
let viewmodelWas = true;
|
|
73
|
-
|
|
73
|
+
// read when the reveal begins; the end gives them back only if nothing turned them on meanwhile: the title's ENTER turns the
|
|
74
|
+
// weapons on after `entered` starts the reveal, and an end that restored the earlier "off" left them off for good (TEMPLATE-E2E
|
|
75
|
+
// TC-E1b: Brasscap's lever never fired on the grid; bare hands never showed it)
|
|
76
|
+
let wasEnabled = host.weapons.enabled, wasVisible = host.weapons.visible;
|
|
74
77
|
const land = new Vector3(), landQ = new Quaternion(), sky = new Vector3(), skyQ = new Quaternion(), look = new Vector3(), fwd = new Vector3(), m = new Matrix4();
|
|
75
78
|
const now = (): number => app.clock.mode === 'capture' ? app.clock.real * 1000 : diagnosticNow();
|
|
76
79
|
const publish = (): void => {
|
|
@@ -82,7 +85,8 @@ export function installGridReveal(host: GridRevealHost): () => boolean {
|
|
|
82
85
|
host.hudRoot.classList.remove('ws-grid-revealing', 'ws-grid-live');
|
|
83
86
|
if (layer !== null) hudSlots.discard(layer);
|
|
84
87
|
layer = null;
|
|
85
|
-
host.weapons.
|
|
88
|
+
if (!host.weapons.enabled) host.weapons.setEnabled(wasEnabled);
|
|
89
|
+
if (!host.weapons.visible) host.weapons.visible = wasVisible;
|
|
86
90
|
host.viewmodel.visible = viewmodelWas;
|
|
87
91
|
publish();
|
|
88
92
|
scope.dispose();
|
|
@@ -90,6 +94,7 @@ export function installGridReveal(host: GridRevealHost): () => boolean {
|
|
|
90
94
|
const begin = (at: number): void => {
|
|
91
95
|
started = at;
|
|
92
96
|
host.canvas.style.visibility = ''; // this frame draws the sky pose (the late phase runs before the render)
|
|
97
|
+
wasEnabled = host.weapons.enabled; wasVisible = host.weapons.visible;
|
|
93
98
|
host.weapons.setEnabled(false); host.weapons.visible = false;
|
|
94
99
|
viewmodelWas = host.viewmodel.visible;
|
|
95
100
|
host.hudRoot.classList.add('ws-grid-revealing');
|
|
@@ -107,10 +107,8 @@ import { leaseMapImage } from '../shardfile/mapImage';
|
|
|
107
107
|
import { crossingSaveStatus, installBorderShimmer, type BorderShimmerState, type CrossingSaveStatus } from './borderShimmer';
|
|
108
108
|
import { refusalReporter, saveFailedReporter } from './screenReports';
|
|
109
109
|
import { GAME_STRINGS } from '../../../shared/game/strings';
|
|
110
|
-
import {
|
|
110
|
+
import { classifyRefusal, pageShardRefusals, type ShardRefusal } from './refusal';
|
|
111
111
|
import { tileRing } from '../shardfile/tileDriver';
|
|
112
|
-
import { CellLoading, type CellLoadingInput } from './cellLoading';
|
|
113
|
-
import { CellLoadingCard } from './cellScreens';
|
|
114
112
|
import { readGridSeamData, type GridSeamAddress } from '../../../shared/game/grid/seamData';
|
|
115
113
|
import { readCompiledGridStrips } from '../../../shared/game/grid/compiledStrips';
|
|
116
114
|
import { startRoadGrain } from './roadGrainPreparation';
|
|
@@ -159,7 +157,7 @@ export interface GridSessionHost {
|
|
|
159
157
|
readonly physics: Physics;
|
|
160
158
|
readonly scope: Scope;
|
|
161
159
|
readonly feet: () => { readonly x: number; readonly y: number; readonly z: number };
|
|
162
|
-
/**
|
|
160
|
+
/** Only home coverage can load before controls; every neighbour read waits for this boundary. */
|
|
163
161
|
readonly backgroundReady?: () => boolean;
|
|
164
162
|
/** Presentation-only short range while an actual crossing waits at its
|
|
165
163
|
* in-world screen. Disabled in the same frame the crossing settles. */
|
|
@@ -250,7 +248,8 @@ function neighbourTiles(scope: Scope, prepare: (tile: PreparedRingTile) => Promi
|
|
|
250
248
|
async function loadFar(slug: string): Promise<{ prepared: FarPrepared; bytes: number }> {
|
|
251
249
|
// Pure authored projects have no repo bake: their proxy comes from their product's sections and far files (O26: read
|
|
252
250
|
// hash-verified on their own, not after admitting the whole product), instead of a nonexistent far.json
|
|
253
|
-
|
|
251
|
+
// a slug the build baked no far for (an upload with no mesh collision) reads its product's far row whatever its world
|
|
252
|
+
const shardfile = await readGridShardfileFar(slug, publicBytes()[`/assets/baked/${slug}/far.json`] === undefined);
|
|
254
253
|
if (shardfile !== null) return loadShardfileFar(shardfile.rows, shardfile.read);
|
|
255
254
|
const response = await fetch(versionedUrl(`/assets/baked/${slug}/far.json`));
|
|
256
255
|
if (!response.ok) throw new Error(`far.json ${slug}: ${String(response.status)}`);
|
|
@@ -392,11 +391,6 @@ export class GridSession {
|
|
|
392
391
|
private readonly farMissing = new Set<string>();
|
|
393
392
|
/** each slug's shown name */
|
|
394
393
|
private readonly names = new Map<string, string>();
|
|
395
|
-
/** G555: the one step-by-step loading screen over a cell entry or re-entry that waits */
|
|
396
|
-
private readonly cellLoading: CellLoading;
|
|
397
|
-
private cellLoadingPolled = 0;
|
|
398
|
-
/** when each cell's current wait began, so its screen counts only the hooks of this load */
|
|
399
|
-
private readonly loadingSince = new Map<string, number>();
|
|
400
394
|
|
|
401
395
|
/** Overlap only this page's actual initial-home metadata with remaining page setup. */
|
|
402
396
|
startInitialHomeMetadata(): void {
|
|
@@ -603,8 +597,9 @@ export class GridSession {
|
|
|
603
597
|
const home = this.home;
|
|
604
598
|
// the root world is neutral highway physics and the home an owned region like every cell, so every cell is a neighbour
|
|
605
599
|
this.neighbours = [...this.assembly.cells];
|
|
606
|
-
|
|
607
|
-
|
|
600
|
+
// NB12: the eight adjacent cells used to compete with home for downloads
|
|
601
|
+
// and GLTF decodes. The home's own coverage is the only boot exception.
|
|
602
|
+
const initialRing = new Set([home.instance]);
|
|
608
603
|
const backgroundReady = (): boolean => host.backgroundReady?.() !== false;
|
|
609
604
|
// ringsReady: the far ring charges each proxy its declared bytes before it loads, not the 1.6 MB cap, so placeholder
|
|
610
605
|
// charges never leave a visible cell out of the ring (12 visible proxies of 0.4-1.6 MB fit its 14.4 MB)
|
|
@@ -690,10 +685,8 @@ export class GridSession {
|
|
|
690
685
|
// GC12: drawn only while the traveller stands at that edge (the feet in the home frame)
|
|
691
686
|
ports: { closed: (id) => this.live === null || !this.live.live.ready(id),
|
|
692
687
|
feet: () => { const at = this.world(); return { x: at.x - home.origin.x, z: at.z - home.origin.z }; } } });
|
|
693
|
-
// QA 2026-11-13: a waiting cell's loading steps on SHARD SELECT's loading card, inset over the live world
|
|
694
|
-
this.cellLoading = new CellLoading(new CellLoadingCard(), (waiting) => this.neighbours.some(row => row.instance === waiting));
|
|
695
688
|
setParkedMatricesFrozen(true); // G580 T2: a hidden parked world skips matrix updates during its warm-up
|
|
696
|
-
host.scope.onDispose(() => {
|
|
689
|
+
host.scope.onDispose(() => { if (host.heldFrame !== undefined) host.heldFrame.enabled = false; setWarmUpHeld(false); setParkedMatricesFrozen(false); setBuildHeldTimed(false); setBuildUrgent(false); });
|
|
697
690
|
// G78: a shimmer line at every shard border on its real ground; G119: SAVING… / SAVE FAILED, RETRY while a crossing waits
|
|
698
691
|
const rows = new Map((edges ?? []).map((cell) => [cell.instance, cell.edges]));
|
|
699
692
|
let status: CrossingSaveStatus = null, polled = 0;
|
|
@@ -972,62 +965,6 @@ export class GridSession {
|
|
|
972
965
|
this.reportRefusal(cell.instance, cell.slug, refusal, error);
|
|
973
966
|
this.refusals.set(cell.instance, refusal); this.issues.set(cell.instance, error instanceof Error ? error.message : String(error)); pageShardRefusals().note(cell.slug, refusal);
|
|
974
967
|
}
|
|
975
|
-
/**
|
|
976
|
-
* G555's read-only port: the cell whose entry waits (the one the traveller is in before its gameplay is ready, else the
|
|
977
|
-
* nearest unready cell within 12 m of its edge), with its readiness fences, its claims, its entered hooks since this wait
|
|
978
|
-
* began and its refusal; null when none waits.
|
|
979
|
-
*/
|
|
980
|
-
private cellLoadingInput(): CellLoadingInput | null {
|
|
981
|
-
const live = this.live; if (live === null) return null;
|
|
982
|
-
// GC6: a world built ahead whose entry still prepares holds its crossing on the road: the screen shows it
|
|
983
|
-
const current = live.live.current(), ready = (id: string): boolean => live.live.ready(id) && !live.entryPending(id) && (current !== id || live.gameplayReady());
|
|
984
|
-
let target: GridCell | undefined = current !== null && !ready(current) ? this.assembly.cell(current) : undefined;
|
|
985
|
-
if (target === undefined) {
|
|
986
|
-
const at = this.world();
|
|
987
|
-
let best = 12;
|
|
988
|
-
for (const cell of this.assembly.cells) {
|
|
989
|
-
if (ready(cell.instance)) continue;
|
|
990
|
-
const d = Math.hypot(Math.max(0, Math.abs(at.x - cell.origin.x) - CHUNK_HALF), Math.max(0, Math.abs(at.z - cell.origin.z) - CHUNK_HALF));
|
|
991
|
-
if (d <= best) { best = d; target = cell; }
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
if (target === undefined) { this.loadingSince.clear(); return null; }
|
|
995
|
-
const id = target.instance, since = this.loadingSince.get(id) ?? diagnosticNow(); this.loadingSince.set(id, since);
|
|
996
|
-
const raw = live.refusal(id), refusal = this.refusal(id);
|
|
997
|
-
const reason = refusal !== null ? refusalReason(refusal)
|
|
998
|
-
: raw instanceof GridCellWaitingError ? GAME_STRINGS.grid.waiting(this.shardName(id)) : null;
|
|
999
|
-
let claimed = 0, product = false;
|
|
1000
|
-
for (const entry of this.allocator.claims()) {
|
|
1001
|
-
if (entry.owner === id) claimed += entry.bytes;
|
|
1002
|
-
if (entry.owner === 'grid' && entry.id === `product:grid:${target.slug}`) { claimed += entry.bytes; product = true; }
|
|
1003
|
-
}
|
|
1004
|
-
// its entered hooks of this run: from its latest beforeWorld (a road-prepared world ran some before the screen opened)
|
|
1005
|
-
const stages = live.live.readiness.status(id), timings = live.hookTimings(), own = timings.completed.filter(row => row.instance === id);
|
|
1006
|
-
let run = -1; own.forEach((row, index) => { if (row.hook === 'beforeWorld') run = index; });
|
|
1007
|
-
const hooks = new Set((run === -1 ? own.filter(row => row.start >= since) : own.slice(run)).map(row => row.hook));
|
|
1008
|
-
const hook = timings.current?.instance === id ? timings.current.hook : null;
|
|
1009
|
-
return { instance: id, slug: target.slug, name: this.shardName(id), refusal: reason, product: product || stages.runtime || stages.ready,
|
|
1010
|
-
claimedMB: claimed / 1e6, requested: stages.requested, runtime: stages.runtime, colliders: stages.colliders, sim: stages.sim,
|
|
1011
|
-
hooks, hook, hybrid: hooks.size > 0 || hook !== null, entered: current === id, gameplayReady: current === id && live.gameplayReady(),
|
|
1012
|
-
warm: live.warmPreparation(id) };
|
|
1013
|
-
}
|
|
1014
|
-
/** At most four times a second: the loading screen reads the allocator and the live session. */
|
|
1015
|
-
private stepCellLoading(): void {
|
|
1016
|
-
const now = diagnosticNow(); if (now - this.cellLoadingPolled < 250) return;
|
|
1017
|
-
this.cellLoadingPolled = now; this.cellLoading.step(this.cellLoadingInput());
|
|
1018
|
-
// G580 T2 (Developer): the traveller waits at the wall while its screen shows, so its warm-up may issue more a frame
|
|
1019
|
-
// G580 T2 / T5: a held traveller's warm-up issues more programs a frame and its builds run a bigger budget
|
|
1020
|
-
setWarmUpHeld(this.cellLoading.open !== null);
|
|
1021
|
-
setBuildHeldTimed(this.cellLoading.open !== null);
|
|
1022
|
-
// GC6: a world the traveller heads into, or the road (where its entry prepares), builds with the urgent budget
|
|
1023
|
-
const live = this.live;
|
|
1024
|
-
setBuildUrgent(live !== null && (live.live.building() || live.entriesPending()));
|
|
1025
|
-
}
|
|
1026
|
-
private refusal(instance: string): ShardRefusal | null {
|
|
1027
|
-
const live = this.live?.refusal(instance);
|
|
1028
|
-
return this.refusals.get(instance) ?? (live === undefined ? null : classifyRefusal(live));
|
|
1029
|
-
}
|
|
1030
|
-
private shardName(instance: string): string { const slug = this.assembly.cell(instance).slug; return this.names.get(slug) ?? slug; }
|
|
1031
968
|
|
|
1032
969
|
/** Complete deferred native seams before a distant entry or road recovery. One page promise, no second scheduler. */
|
|
1033
970
|
prepareOuterStrips(): Promise<void> {
|
|
@@ -1188,8 +1125,7 @@ export class GridSession {
|
|
|
1188
1125
|
if (!this.initialFarReady && this.host.backgroundReady?.() !== false && this.rings.ready()) this.initialFarReady = true;
|
|
1189
1126
|
this.roadTiles?.step({ x: at.x, z: at.z, vx: this.velocity.x * clamp, vz: this.velocity.z * clamp });
|
|
1190
1127
|
for (const cell of this.neighbours) if (this.placeholderBlocksTiles(cell.instance)) this.rings.retireRefinement(cell.instance);
|
|
1191
|
-
this.
|
|
1192
|
-
if (this.host.heldFrame !== undefined) this.host.heldFrame.enabled = this.cellLoading.open !== null && this.live?.travelState().crossing.phase === 'preparing';
|
|
1128
|
+
if (this.host.heldFrame !== undefined) this.host.heldFrame.enabled = false;
|
|
1193
1129
|
this.shimmer.step();
|
|
1194
1130
|
const active = this.live === null ? this.home.instance : this.live.live.current();
|
|
1195
1131
|
const eye = this.host.eye?.();
|
|
@@ -1258,7 +1194,7 @@ export class GridSession {
|
|
|
1258
1194
|
pitch: this.assembly.pitch,
|
|
1259
1195
|
home: this.home.instance, inside: gridCells.cell?.instance ?? null, feet: { x: Math.round(at.x * 100) / 100, z: Math.round(at.z * 100) / 100 },
|
|
1260
1196
|
cells: this.assembly.cells.map((cell) => { const d = drawn(cell.instance); return { instance: cell.instance, slug: cell.slug, cell: cell.cell, shows: shows(cell.instance, d), drawn: d }; }),
|
|
1261
|
-
strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading:
|
|
1197
|
+
strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading: null, cellStage: null, cellStep: null, hybrid: this.live?.hybridState() ?? null, ringsReady: this.rings.ready(), ringsWait: { cells: this.rings.waiting(), far: this.rings.farPlan(), preparation: this.farPreparation(), waits: { count: pending.length, oldest: pending.map(({ label, kind, ageMs }) => ({ label, kind, ageMs })).sort((a, b) => b.ageMs - a.ageMs).slice(0, 16) } },
|
|
1262
1198
|
residentMB: Math.round(cost.accounted / 1e4) / 100, playingMB: Math.round(cost.playing / 1e4) / 100, envelopeMB: Math.round(this.allocator.envelope() / 1e4) / 100,
|
|
1263
1199
|
accountedBytes: cost.accounted,
|
|
1264
1200
|
rings: { frame: stats.frame, far: stats.resident.far, l1: stats.resident.l1, l0: stats.resident.l0, refused: stats.refused, inFlight: stats.inFlight, queued: stats.queued,
|
|
@@ -403,6 +403,12 @@ export function registerWeaponFamily(registry: Map<string, ItemFamily>, id: stri
|
|
|
403
403
|
registry.set(id, family);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
/** The icons a declared item row may name (`ui.icon`), as the page's catalogue draws them. */
|
|
407
|
+
export const DECLARED_ITEM_ICONS = ['lock', 'check', 'poi', 'you', 'map', 'pack', 'star', 'book', 'heart', 'pin', 'laurel', 'sword', 'glyph', 'coin', 'purse', 'crossbow', 'rifle', 'lever', 'longbow', 'grapple', 'horse'] as const;
|
|
408
|
+
/** A declared item row's icon, refused when the catalogue draws no such icon. */
|
|
409
|
+
export function declaredItemIcon(name: string): (typeof DECLARED_ITEM_ICONS)[number] {
|
|
410
|
+
const id = DECLARED_ITEM_ICONS.find((entry) => entry === name); if (id === undefined) throw new Error(`Unknown catalogue item icon ${name}`); return id;
|
|
411
|
+
}
|
|
406
412
|
/** Explicit built-in item family registry, injected into the full loader; importing does not install content. */
|
|
407
413
|
export function declaredKitItemFamilies(): ReadonlyMap<string, ItemFamily> {
|
|
408
414
|
return new Map<string, ItemFamily>([
|
|
@@ -14,7 +14,7 @@ export function installPopulationSignals(ctx: ShardContext, scope: Scope, effect
|
|
|
14
14
|
if(typeof x!=='number'||typeof zOrY!=='number')return;
|
|
15
15
|
if(view.name.startsWith('creature.signal:')) {
|
|
16
16
|
const name=view.name.slice('creature.signal:'.length);
|
|
17
|
-
ctx.app.events.emit('creature.signal',{name,x,z:zOrY});notice(notices?.signal(name,view.tick/60)??null);
|
|
17
|
+
ctx.app.events.emit('creature.signal',{name,x,z:zOrY});wirePage.drew(view.name);notice(notices?.signal(name,view.tick/60)??null);
|
|
18
18
|
} else if(view.name.startsWith('creature.sound:')&&typeof third==='number') {
|
|
19
19
|
ctx.app.events.emit('creature.sound',{cue:view.name.slice('creature.sound:'.length),x,y:zOrY,z:third});
|
|
20
20
|
} else if(view.name==='creature.knockdown'&&typeof third==='number') {
|
|
@@ -156,6 +156,7 @@ function wiredQuestSpawns(ctx: ShardContext, rows: QuestSpawnPageRows, flags: Fl
|
|
|
156
156
|
const [id, x = 0, y = 0, z = 0] = args, cue = rows.cues.find(row => row.id === id);
|
|
157
157
|
if (cue?.kind === 'sound') bank.shot(cue.name, { at: { x, y, z } });
|
|
158
158
|
else if (cue?.kind === 'puff' && puffs.length < 64) puffs.push({ x, y, z });
|
|
159
|
+
if (cue !== undefined) wirePage.drew(name);
|
|
159
160
|
}));
|
|
160
161
|
ctx.scope.onDispose(flags.onChange((flag, on) => {
|
|
161
162
|
const effects = complete.get(flag);
|
|
@@ -23,14 +23,15 @@ export function installClientBossTelegraph(ctx: ShardContext, input: unknown): v
|
|
|
23
23
|
new MeshBasicMaterial({ color: view.color, transparent: true, opacity: 0, depthWrite: false, side: DoubleSide, fog: false }));
|
|
24
24
|
wall.name = view.system; wall.visible = false; ctx.root.add(wall); ctx.scope.own(wall.geometry); ctx.scope.own(wall.material); ctx.scope.onDispose(() => { wall.removeFromParent(); });
|
|
25
25
|
/** A page on a server holds no body to read a strike off: the server says it, until it stops saying so. */
|
|
26
|
-
const heard = { through: 0, aim: 0, x: 0, z: 0, fresh:
|
|
26
|
+
const heard = { through: 0, aim: 0, x: 0, z: 0, fresh: 0, at: Number.NEGATIVE_INFINITY }, name = `${BOSS_STRIKE}${strike.id}`;
|
|
27
27
|
wirePage.whenLive(ctx.scope, client => client.onView(call => {
|
|
28
28
|
if (call.name !== name) return;
|
|
29
29
|
const [through = 0, aim = 0, x = 0, z = 0] = call.args;
|
|
30
|
-
Object.assign(heard, { through, aim, x, z, fresh:
|
|
30
|
+
Object.assign(heard, { through, aim, x, z, fresh: heard.fresh + 1 });
|
|
31
31
|
}));
|
|
32
32
|
ctx.system({ id: view.system, phase: 'update', run: (_dt, t) => {
|
|
33
|
-
|
|
33
|
+
// the clock's the frame's: a slow frame still shows what it heard, and counts every word it draws (EG-15's census)
|
|
34
|
+
if (heard.fresh > 0) { wirePage.drew(name, heard.fresh); heard.fresh = 0; heard.at = t; }
|
|
34
35
|
const live = t - heard.at < HEARD_FOR;
|
|
35
36
|
wall.visible = live;
|
|
36
37
|
if (!live) return;
|