@wildshard/engine 0.1.17 → 0.1.19
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/budgets/shard-size-baseline.json +10 -4
- package/index.html +6 -4
- package/lint/engine-sides.json +21 -0
- package/lint/host-callback-syntax.mjs +2 -1
- package/lint/host-callbacks.mjs +3 -3
- package/lint/host-files.mjs +5 -4
- package/lint/no-base64.mjs +3 -1
- package/lint/ratchet.json +0 -68
- package/lint/ratchet.mjs +1 -4
- package/lint/shard-imports.mjs +6 -7
- package/lint/shard-source.d.mts +9 -0
- package/lint/shard-source.mjs +91 -0
- package/lint/shardfile-boundaries.mjs +10 -8
- package/lint/sim-closure.mjs +6 -3
- package/lint/wildshard-plugin.d.ts +4 -0
- package/lint/wildshard-plugin.js +22 -23
- package/package.json +25 -16
- package/scripts/agent-sync.mjs +27 -8
- package/scripts/app-build/appCook.ts +8 -2
- package/scripts/app-build/catalogue.ts +10 -7
- package/scripts/app-build/gen.ts +22 -2
- package/scripts/app-build/isolation.d.mts +10 -0
- package/scripts/app-build/isolation.mjs +47 -0
- package/scripts/app-build/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +35 -0
- package/scripts/app-build/previousDeploy.d.mts +2 -0
- package/scripts/app-build/previousDeploy.mjs +10 -1
- package/scripts/app-build/serviceWorker.ts +10 -3
- package/scripts/app-build/splitOutput.mjs +4 -2
- package/scripts/app-build/standaloneOutput.d.mts +1 -1
- package/scripts/app-build/standaloneOutput.mjs +5 -3
- package/scripts/app-build/titlePreloads.d.mts +8 -0
- package/scripts/app-build/titlePreloads.mjs +69 -0
- package/scripts/app-build/worldMapAtlas.ts +10 -6
- package/scripts/app-build-pipeline.mjs +34 -3
- package/scripts/built-product.mjs +1 -1
- package/scripts/cell-mem-bench.mjs +81 -23
- package/scripts/check-custom-sections-zero.mjs +1 -1
- package/scripts/check-devserver.mjs +3 -1
- package/scripts/check-models.mjs +2 -0
- package/scripts/check-paths.allow.json +0 -115
- package/scripts/check-paths.mjs +2 -2
- package/scripts/check-platform-ratchets.mjs +2 -3
- package/scripts/chromium-keychain-check.mjs +4 -2
- package/scripts/chromium-keychain.d.mts +1 -1
- package/scripts/chromium-keychain.mjs +3 -1
- package/scripts/ci-static.sh +1 -1
- package/scripts/committed-fast-checks.mjs +0 -2
- package/scripts/content-sw-proof.mjs +2 -1
- package/scripts/cook-worker.mjs +9 -3
- package/scripts/cook.mjs +20 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +4 -2
- package/scripts/devserver-client.mjs +25 -8
- package/scripts/docs-inputs-proof.mjs +6 -6
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -0
- package/scripts/e7-voice-staging-proof.mjs +1 -1
- package/scripts/gate-related-tests.mjs +1 -1
- package/scripts/git-source-view.mjs +1 -1
- package/scripts/goldens/capture.mjs +17 -5
- package/scripts/grid-crossing-nightly.mjs +59 -0
- package/scripts/grid-crossing-qa.mjs +44 -0
- package/scripts/grid-crossing-ratchet.d.mts +6 -0
- package/scripts/grid-crossing-ratchet.mjs +52 -0
- package/scripts/grid-crossing-report.mjs +122 -0
- package/scripts/grid-crossing-stages.mjs +47 -0
- package/scripts/grid-crossing-tour.mjs +277 -0
- package/scripts/grid-crossing-walk-proof.mjs +136 -18
- package/scripts/host-ruler/roots.mjs +2 -2
- package/scripts/host-ruler.d.mts +91 -0
- package/scripts/host-ruler.mjs +565 -0
- package/scripts/live-prepush.py +3 -5
- package/scripts/loading-flow/benchmax.mjs +3 -1
- package/scripts/look-loop/test_look_loop.py +1 -38
- package/scripts/memory-proof.mjs +213 -0
- package/scripts/mmo-bots.mjs +8 -2
- package/scripts/net-lag-proof.mjs +219 -0
- package/scripts/night-market-kit-budget.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +5 -3
- package/scripts/offline-proof-rules.mjs +34 -7
- package/scripts/offline-proof.mjs +88 -18
- package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
- package/scripts/page-release/content.d.mts +9 -1
- package/scripts/page-release/content.mjs +131 -17
- package/scripts/page-release/flow.mjs +36 -10
- package/scripts/page-release/stamp-content.mjs +24 -0
- package/scripts/page-release.mjs +28 -6
- package/scripts/page-size.mjs +2 -1
- package/scripts/pin-packs.ts +1 -1
- package/scripts/pins.ts +4 -4
- package/scripts/precommit-checks.mjs +1 -7
- package/scripts/precommit-jobs.mjs +0 -1
- package/scripts/precommit-source.py +1 -9
- package/scripts/program-discovery.mjs +1 -1
- package/scripts/ring-cook.mjs +2 -1
- package/scripts/ring-step.ts +1 -1
- package/scripts/script-scenario-metrics.mjs +1 -1
- package/scripts/shard-output-content.d.mts +1 -1
- package/scripts/shard-output-content.mjs +2 -2
- package/scripts/shard-outputs.mjs +1 -1
- package/scripts/shard-public.mjs +1 -1
- package/scripts/shard-wire-meter.mjs +24 -9
- package/scripts/side-parity.mjs +4 -2
- package/scripts/standalone-smoke.mjs +8 -3
- package/scripts/tier-textures-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +78 -0
- package/scripts/tile-bake-report.mjs +1 -1
- package/scripts/tile-bakes.mjs +1 -1
- package/scripts/title-assets.generated.json +2 -0
- package/scripts/tsconfig.json +1 -2
- package/scripts/vendor/basisu/LICENSE +201 -0
- package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
- package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
- package/scripts/vitest-push-guards.config.ts +1 -1
- package/scripts/vps/harden-apply.sh +4 -1
- package/scripts/vps/harden-prometheus.sh +176 -0
- package/scripts/vps/harden.sh +16 -0
- package/scripts/vps/rebuild.sh +18 -0
- package/scripts/vps/wildshard-config +84 -24
- package/scripts/worker-client-play.mjs +7 -2
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -0
- package/scripts/worktree-reap.mjs +5 -5
- package/src/.oxlintrc.json +3 -182
- package/src/client/app/entry.ts +47 -12
- package/src/client/engine/boot/bootCache.ts +2 -2
- package/src/client/engine/boot/bootTrace.ts +12 -4
- package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
- package/src/client/engine/boot/clearDownloads.ts +5 -2
- package/src/client/engine/boot/contentRead.ts +11 -0
- package/src/client/engine/boot/gpuFiles.ts +4 -2
- package/src/client/engine/boot/lastEnd.ts +99 -12
- package/src/client/engine/boot/parsedPages.ts +127 -58
- package/src/client/engine/boot/texturePack.ts +2 -2
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +18 -0
- package/src/client/engine/core/bootstrap.ts +4 -1
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/fx/LightPool.ts +41 -1
- package/src/client/engine/net/netPlayer.ts +19 -2
- package/src/client/engine/net/otherPlayers.ts +55 -8
- package/src/client/engine/net/predictor.ts +33 -9
- package/src/client/engine/net/redial.ts +29 -6
- package/src/client/engine/pwa/cacheNames.ts +58 -1
- package/src/client/engine/pwa/sw.js +53 -14
- package/src/client/engine/render/dataLook.ts +152 -40
- package/src/client/engine/render/families/detail.ts +89 -0
- package/src/client/engine/render/families/pbr.ts +7 -1
- package/src/client/engine/render/look.ts +6 -0
- package/src/client/engine/render/lookLight.ts +103 -11
- package/src/client/engine/render/lookRender.ts +105 -0
- package/src/client/engine/render/precompile.ts +20 -14
- package/src/client/engine/saves/indexed.ts +2 -2
- package/src/client/engine/telemetry/browserErrors.ts +28 -4
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
- package/src/client/engine/ui/debugOptions.ts +1 -1
- package/src/client/engine/ui/lookLightOption.ts +10 -6
- package/src/client/engine/ui/namePrompt.ts +7 -0
- package/src/client/game/boot/audio.generated.ts +114 -216
- package/src/client/game/boot/bytes.generated.ts +118 -238
- package/src/client/game/boot/placedSpawn.ts +35 -0
- package/src/client/game/boot/spawnDownload.ts +25 -6
- package/src/client/game/boot/versions.generated.ts +7 -7
- package/src/client/game/devScene/hook.ts +291 -0
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +12 -2
- package/src/client/game/grid/live.ts +134 -12
- package/src/client/game/grid/liveSession.ts +47 -5
- package/src/client/game/grid/mapAtlas.ts +18 -4
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/minimapBlend.ts +15 -5
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- package/src/client/game/grid/oneWayIn.ts +5 -1
- package/src/client/game/grid/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +233 -0
- package/src/client/game/grid/placedContent.ts +85 -0
- package/src/client/game/grid/prefetch.ts +9 -1
- package/src/client/game/grid/productInputs.ts +3 -1
- package/src/client/game/grid/productLeases.ts +4 -1
- package/src/client/game/grid/products.ts +8 -4
- package/src/client/game/grid/regionalRuntime.ts +6 -0
- package/src/client/game/grid/regionalWorld.ts +15 -2
- package/src/client/game/grid/roadCull.ts +44 -14
- package/src/client/game/grid/roadLook.ts +24 -15
- package/src/client/game/grid/roadLookPlatform.ts +4 -2
- package/src/client/game/grid/roadResources.ts +24 -0
- package/src/client/game/grid/roadSign.worker.ts +4 -3
- package/src/client/game/grid/roadSignPaint.ts +16 -5
- package/src/client/game/grid/roadSignPreparation.ts +4 -3
- package/src/client/game/grid/roadSignScale.ts +8 -0
- package/src/client/game/grid/roadTileBacking.ts +13 -3
- package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
- package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
- package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
- package/src/client/game/grid/roadTileWriter.ts +2 -1
- package/src/client/game/grid/screenReports.ts +39 -0
- package/src/client/game/grid/session.ts +29 -4
- package/src/client/game/grid/shardfileFar.ts +9 -3
- package/src/client/game/grid/softWallLook.ts +25 -8
- package/src/client/game/mainMenu.ts +6 -2
- package/src/client/game/plugin/context.ts +2 -1
- package/src/client/game/plugin/followedMovers.ts +7 -1
- package/src/client/game/quest/figures.ts +2 -0
- package/src/client/game/session/finish.ts +11 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/assetCache.ts +4 -4
- package/src/client/game/shardfile/client.ts +4 -1
- package/src/client/game/shardfile/clientAssets.ts +9 -5
- package/src/client/game/shardfile/clientLibrary.ts +1 -1
- package/src/client/game/shardfile/clientWater.ts +51 -9
- package/src/client/game/shardfile/clientWorker.ts +21 -8
- package/src/client/game/shardfile/look.ts +8 -3
- package/src/client/game/shardfile/product.ts +34 -7
- package/src/client/game/shardfile/productChecks.ts +2 -2
- package/src/client/game/shardfile/productCost.ts +2 -2
- package/src/client/game/shardfile/readAsset.ts +2 -2
- package/src/client/game/shardfile/reflectingWater.ts +73 -0
- package/src/client/game/shardfile/seatGrace.ts +9 -0
- package/src/client/game/shardfile/skinPlayback.ts +1 -1
- package/src/client/game/systems/npc/figureRows.ts +9 -0
- package/src/client/game/titleDeck.ts +4 -3
- package/src/client/host/online/doctor.ts +2 -0
- package/src/client/host/online/linkScreens.ts +30 -4
- package/src/client/host/online/shell.ts +14 -0
- package/src/client/host/standalone/shell.ts +4 -0
- package/src/cook/game/astc6Encode.ts +55 -0
- package/src/cook/game/astc6Wasm.ts +176 -0
- package/src/cook/game/cookJob.ts +30 -6
- package/src/cook/game/cookWorker.ts +38 -11
- package/src/cook/game/entryTotals.ts +51 -24
- package/src/cook/game/shardCook.ts +67 -9
- package/src/cook/game/spawnParts.ts +33 -8
- package/src/cook/game/tierTextures.ts +349 -0
- package/src/e2e/smoke/game.ts +19 -14
- package/src/e2e/smoke/page-globals.d.ts +9 -8
- package/src/e2e/smoke/template2.spec.ts +8 -7
- package/src/server/engine/ai/bossContenders.ts +27 -3
- package/src/server/engine/ai/phases.ts +1 -1
- package/src/server/engine/entities/creatureRefill.ts +9 -2
- package/src/server/engine/net/ledgerBook.ts +2 -0
- package/src/server/engine/net/room.ts +15 -0
- package/src/server/engine/sim/respawn.ts +8 -0
- package/src/server/game/boss/arenaRoomEntry.ts +5 -1
- package/src/server/game/boss/arenaRoomNative.ts +2 -0
- package/src/server/game/boss/native.ts +2 -1
- package/src/server/game/boss/nativeWake.ts +9 -5
- package/src/server/game/boss/openArenaNative.ts +2 -2
- package/src/server/game/boss/openArenaRoom.ts +3 -1
- package/src/server/game/grid/room.ts +44 -3
- package/src/server/game/grid/simulation.ts +23 -0
- package/src/server/game/population/mixedRoster.ts +11 -3
- package/src/server/game/population/nativeBake.ts +8 -3
- package/src/server/game/population/nativeReturns.ts +6 -3
- package/src/server/game/population/roster.ts +5 -3
- package/src/server/game/quest/eliteDrops.ts +15 -4
- package/src/server/game/quest/nativeChapter.ts +1 -1
- package/src/server/game/quest/nativeComposition.ts +5 -1
- package/src/server/game/riding/nativeTaming.ts +10 -6
- package/src/server/game/riding/wildRefill.ts +3 -2
- package/src/server/game/shardfile/bossRow.ts +4 -2
- package/src/server/game/shardfile/homeKeeper.ts +4 -2
- package/src/server/host/bake/headlessWorker.ts +1 -1
- package/src/server/host/dedicated/cellHost.ts +98 -16
- package/src/server/host/dedicated/cellProtocol.ts +16 -1
- package/src/server/host/dedicated/cellWorker.ts +8 -5
- package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
- package/src/server/host/dedicated/gridCells.ts +15 -6
- package/src/server/host/dedicated/loopLag.ts +21 -0
- package/src/server/host/dedicated/main.ts +13 -5
- package/src/server/host/dedicated/packReader.ts +3 -3
- package/src/server/host/dedicated/placementFile.ts +4 -19
- package/src/server/host/dedicated/roadRoom.ts +34 -4
- package/src/server/host/dedicated/serverMetrics.ts +126 -0
- package/src/server/host/dedicated/socketPump.ts +21 -4
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +15 -4
- package/src/server/host/dedicated/world.ts +95 -8
- package/src/server/host/headless.ts +1 -1
- package/src/server/host/headlessRuntime.ts +1 -1
- package/src/server/host/standalone/roadWorld.ts +15 -3
- package/src/server/host/standalone/serverHost.ts +4 -1
- package/src/server/host/standalone/serverProduct.ts +41 -11
- package/src/shared/engine/ai/BossBrain.ts +8 -0
- package/src/shared/engine/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- package/src/shared/game/boss/wake.ts +6 -0
- package/src/shared/game/devColliders.ts +47 -0
- package/src/shared/game/eliteSystem.ts +8 -0
- package/src/shared/game/grid/allocator.ts +3 -0
- package/src/shared/game/grid/catalogueSlot.ts +7 -0
- package/src/shared/game/grid/placementRows.ts +36 -0
- package/src/shared/game/plugin/bossRecord.ts +3 -2
- package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
- package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
- package/src/shared/game/shardfile/packReads.ts +28 -3
- package/src/shared/game/shardfile/serverPack.ts +9 -0
- package/src/shared/game/systems/looks/trampleField.ts +2 -0
- package/src/shared/host/formatJsonSchema.ts +2 -2
- package/src/tsconfig.json +1 -27
- package/lint/host-reviews.json +0 -14
- package/lint/listed-view-code.json +0 -13
- package/lint/platform-pending-users.json +0 -2520
- package/lint/platform-pending-users.md +0 -18
- package/scripts/cell-mem/metrics-preload.mjs +0 -65
- package/scripts/check-closed-components.d.mts +0 -7
- package/scripts/check-closed-components.mjs +0 -87
- package/scripts/g571-hosts.d.mts +0 -3
- package/scripts/g571-hosts.mjs +0 -54
- package/scripts/host-ruler/register-migrate.mjs +0 -242
- package/scripts/listed-view-code.d.mts +0 -7
- package/scripts/listed-view-code.mjs +0 -93
- package/scripts/look-loop/fit-lut.py +0 -142
- package/scripts/look-loop/palette-delta.py +0 -183
- package/scripts/look-loop/regions/driftwood-isle.json +0 -25
- package/scripts/look-loop/regions/far-reach.json +0 -225
- package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
- package/scripts/look-loop/regions/pine-hollow.json +0 -22
- package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
- package/scripts/platform-chargebacks.d.mts +0 -9
- package/scripts/platform-chargebacks.mjs +0 -135
- package/scripts/shard-component-spans.d.mts +0 -15
- package/scripts/shard-component-spans.mjs +0 -18
- package/scripts/shard-components.d.mts +0 -16
- package/scripts/shard-components.mjs +0 -363
- package/scripts/shard-platform-hosts.d.mts +0 -2
- package/scripts/shard-platform-hosts.mjs +0 -93
- package/scripts/shard-platform-sections.d.mts +0 -2
- package/scripts/shard-platform-sections.mjs +0 -9
- package/scripts/shard-platform.d.mts +0 -76
- package/scripts/shard-platform.mjs +0 -1072
- package/src/.oxfmtrc.json +0 -48
- package/src/scripts/ask-new.sh +0 -29
- package/src/scripts/asks.mjs +0 -142
- package/src/scripts/herdr-prompt.sh +0 -34
- package/src/scripts/herdr-question-open.sh +0 -67
- package/src/scripts/md-wrap.mjs +0 -229
- /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
- /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
- /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
package/src/e2e/smoke/game.ts
CHANGED
|
@@ -73,22 +73,26 @@ async function snapshot(page: Page): Promise<Snapshot> {
|
|
|
73
73
|
if (probe === undefined) {
|
|
74
74
|
throw new Error('no game probe')
|
|
75
75
|
}
|
|
76
|
-
const
|
|
76
|
+
const area = probe.area()
|
|
77
77
|
return {
|
|
78
|
-
pos: state.player.pos,
|
|
78
|
+
pos: probe.state().player.pos,
|
|
79
79
|
door: globalThis.__workerClientRow?.('blender.door.open'),
|
|
80
|
-
solid:
|
|
81
|
-
|
|
82
|
-
?.targets()
|
|
83
|
-
.some((target): boolean => target.solid) ?? false,
|
|
84
|
-
flags: state.quest.adventure?.quest ?? [],
|
|
80
|
+
solid: area?.targets.some((target): boolean => target.solid) ?? false,
|
|
81
|
+
flags: area?.flags ?? [],
|
|
85
82
|
}
|
|
86
83
|
})
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
/** Title, Shard Select, Blender Template, Enter: the way a player starts (J233).
|
|
86
|
+
/** Title, Shard Select, Blender Template, Enter: the way a player starts (J233). A preview's Shard Select enters the grid
|
|
87
|
+
* (J311), so the page is `platform.grid` and the probe's area is the cell the player is in (T2E-1b). */
|
|
90
88
|
async function enter(page: Page): Promise<void> {
|
|
91
89
|
await page.locator('.ws-main-select').waitFor()
|
|
90
|
+
// A reload in play lands on the title under the drop card ("Unexpectedly back at the title", dropModal.ts): a player
|
|
91
|
+
// dismisses it, as here
|
|
92
|
+
const dismiss = page.locator('#wsdrop .dismiss')
|
|
93
|
+
if ((await dismiss.count()) > 0) {
|
|
94
|
+
await dismiss.click()
|
|
95
|
+
}
|
|
92
96
|
// Blender Template is a Developer shard. The switch is remembered across a reload.
|
|
93
97
|
const developer = page.locator('.ws-main-dev')
|
|
94
98
|
if ((await developer.getAttribute('aria-checked')) !== 'true') {
|
|
@@ -119,7 +123,9 @@ async function enter(page: Page): Promise<void> {
|
|
|
119
123
|
await page.waitForFunction((): boolean => {
|
|
120
124
|
const probe = globalThis.__wildshard
|
|
121
125
|
return (
|
|
122
|
-
probe?.
|
|
126
|
+
probe?.area()?.slug === 'blender-template' &&
|
|
127
|
+
// The cell's door panels are drawn: its targets are what steps 2, 3 and 7 read
|
|
128
|
+
(probe.area()?.targets.length ?? 0) > 0 &&
|
|
123
129
|
probe.app.state === 'play' &&
|
|
124
130
|
(probe.world?.game.frameCount ?? 0) > 5
|
|
125
131
|
)
|
|
@@ -160,9 +166,9 @@ async function doorOpens(page: Page): Promise<void> {
|
|
|
160
166
|
await page.waitForFunction(
|
|
161
167
|
(): boolean =>
|
|
162
168
|
globalThis.__workerClientRow?.('blender.door.open') === 1 &&
|
|
163
|
-
globalThis.__wildshard
|
|
164
|
-
?.
|
|
165
|
-
.every((target): boolean => !target.solid) === true,
|
|
169
|
+
globalThis.__wildshard
|
|
170
|
+
?.area()
|
|
171
|
+
?.targets.every((target): boolean => !target.solid) === true,
|
|
166
172
|
undefined,
|
|
167
173
|
STEP,
|
|
168
174
|
)
|
|
@@ -172,8 +178,7 @@ async function doorOpens(page: Page): Promise<void> {
|
|
|
172
178
|
async function earned(page: Page, flag: string): Promise<void> {
|
|
173
179
|
await page.waitForFunction(
|
|
174
180
|
(name): boolean =>
|
|
175
|
-
globalThis.__wildshard?.
|
|
176
|
-
true,
|
|
181
|
+
globalThis.__wildshard?.area()?.flags.includes(name) === true,
|
|
177
182
|
flag,
|
|
178
183
|
STEP,
|
|
179
184
|
)
|
|
@@ -5,19 +5,20 @@
|
|
|
5
5
|
type SmokeVec3 = Readonly<Record<'x' | 'y' | 'z', number>>
|
|
6
6
|
|
|
7
7
|
interface SmokeProbe {
|
|
8
|
-
|
|
8
|
+
/** The area the player is in: on a grid page the current cell (T2E-1b), null between cells. */
|
|
9
|
+
readonly area: () => {
|
|
9
10
|
readonly slug: string
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
readonly instance: string | null
|
|
12
|
+
readonly targets: readonly {
|
|
13
|
+
readonly panel: string
|
|
14
|
+
readonly solid: boolean
|
|
15
|
+
}[]
|
|
16
|
+
readonly flags: readonly string[]
|
|
17
|
+
} | null
|
|
14
18
|
readonly app: { readonly state: string }
|
|
15
19
|
readonly world?: { readonly game: { readonly frameCount: number } }
|
|
16
20
|
readonly state: () => {
|
|
17
21
|
readonly player: { readonly pos: SmokeVec3; readonly health: number }
|
|
18
|
-
readonly quest: {
|
|
19
|
-
readonly adventure?: { readonly quest?: readonly string[] }
|
|
20
|
-
}
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -115,16 +115,17 @@ test('Template 2: title, walk, door, guardian, reload', async ({
|
|
|
115
115
|
await hideAndSave(page)
|
|
116
116
|
await page.reload()
|
|
117
117
|
await enter(page)
|
|
118
|
+
// The server's flags reach the page with its first frames
|
|
119
|
+
await Promise.all(
|
|
120
|
+
['blender.door', 'blender.guardian', 'blender.complete'].map(
|
|
121
|
+
async (flag): Promise<void> => {
|
|
122
|
+
await earned(page, flag)
|
|
123
|
+
},
|
|
124
|
+
),
|
|
125
|
+
)
|
|
118
126
|
const back = await snapshot(page)
|
|
119
127
|
expect(back.door).toBe(1)
|
|
120
128
|
expect(back.solid).toBe(false)
|
|
121
|
-
expect(back.flags).toEqual(
|
|
122
|
-
expect.arrayContaining([
|
|
123
|
-
'blender.door',
|
|
124
|
-
'blender.guardian',
|
|
125
|
-
'blender.complete',
|
|
126
|
-
]),
|
|
127
|
-
)
|
|
128
129
|
lap('reload')
|
|
129
130
|
})
|
|
130
131
|
|
|
@@ -8,7 +8,15 @@ interface ContendedBoss {
|
|
|
8
8
|
readonly engaged: boolean;
|
|
9
9
|
readonly script: { readonly respawnPoint: () => { pos: Vector3; yaw: number } };
|
|
10
10
|
readonly disarm: () => void; readonly arm: () => void; readonly onPlayerDeath: () => boolean;
|
|
11
|
+
/** SC5: the brain's state, read for a beaten boss's return, and its own way back (else a plain `disarm`). SC10: `defeated`, its record,
|
|
12
|
+
* for a boss whose presence puts it away after a win (a roaming boss leaves `victory` for `dormant` when everyone walks off). */
|
|
13
|
+
readonly state?: string; readonly defeated?: boolean; readonly returnBeaten?: () => void;
|
|
11
14
|
}
|
|
15
|
+
/** SERVER-CELLS SC5 (J328): how a served world brings a beaten boss back, since a grid cell's world is never rebuilt. `rearm`: the
|
|
16
|
+
* boss stood armed from the start, so it stands armed again; a summoned one goes back to waiting for its summons. */
|
|
17
|
+
export interface BeatenReturn { readonly served: () => boolean; readonly rearm: boolean }
|
|
18
|
+
/** SC5: a served world's beaten boss comes back once nobody has stood in its arena this long, as J107's start-over waited. */
|
|
19
|
+
export const BOSS_RETURN_S = 300;
|
|
12
20
|
type ArenaPlayer = (point: Vector3) => boolean;
|
|
13
21
|
/** Marks a blow's share on a further player, which lands no further shares. */
|
|
14
22
|
const ECHO = 'boss.echo';
|
|
@@ -27,10 +35,13 @@ export class BossContenders {
|
|
|
27
35
|
private readonly players: ReadonlyMap<string, PlayerSim>;
|
|
28
36
|
private readonly inArena: ArenaPlayer;
|
|
29
37
|
private readonly place: (player: PlayerSim, position: Vector3, yaw: number) => void;
|
|
38
|
+
private readonly beaten: BeatenReturn | undefined;
|
|
39
|
+
/** SC5: seconds a beaten boss's arena has stood empty. */
|
|
40
|
+
private emptyFor = 0;
|
|
30
41
|
/** The point `BossBrain` watches, live. */
|
|
31
42
|
readonly player: { readonly position: Vector3 };
|
|
32
|
-
constructor(players: ReadonlyMap<string, PlayerSim>, inArena: ArenaPlayer, place: (player: PlayerSim, position: Vector3, yaw: number) => void) {
|
|
33
|
-
this.players = players; this.inArena = inArena; this.place = place;
|
|
43
|
+
constructor(players: ReadonlyMap<string, PlayerSim>, inArena: ArenaPlayer, place: (player: PlayerSim, position: Vector3, yaw: number) => void, beaten?: BeatenReturn) {
|
|
44
|
+
this.players = players; this.inArena = inArena; this.place = place; this.beaten = beaten;
|
|
34
45
|
const contender = (): PlayerSim => this.contender();
|
|
35
46
|
this.player = { get position() { return contender().position; } };
|
|
36
47
|
}
|
|
@@ -74,13 +85,26 @@ export class BossContenders {
|
|
|
74
85
|
/** The death checkpoint's answer. A room's only says the fight owns the death (`fell` returns them); a lone player's is the brain's. */
|
|
75
86
|
died(boss: ContendedBoss): boolean { return this.players.size > 1 ? boss.engaged : boss.onPlayerDeath(); }
|
|
76
87
|
/** Each fixed step, before the brain's: count who began the fight, and reset it once nobody is left inside. */
|
|
77
|
-
observe(boss: ContendedBoss): void {
|
|
88
|
+
observe(boss: ContendedBoss, dt: number = 1 / 60): void {
|
|
89
|
+
if (this.beaten !== undefined && (boss.state === 'victory' || (boss.defeated === true && !boss.engaged)) && this.beaten.served()) { this.unbeaten(boss, this.beaten, dt); return; }
|
|
90
|
+
this.emptyFor = 0;
|
|
78
91
|
if (this.players.size <= 1 && this.counted === 0) return;
|
|
79
92
|
if (!boss.engaged) { this.counted = 0; return; }
|
|
80
93
|
const inside = this.inside().length;
|
|
81
94
|
if (this.counted === 0) this.counted = Math.max(1, inside);
|
|
82
95
|
if (inside === 0) { this.counted = 0; boss.disarm(); boss.arm(); }
|
|
83
96
|
}
|
|
97
|
+
/** SC5: a served world's beaten boss, back once its arena has stood empty `BOSS_RETURN_S`; anyone inside starts the wait over. */
|
|
98
|
+
private unbeaten(boss: ContendedBoss, beaten: BeatenReturn, dt: number): void {
|
|
99
|
+
if (this.inside().length > 0) { this.emptyFor = 0; return; }
|
|
100
|
+
this.emptyFor += dt;
|
|
101
|
+
if (this.emptyFor < BOSS_RETURN_S) return;
|
|
102
|
+
this.emptyFor = 0; this.counted = 0;
|
|
103
|
+
if (boss.returnBeaten === undefined) boss.disarm(); else boss.returnBeaten();
|
|
104
|
+
if (beaten.rearm) boss.arm();
|
|
105
|
+
}
|
|
106
|
+
/** SC10: the cell slept this long with nobody in it, so nobody stood in the arena: a beaten boss's wait spends it. */
|
|
107
|
+
slept(seconds: number): void { if (this.beaten !== undefined) this.emptyFor += seconds; }
|
|
84
108
|
/** Players counted at the fight's start, for a continuation: 0 in any one-player fight. */
|
|
85
109
|
get engaged(): number { return this.counted; }
|
|
86
110
|
restoreEngaged(count: number): void { this.counted = count; }
|
|
@@ -56,7 +56,7 @@ export class PhaseEncounter {
|
|
|
56
56
|
const focus = new Vector3(...spec.arena.at), saved = { ...ports.saved };
|
|
57
57
|
const party = this.party = new BossContenders(sim.players, (point) => point.distanceTo(focus) < spec.arena.radius, (player, position, yaw) => {
|
|
58
58
|
player.position.copy(position); player.yaw = yaw; player.health.attributes.health = player.health.attributes.maxHealth;
|
|
59
|
-
});
|
|
59
|
+
}, { served: () => sim.respawn.served, rearm: true });
|
|
60
60
|
const phase = (): EncounterPhase => { const value = this.spec.phases[this.boss.phase]; if (!value) throw new Error('Missing encounter phase'); return value; };
|
|
61
61
|
this.boss = new BossBrain({ id: spec.id, name: spec.name, title: spec.title, retryTitle: spec.retry, intro: spec.intro, introShort: spec.introShort,
|
|
62
62
|
phases: spec.phases.map((p) => ({ at: p.at, name: p.name, caption: p.caption })), reward: {} }, {
|
|
@@ -63,6 +63,8 @@ export interface RefillPorts {
|
|
|
63
63
|
readonly random: () => number;
|
|
64
64
|
/** Put the body back. Nothing else may change the population: the queue has already dropped the entry. */
|
|
65
65
|
readonly spawn: (entry: RefillEntry, yaw: number) => void;
|
|
66
|
+
/** SC5 (J328): a served world (the MMO server's) is a room with one player in it: what falls comes back, as it does for two. */
|
|
67
|
+
readonly served?: () => boolean;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/**
|
|
@@ -76,20 +78,25 @@ export class CreatureRefill {
|
|
|
76
78
|
private clock = 0;
|
|
77
79
|
private readonly ports: RefillPorts;
|
|
78
80
|
constructor(ports: RefillPorts) { this.ports = ports; }
|
|
81
|
+
/** A room's refill runs: two players or more, or a served world's one (SC5: a grid cell never starts over, so this is all that refills it). */
|
|
82
|
+
private room(players: readonly RefillPlayer[]): boolean { return players.length > 1 || this.ports.served?.() === true; }
|
|
79
83
|
|
|
80
84
|
/** A body left its spawn point (it fell, or a player tamed it). */
|
|
81
85
|
left(entry: Omit<RefillEntry, 'wait'>): void {
|
|
82
|
-
if (this.ports.players()
|
|
86
|
+
if (!this.room(this.ports.players()) || this.pending.length >= REFILL_LIMIT) return;
|
|
83
87
|
this.pending.push({ ...entry, wait: REFILL_WAIT });
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
/** SC10: the cell slept this long with nobody near anything owed: each wait spends it at one player's rate. */
|
|
91
|
+
slept(seconds: number): void { for (const entry of this.pending) entry.wait -= seconds; }
|
|
92
|
+
|
|
86
93
|
step(dt: number): void {
|
|
87
94
|
if (this.pending.length === 0) return;
|
|
88
95
|
this.clock += dt;
|
|
89
96
|
if (this.clock < REFILL_CHECK) return;
|
|
90
97
|
const elapsed = this.clock, players = this.ports.players();
|
|
91
98
|
this.clock = 0;
|
|
92
|
-
if (players
|
|
99
|
+
if (!this.room(players)) return; // the room emptied to one: what is owed waits, and that player's game is today's
|
|
93
100
|
const due: RefillEntry[] = [];
|
|
94
101
|
for (const entry of this.pending) {
|
|
95
102
|
entry.wait -= elapsed * refillRate(playersNear(players, entry.x, entry.z));
|
|
@@ -57,6 +57,8 @@ export class LedgerBook {
|
|
|
57
57
|
}
|
|
58
58
|
/** Seat a player's book as it was saved: their serial goes on from there, so a client that remembers a higher one still hears what comes next (E7.4). */
|
|
59
59
|
seat(player: string, saved: LedgerBookSave[string]): void { this.books.set(player, { serial: saved.serial, rows: saved.rows.slice(), ids: new Set(saved.rows.map(row => row.id)) }); }
|
|
60
|
+
/** A player who has left: their serial and receipts went with their save (SC10: a long-lived world keeps only its live players'). */
|
|
61
|
+
drop(player: string): void { this.books.delete(player); }
|
|
60
62
|
private of(player: string): Book {
|
|
61
63
|
let book = this.books.get(player);
|
|
62
64
|
if (book === undefined) { book = { serial: 0, rows: [], ids: new Set() }; this.books.set(player, book); }
|
|
@@ -226,6 +226,21 @@ export class NetRoom {
|
|
|
226
226
|
this.remove(client);
|
|
227
227
|
return to.adopt(client.transport, player, client.queue, { identity: client.identity, reader: client.reader, capabilities: client.capabilities ?? [] });
|
|
228
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* GC15 (3): a player crossed into cell `toFrame` on another worker. Their client hears `travel` here, then this room lets it go with its
|
|
231
|
+
* link left open: the target room on the other worker hears the client's hello again and welcomes it (`travel`, `welcome`, full frame,
|
|
232
|
+
* as `handOff` does on one worker). False when there is nobody live to send.
|
|
233
|
+
*/
|
|
234
|
+
handOut(id: number, toFrame: number): boolean {
|
|
235
|
+
const client = this.clients.find(entry => entry.id === id);
|
|
236
|
+
if (client?.state !== 'live') return false;
|
|
237
|
+
const tick = this.world.tick(), travel: NetEvent = { kind: 'travel', tick, from: this.world.cell(), to: toFrame };
|
|
238
|
+
client.transport.send('reliable', eventsMessage(tick, [travel]).buffer);
|
|
239
|
+
this.remove(client);
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
/** GC15 (3): a client whose hello this room heard again after a travel from another worker reads this room's receipts from the start, as an adopted one does (its hello's ledger was the first room's). */
|
|
243
|
+
travelled(id: number): void { const client = this.clients.find(entry => entry.id === id); if (client !== undefined) client.ledgerSeen = 0; }
|
|
229
244
|
private adopt(transport: Transport, player: NetPlayer, queue: CommandQueue, said: { readonly identity: NetIdentity; readonly reader: WireClientReader | undefined; readonly capabilities: readonly number[] }): number | null {
|
|
230
245
|
const id = this.join(transport, player, queue), client = this.clients.find(entry => entry.id === id), { identity } = said;
|
|
231
246
|
if (client !== undefined) {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { LastPlace, type Feet, type LastPlaceSaved, type PlaceArea, type Stand } from '../../../shared/engine/quest/lastPlace';
|
|
2
2
|
import type { PlayerHealth } from '../../../shared/engine/combat/health';
|
|
3
3
|
|
|
4
|
+
declare module '../../../client/engine/events/maps' {
|
|
5
|
+
interface EventMap {
|
|
6
|
+
/** SERVER-CELLS SC10 (J328): a grid cell's world takes no ticks while nobody is in it, and is never rebuilt. On its first seat after
|
|
7
|
+
* empty time the cell host says how long it slept, and what comes back on a clock (a beaten boss, a fallen creature, a lair) spends it. */
|
|
8
|
+
'world.slept': { seconds: number };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
/** The page's death fade (ui/DeathFade: dark, then the fade back): no blow lands on the fallen until then. */
|
|
5
13
|
export const FALL_FADE = 1.35;
|
|
6
14
|
/** One player's record. A save holds a player only once they have one. */
|
|
@@ -75,7 +75,11 @@ export function installArenaEntry(host: SimHost, input: unknown, row: ArenaEntry
|
|
|
75
75
|
spawnBody: () => spawn(`${row.id}.body`, row.body.kind, row.body.variant, room.origin.x, room.origin.z, 0),
|
|
76
76
|
spawnAdd: (_index, ax, az, yaw) => spawn(`${row.id}.add.${String(adds++ % ADDS)}`, add.kind, add.variant, ax, az, yaw),
|
|
77
77
|
retire: actor => { actor.hidden = true; }, find: id => body(id), seal, saved,
|
|
78
|
-
|
|
78
|
+
// SC10 (J328): back to not beaten only when a served world's King stands again: the world's flags clear and the orb goes with them
|
|
79
|
+
persist: value => {
|
|
80
|
+
if (!value.defeated) { host.flags.clear(flag('defeated')); host.flags.clear(flag('paid')); orb = null; return; }
|
|
81
|
+
host.flags.set(flag('defeated')); if (value.rewardTaken) host.flags.set(flag('paid'));
|
|
82
|
+
},
|
|
79
83
|
// a lone player earned it alone; a room's earners come from the book at the killing blow
|
|
80
84
|
spawnReward: () => { if (!fight.bounty.room) fight.bounty.award([...host.players.keys()]); orb = orbAt; }, rewardPoint: () => orb });
|
|
81
85
|
// J105: the orb on the pedestal is each earner's own, through the ledger, and it stands until the last of them has taken theirs.
|
|
@@ -126,6 +126,8 @@ export function installArenaRoom<A extends ArenaRoomBody>(host: SimHost, rows: A
|
|
|
126
126
|
};
|
|
127
127
|
host.onStep(`${rows.step}.brain`, dt => {
|
|
128
128
|
if (portal !== undefined) for (const player of host.players.values()) through(player, portal, dt);
|
|
129
|
+
// SC10 (J328): a long-lived world forgets the doors of those who left (one who comes back starts outside, as a fresh world's would)
|
|
130
|
+
for (const id of doors.keys()) if (!host.players.has(id)) doors.delete(id);
|
|
129
131
|
seal(); sand.advance(dt);
|
|
130
132
|
const body = fight.body(); if (body === null || !body.alive) return;
|
|
131
133
|
const foe = row.party.nearest(body.position).position, initial = rows.initialize;
|
|
@@ -165,7 +165,8 @@ export function installGroundBoss(host: SimHost, input: unknown, profile: unknow
|
|
|
165
165
|
restoreRoamingFight(row, fight, value, actors);
|
|
166
166
|
if (fight.body !== null) fight.body.hidden = hidden;
|
|
167
167
|
},
|
|
168
|
-
|
|
168
|
+
// SC10: a served world's boss standing again (its record back to not beaten) takes its untaken orb with it
|
|
169
|
+
}, saved, persist: value => { if (!value.defeated) reward = null; record.persist(value); }, rewardPoint: () => reward,
|
|
169
170
|
spawnReward: () => { const at = itemPickupFloor(host.physics, fight.rewardPoint()); reward = { x: at.x, y: at.y + ITEM_PICKUP_HOVER + row.reward.hover, z: at.z }; } });
|
|
170
171
|
const Reward = v.strictObject({ version: v.literal(1), point: v.nullable(v.strictObject({ x: finite, y: finite, z: finite })) });
|
|
171
172
|
host.onStep(row.steps.reward, () => undefined, {
|
|
@@ -15,18 +15,22 @@ const Encounter = v.strictObject({ attempt: v.boolean(), waitForReturn: v.boolea
|
|
|
15
15
|
|
|
16
16
|
/** Install from data. Spawn remains the existing AS director/roster command,
|
|
17
17
|
* rather than an arbitrary callback lent to the encounter. */
|
|
18
|
-
export function installWakeBoss(host: SimHost, input: unknown, placement: { pool: { x: number; z: number }; arena: number }): { encounter: WakeBossEncounter; publish: (event: string) => void } {
|
|
18
|
+
export function installWakeBoss(host: SimHost, input: unknown, placement: { pool: { x: number; z: number }; arena: number }, returned?: () => void): { encounter: WakeBossEncounter; publish: (event: string) => void } {
|
|
19
19
|
const row = parseWakeEncounter(input), { pool, arena } = placement;
|
|
20
20
|
const encounter = new WakeBossEncounter(row, pool);
|
|
21
21
|
const body = () => Array.from(host.entities.values()).find(actor => actor.kind === row.kind) ?? null;
|
|
22
22
|
// J104, J107: whom the fight deals with is the living player nearest the pool, so it runs while anyone is in the arena. Those
|
|
23
23
|
// there when it wakes set its curves. A lone player runs the one-player encounter, unread.
|
|
24
24
|
const near = (point: { readonly x: number; readonly z: number }): boolean => Math.hypot(point.x - pool.x, point.z - pool.z) < row.arena.radius;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
// SERVER-CELLS SC10 (J328): a grid cell's world is never rebuilt, so a served world's won fight stands again once nobody has stood
|
|
26
|
+
// in the arena five minutes: the world's death flag cleared and the body gone (`returned`), so the next wake cue starts it afresh.
|
|
27
|
+
const party = new BossContenders(host.players, near, () => undefined, { served: () => host.respawn.served, rearm: false });
|
|
28
|
+
const contended = { get engaged() { return encounter.state === 'fight'; }, get state() { return encounter.state; }, script: { respawnPoint: () => ({ pos: new Vector3(pool.x, 0, pool.z), yaw: 0 }) },
|
|
29
|
+
disarm: () => undefined, arm: () => undefined, onPlayerDeath: () => false,
|
|
30
|
+
returnBeaten: () => { host.flags.clear(row.deadFlag); returned?.(); encounter.returnBeaten(); } };
|
|
28
31
|
const observation = (): WakeBossObservation => ({ player: nearestOnGround(host.players, pool.x, pool.z).position, animal: body(), wake: host.flags.has(row.wakeFlag), dead: host.flags.has(row.deadFlag) });
|
|
29
32
|
const flush = (): void => { for (const effect of encounter.takeEffects()) if (effect.kind === 'outcome') host.events.emit('boss.attempt', { boss: row.id, level: row.level, outcome: effect.outcome }); };
|
|
33
|
+
host.events.on('world.slept', ({ seconds }) => { party.slept(seconds); }, host.scope);
|
|
30
34
|
host.events.on('damage.dealt', ({ req, killed }) => {
|
|
31
35
|
const actor = body(); if (killed && actor !== null && req.target === actor.combatActor()) host.flags.set(row.deadFlag);
|
|
32
36
|
}, host.scope);
|
|
@@ -37,7 +41,7 @@ export function installWakeBoss(host: SimHost, input: unknown, placement: { pool
|
|
|
37
41
|
for (const [id, player] of host.players) if (id !== actor.id && player.health.alive && near(player.position)) return;
|
|
38
42
|
encounter.onPlayerDeath(host.players.get(actor.id)?.position ?? host.playerFocus); flush();
|
|
39
43
|
}, host.scope);
|
|
40
|
-
host.onStep(row.step,
|
|
44
|
+
host.onStep(row.step, dt => { party.observe(contended, dt); encounter.update(observation()); flush(); }, {
|
|
41
45
|
snapshot: () => { const { engaged } = party; return JSON.stringify({ ...encounter.encounterSnapshot(), ...(engaged === 0 ? {} : { engaged }) }); },
|
|
42
46
|
restore: value => { const saved = v.parse(Encounter, JSON.parse(v.parse(v.string(), value))); encounter.encounterRestore(saved); party.restoreEngaged(saved.engaged ?? 0); },
|
|
43
47
|
});
|
|
@@ -128,7 +128,7 @@ export async function prepareOpenArena(product: Pick<ShardProduct, 'json' | 'sec
|
|
|
128
128
|
easeViewToward(weapons().of(near).look,camera.position,target,dt);},spawnReward:()=>{
|
|
129
129
|
room.heartFell();
|
|
130
130
|
const at=itemPickupFloor(host.physics,fight.rewardPoint());rewardPoint=new Vector3(at.x,at.y+ITEM_PICKUP_HOVER+.5,at.z);reward=true;
|
|
131
|
-
},persist:saved=>{records.bosses.write({...records.bosses.read(),[data.definition.id]:saved});},toast,feed},ui,current);
|
|
131
|
+
},persist:saved=>{if(!saved.defeated){reward=false;rewardPoint=null;}/* SC10: the heart stands again, its untaken orb goes */records.bosses.write({...records.bosses.read(),[data.definition.id]:saved});},toast,feed},ui,current);
|
|
132
132
|
encounter.boss=boss;room.bind(boss,fight,()=>rewardPoint);first.health.checkpoint(host.scope,()=>room.party.died(boss));
|
|
133
133
|
const boundaryPorts={boss,fight,prompt,get player(){return room.near.position;},toast,
|
|
134
134
|
wall:()=>{hit('wall',room.near.position,data.view.wallDamage,data.lines.wall);},clear:()=>{actual.storm.weather.force(data.weather.clearing);},
|
|
@@ -154,7 +154,7 @@ export async function prepareOpenArena(product: Pick<ShardProduct, 'json' | 'sec
|
|
|
154
154
|
if(pickPrompt([prompt],eye,host.physics)===prompt)
|
|
155
155
|
arenaTie(fight.life,{engaged:boss.engaged,victory:boss.state==='victory',hit:reward,mounted:room.mounted(),storm:actual.storm.stormActive},data.tieLines,{boss,fight,toast:line=>{toast(line);sayFightView(host,arenaTieWord(data.definition.id),[data.tieLines.indexOf(line)]);}});
|
|
156
156
|
}
|
|
157
|
-
room.party.observe(boss);
|
|
157
|
+
room.party.observe(boss,dt);
|
|
158
158
|
if(boss.state!=='dormant'||fight.body.visible)boss.update(dt,host.clock.now);else fight.update(dt,host.clock.now,false);
|
|
159
159
|
const answer=fight.takeBoundary();if(answer!==null)arenaBoundary(answer,data.lines,data.record,boundaryPorts);
|
|
160
160
|
sayLooks(dt);
|
|
@@ -32,8 +32,10 @@ export class OpenArenaRoom {
|
|
|
32
32
|
const { center } = data.arena, radius = data.place.arenaRadius; this.centre = new Vector3(center.x, 0, center.z); this.tag = `boss.${data.record.kind}`;
|
|
33
33
|
for (const [name, row] of Object.entries(data.contacts)) this.rows.set(name, strikeFromData(row));
|
|
34
34
|
const inside = (point: { readonly x: number; readonly z: number }): boolean => (point.x - center.x) ** 2 + (point.z - center.z) ** 2 < radius ** 2;
|
|
35
|
-
|
|
35
|
+
// SC5 (J328): a served world's beaten heart stands again once the arena has stood empty; its prompt starts the next fight.
|
|
36
|
+
this.party = new BossContenders(host.players, inside, place, { served: () => host.respawn.served, rearm: false });
|
|
36
37
|
this.bounty = new BossBounty(host, () => null, data.definition.id); this.inside = inside;
|
|
38
|
+
host.events.on('world.slept', ({ seconds }) => { this.party.slept(seconds); }, host.scope);
|
|
37
39
|
}
|
|
38
40
|
private readonly inside: (point: { readonly x: number; readonly z: number }) => boolean;
|
|
39
41
|
/** The heart has fallen: name who earned it. Alone there is no one to name. */
|
|
@@ -4,6 +4,12 @@ import type { GridAssembly, GridPoint } from '../../../shared/game/grid/assembly
|
|
|
4
4
|
import { installGridCrossing, type GridCrossingSession } from '../../../shared/game/grid/crossing';
|
|
5
5
|
import type { GridSimulation } from './simulation';
|
|
6
6
|
import type { GridLoadout } from '../../../shared/game/grid/wallet';
|
|
7
|
+
import { CHUNK_HALF } from '@wildshard/engine/core/config';
|
|
8
|
+
|
|
9
|
+
/** How far from a cell's edge a player on the road has its world opened (the road between two cells is 62.5 m). */
|
|
10
|
+
const WARM_ROAD_METRES = 55;
|
|
11
|
+
/** The least a tick's move toward it counts as heading there (a walk is 0.07 m a tick); a capsule settling is not. */
|
|
12
|
+
const WARM_STEP_METRES = 0.02;
|
|
7
13
|
|
|
8
14
|
/** A player's completed hand-off: the `travel` a client's view follows (E5-REPLICATION §6.3.4). */
|
|
9
15
|
export interface GridTravel { readonly player: string; readonly from: string | null; readonly to: string | null }
|
|
@@ -22,6 +28,12 @@ export class GridRoom {
|
|
|
22
28
|
private readonly crossings = new Map<string, { readonly session: GridCrossingSession; readonly scope: Scope }>();
|
|
23
29
|
private readonly travels: GridTravel[] = [];
|
|
24
30
|
private readonly scope = new Scope('grid-room');
|
|
31
|
+
/** each player's last cell left for the road, and the cells opened ahead of them on this stretch of road (GC5): each at
|
|
32
|
+
* most once a stretch, so two players on the road never evict each other's cell tick after tick, and a failed open is not
|
|
33
|
+
* retried every tick (the crossing still prepares it at the line and reports a failure) */
|
|
34
|
+
private readonly departed = new Map<string, string>();
|
|
35
|
+
private readonly opened = new Map<string, Set<string>>();
|
|
36
|
+
private readonly feet = new Map<string, { x: number; z: number }>();
|
|
25
37
|
constructor(grid: GridSimulation, assembly: GridAssembly, ports: GridRoomPorts) {
|
|
26
38
|
this.grid = grid; this.assembly = assembly; this.ports = ports;
|
|
27
39
|
for (const player of grid.players()) this.watch(player);
|
|
@@ -30,7 +42,7 @@ export class GridRoom {
|
|
|
30
42
|
const { grid } = this, scope = this.scope.child(`crossing:${player}`);
|
|
31
43
|
const session = installGridCrossing({ current: () => grid.current(player), prepare: (from, to) => grid.prepare(from, to, player), ready: instance => grid.ready(instance),
|
|
32
44
|
checkpoint: instance => grid.checkpoint(instance), target: feet => grid.target(feet, player) }, this.assembly, instance => this.ports.loadout(player, instance), scope,
|
|
33
|
-
(from, to) => { this.travels.push({ player, from, to }); });
|
|
45
|
+
(from, to) => { this.travels.push({ player, from, to }); if (from !== null) this.departed.set(player, from); });
|
|
34
46
|
this.crossings.set(player, { session, scope });
|
|
35
47
|
}
|
|
36
48
|
/** Another player comes onto the highway at `at`, world coordinates, or into the world at `site`, in its own. */
|
|
@@ -39,11 +51,40 @@ export class GridRoom {
|
|
|
39
51
|
leave(player: string): boolean {
|
|
40
52
|
const crossing = this.crossings.get(player);
|
|
41
53
|
if (crossing === undefined || !this.grid.leave(player)) return false;
|
|
42
|
-
crossing.scope.dispose(); this.crossings.delete(player);
|
|
54
|
+
crossing.scope.dispose(); this.crossings.delete(player); this.departed.delete(player); this.feet.delete(player); this.opened.delete(player);
|
|
43
55
|
return true;
|
|
44
56
|
}
|
|
45
57
|
/** Everyone's own crossing, once per fixed tick, before any world steps. */
|
|
46
|
-
cross(): void {
|
|
58
|
+
cross(): void {
|
|
59
|
+
for (const [player, { session }] of this.crossings) {
|
|
60
|
+
const feet = this.grid.worldFeet(player);
|
|
61
|
+
this.warm(player, feet);
|
|
62
|
+
session.step(feet);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** GC5 (preview's in-page server, J311): a player on the road has the nearest cell ahead opened before they reach its line,
|
|
66
|
+
* as the page builds its own: opened only at the 6 m line, a cell's world held them at its wall for its whole load. The
|
|
67
|
+
* cell they left is not ahead. A failed open stays the crossing's to report. */
|
|
68
|
+
private warm(player: string, feet: Readonly<GridPoint>): void {
|
|
69
|
+
const previous = this.feet.get(player);
|
|
70
|
+
this.feet.set(player, { x: feet.x, z: feet.z });
|
|
71
|
+
if (this.grid.current(player) !== null) { this.opened.delete(player); return; }
|
|
72
|
+
if (previous === undefined) return;
|
|
73
|
+
const left = this.departed.get(player), edge = (p: Readonly<{ x: number; z: number }>, cell: { readonly origin: GridPoint }): number =>
|
|
74
|
+
Math.max(Math.abs(p.x - cell.origin.x), Math.abs(p.z - cell.origin.z)) - CHUNK_HALF;
|
|
75
|
+
let best: string | undefined, bestDistance = WARM_ROAD_METRES;
|
|
76
|
+
for (const cell of this.assembly.cells) {
|
|
77
|
+
// only a cell they draw nearer to: not one behind them, nor the one they left
|
|
78
|
+
const distance = edge(feet, cell);
|
|
79
|
+
if (cell.instance === left || distance > bestDistance || distance > edge(previous, cell) - WARM_STEP_METRES) continue;
|
|
80
|
+
best = cell.instance; bestDistance = distance;
|
|
81
|
+
}
|
|
82
|
+
if (best === undefined || this.grid.ready(best)) return;
|
|
83
|
+
const opened = this.opened.get(player) ?? new Set<string>();
|
|
84
|
+
if (opened.has(best)) return;
|
|
85
|
+
opened.add(best); this.opened.set(player, opened);
|
|
86
|
+
void this.grid.prefetch([best]).catch(() => undefined);
|
|
87
|
+
}
|
|
47
88
|
/** One fixed tick: everyone's own crossing, then every occupied world. */
|
|
48
89
|
step(commands?: ReadonlyMap<string, SimTickCommand>): void { this.cross(); this.grid.stepAll(commands); }
|
|
49
90
|
/** Every hand-off since the last call. */
|
|
@@ -50,6 +50,29 @@ interface Resident { value: GridResident; touched: number; reservations: number;
|
|
|
50
50
|
* board, swim) they had, so a walk across the line never stops (it started from rest: RP1's ~0.3 s stop at x -260 while the page
|
|
51
51
|
* caught it up), and an owner's seat parked in that cell never mixes the new speed with the mode it was left in. The dedicated server's
|
|
52
52
|
* handover (`CrossTarget.admit`) carries the same. */
|
|
53
|
+
/**
|
|
54
|
+
* GC15 (3): a walker's motion as plain data, for a crossing onto another worker (a message between threads carries no class), and
|
|
55
|
+
* `applyMotion` puts it on the arrival body as `carryMotion` does on one worker. A swim's climb target stays behind.
|
|
56
|
+
*/
|
|
57
|
+
export interface MotionSnapshot {
|
|
58
|
+
readonly board: { readonly on: boolean; readonly hoverAir: PlayerSim['board']['hoverAir']; readonly hoverBob: PlayerSim['board']['hoverBob'] };
|
|
59
|
+
readonly swim: Omit<PlayerSim['swim'], 'climbTo'>; readonly footing: PlayerSim['footing']; readonly moveScale: number;
|
|
60
|
+
readonly velocity: { readonly x: number; readonly y: number; readonly z: number }; readonly impulse: { readonly x: number; readonly y: number; readonly z: number };
|
|
61
|
+
readonly grounded: boolean; readonly shove: PlayerSim['shove']; readonly dash: PlayerSim['dash']; readonly dodge: PlayerSim['dodge']; readonly jump: PlayerSim['jump'];
|
|
62
|
+
}
|
|
63
|
+
export function motionOf(from: PlayerSim): MotionSnapshot {
|
|
64
|
+
const { climbTo: _climb, ...swim } = from.swim;
|
|
65
|
+
return { board: { on: from.board.on, hoverAir: from.board.hoverAir, hoverBob: from.board.hoverBob }, swim: { ...swim }, footing: { ...from.footing }, moveScale: from.moveScale,
|
|
66
|
+
velocity: { x: from.velocity.x, y: from.velocity.y, z: from.velocity.z }, impulse: { x: from.impulse.x, y: from.impulse.y, z: from.impulse.z }, grounded: from.fall.grounded,
|
|
67
|
+
shove: { ...from.shove }, dash: { ...from.dash }, dodge: { ...from.dodge }, jump: { ...from.jump } };
|
|
68
|
+
}
|
|
69
|
+
export function applyMotion(from: MotionSnapshot, to: PlayerSim): void {
|
|
70
|
+
if (to.board.on !== from.board.on) to.setBoard(from.board.on);
|
|
71
|
+
to.board.hoverAir = from.board.hoverAir; to.board.hoverBob = from.board.hoverBob;
|
|
72
|
+
Object.assign(to.swim, from.swim); Object.assign(to.footing, from.footing); to.moveScale = from.moveScale;
|
|
73
|
+
to.velocity.set(from.velocity.x, from.velocity.y, from.velocity.z); to.impulse.set(from.impulse.x, from.impulse.y, from.impulse.z); to.fall.grounded = from.grounded;
|
|
74
|
+
Object.assign(to.shove, from.shove); Object.assign(to.dash, from.dash); Object.assign(to.dodge, from.dodge); Object.assign(to.jump, from.jump);
|
|
75
|
+
}
|
|
53
76
|
export function carryMotion(from: PlayerSim, to: PlayerSim): void {
|
|
54
77
|
if (to.board.on !== from.board.on) to.setBoard(from.board.on);
|
|
55
78
|
to.board.hoverAir = from.board.hoverAir; to.board.hoverBob = from.board.hoverBob;
|
|
@@ -89,7 +89,7 @@ export function mixedPopulation(host: SimHost, id: string): ReturnType<typeof in
|
|
|
89
89
|
* The v8 continuation retains per-body policies, poses, ids and native handles. */
|
|
90
90
|
export function installMixedPopulation(host: SimHost, ports: MixedPopulationInput, saved?: Readonly<Omit<SimSnapshot, 'physics'>>): {
|
|
91
91
|
bodies: () => readonly MixedPopulationBody[]; hunt: ReturnType<typeof createNativeHunt>['hunt'];
|
|
92
|
-
captain: () => HuntBody | null; spawnCaptain: () => HuntBody; alarm: () => void;
|
|
92
|
+
captain: () => HuntBody | null; spawnCaptain: () => HuntBody; retireCaptain: () => void; alarm: () => void;
|
|
93
93
|
staggered: (actor: AnimalSim, strength: number, running: boolean) => void;
|
|
94
94
|
settle: () => void; publishPoses: () => void;
|
|
95
95
|
} {
|
|
@@ -222,7 +222,9 @@ export function installMixedPopulation(host: SimHost, ports: MixedPopulationInpu
|
|
|
222
222
|
|
|
223
223
|
const first = roster.bodies[0]; if (first === undefined) throw new Error('Empty mixed population roster');
|
|
224
224
|
const extra = Array.from({ length: ROSTER - BODY_COUNT - 1 }, () => enemyBody('', first.kind, first.variant, -1, { x: 0, z: 0 }, 0));
|
|
225
|
-
|
|
225
|
+
// SC10: the captain is the wake fight's, which brings him back itself; owed as a roster body he would return with no scale row and
|
|
226
|
+
// throw in the tick (a served world owes every kind since SC5).
|
|
227
|
+
const returns = intake.returns(roster.ecology, id => captain?.id === id);
|
|
226
228
|
/** A slot a retired body left. Boot slots stay their row's: a continuation rebuilds those from the rows, not the save. */
|
|
227
229
|
const vacated = (): number => { for (let i = BODY_COUNT; i < bodies.length; i++) if (bodies[i]?.actor === null) return i; return -1; };
|
|
228
230
|
const retireFallen = (id: string): void => { const fallen = intake.retireDead(id); if (fallen !== null) fallen.brain = null; };
|
|
@@ -310,6 +312,12 @@ export function installMixedPopulation(host: SimHost, ports: MixedPopulationInpu
|
|
|
310
312
|
if (body.actor === null) throw new Error('The Mixed population captain did not spawn');
|
|
311
313
|
return body.actor;
|
|
312
314
|
};
|
|
315
|
+
/** SERVER-CELLS SC10 (J328): a served world's beaten captain leaves, so the next wake cue spawns him afresh, as a fresh world would. */
|
|
316
|
+
const retireCaptain = (): void => {
|
|
317
|
+
if (captain === null) return;
|
|
318
|
+
if (captain.actor !== null) intake.retire(captain);
|
|
319
|
+
captain = null; sight[BODY_COUNT] = null;
|
|
320
|
+
};
|
|
313
321
|
const alarm = (): void => {
|
|
314
322
|
for (let i = 0; i < Math.min(ROSTER, bodies.length); i++) { const body = bodies[i], a = body?.actor ?? null; if (a !== null && a.alive && (a.aggressive || hunt.sensed(a))) wake(body); }
|
|
315
323
|
};
|
|
@@ -325,7 +333,7 @@ export function installMixedPopulation(host: SimHost, ports: MixedPopulationInpu
|
|
|
325
333
|
if (book.has(rows.step)) throw new Error('Duplicate mixed population');
|
|
326
334
|
book.set(rows.step, value); populations.set(host, book); host.scope.onDispose(() => { book.delete(rows.step); }); return value;
|
|
327
335
|
};
|
|
328
|
-
const population = { publishPoses, bodies: () => bodies, hunt, captain: () => captain?.actor ?? null, spawnCaptain, alarm, staggered };
|
|
336
|
+
const population = { publishPoses, bodies: () => bodies, hunt, captain: () => captain?.actor ?? null, spawnCaptain, retireCaptain, alarm, staggered };
|
|
329
337
|
if (saved === undefined) { keep(); return publish({ ...population, settle: () => undefined }); }
|
|
330
338
|
|
|
331
339
|
const keeper = v.parse(Saved, saved.adapters.find(adapter => adapter.id === ISLAND_STEP)?.state);
|
|
@@ -103,9 +103,14 @@ export function installNativeCollision(host:Pick<SimHost,'physics'|'scope'|'onSt
|
|
|
103
103
|
if(omitted(solid))continue;
|
|
104
104
|
// A world held near its player is a grid cell, whose edge is the platform's (`gridLevel`): a shard's own page walls don't stand there.
|
|
105
105
|
if(near!==null&&solid.material==='edge')continue;
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
|
|
106
|
+
// With no policy a row names its owner itself: a tagged row's `owner`, or a piece row's `ownerId` (Nalati's bake,
|
|
107
|
+
// SERVER-PARITY SS10b): `piece:<id>` as written, a `declared:` id by its name, the one a script looks up.
|
|
108
|
+
const named=solid.ownerId===undefined?null:solid.ownerId.startsWith('declared:')?solid.ownerId.slice('declared:'.length):solid.ownerId;
|
|
109
|
+
const owner=policy===undefined?solid.owner??named:solid.ownerId===undefined?null:owners.get(solid.ownerId);
|
|
110
|
+
// A hull or mesh is most of a Rapier heap; a declared owner's solid stays, since a script may look it up. A `piece:`
|
|
111
|
+
// `ownerId` names the page piece a solid stands for (Nalati's bake, SERVER-PARITY SS10b): no script looks it up. A tagged
|
|
112
|
+
// row's own `owner` string is built at once, whatever it reads.
|
|
113
|
+
if(near!==null&&(typeof owner!=='string'||solid.owner===undefined&&solid.ownerId?.startsWith('piece:')===true)&&solid.enabled!==false&&(solid.shape===9||solid.shape===6)&&solid.points!==undefined){
|
|
109
114
|
near.hold({x:solid.at[0],z:solid.at[2],reach:solidReach(solid.points),make:physics=>withOwner(host.scope,()=>tagged(physics,solid,owner))});
|
|
110
115
|
continue;
|
|
111
116
|
}
|
|
@@ -26,7 +26,8 @@ export class NativeReturns {
|
|
|
26
26
|
private now = 0;
|
|
27
27
|
private check = 0;
|
|
28
28
|
private readonly host: SimHost;
|
|
29
|
-
|
|
29
|
+
/** `reserved`: a body its owner brings back itself (a wake fight's captain, SC10), never owed as a roster body. */
|
|
30
|
+
constructor(host: SimHost, bodies: ReadonlyMap<string, ReturnBody>, hunt: StalkerBrain<HuntBody>, input: unknown, reserved: (id: string) => boolean = () => false) {
|
|
30
31
|
this.host = host;
|
|
31
32
|
this.rows = v.parse(NativeReturnRowsSchema, input);
|
|
32
33
|
this.queue = new RespawnQueue(this.rows.rules, this.rows.outOfSight,
|
|
@@ -38,13 +39,15 @@ export class NativeReturns {
|
|
|
38
39
|
};
|
|
39
40
|
host.events.on('actor.died', ({ actor }) => {
|
|
40
41
|
const body = [...bodies.values()].find(row => row.actor?.combatActor() === actor), native = body?.actor;
|
|
41
|
-
if (body === undefined || native === null || native === undefined || !(this.queue.accepts(body.kind) || host.players.size > 1)) return;
|
|
42
|
+
if (body === undefined || native === null || native === undefined || reserved(body.id) || !(this.queue.accepts(body.kind) || host.players.size > 1 || host.respawn.served)) return;
|
|
42
43
|
const herd = hunt.herds[body.herd];
|
|
43
44
|
owe(body.kind, body.variant, body.herd, herd?.cx ?? native.position.x, herd?.cz ?? native.position.z, body.id);
|
|
44
45
|
}, host.scope);
|
|
46
|
+
// SC10: a cell asleep with nobody in it: what is owed comes due as if the clock had run, and nobody near brings it sooner
|
|
47
|
+
host.events.on('world.slept', ({ seconds }) => { this.now += seconds; this.check += seconds; }, host.scope);
|
|
45
48
|
// J108: a tame leaves its spot empty on this roster too. Only a room owes it: one player's world stays as it was.
|
|
46
49
|
host.events.on('creature.tamed', ({ kind, variant, herd, x, z, id }) => {
|
|
47
|
-
if (host.players.size > 1 && bodies.has(id)) owe(kind, variant, herd, x, z, id);
|
|
50
|
+
if ((host.players.size > 1 || host.respawn.served) && bodies.has(id)) owe(kind, variant, herd, x, z, id);
|
|
48
51
|
}, host.scope);
|
|
49
52
|
}
|
|
50
53
|
/** At most one bounded queue scan per declared interval; retry entries keep
|