@wildshard/engine 0.1.18 → 0.1.20

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.
Files changed (334) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/budgets/shard-size-baseline.json +10 -4
  3. package/index.html +6 -4
  4. package/lint/engine-sides.json +18 -0
  5. package/lint/ratchet.json +0 -68
  6. package/lint/ratchet.mjs +1 -4
  7. package/package.json +19 -15
  8. package/scripts/agent-sync.mjs +27 -8
  9. package/scripts/app-build/appCook.ts +8 -2
  10. package/scripts/app-build/catalogue.ts +10 -7
  11. package/scripts/app-build/gen.ts +33 -2
  12. package/scripts/app-build/isolation.d.mts +10 -0
  13. package/scripts/app-build/isolation.mjs +47 -0
  14. package/scripts/app-build/outputProducts.mjs +4 -0
  15. package/scripts/app-build/previousDeploy.d.mts +2 -0
  16. package/scripts/app-build/previousDeploy.mjs +10 -1
  17. package/scripts/app-build/serviceWorker.ts +10 -3
  18. package/scripts/app-build/splitOutput.mjs +4 -2
  19. package/scripts/app-build/standaloneOutput.d.mts +1 -1
  20. package/scripts/app-build/standaloneOutput.mjs +5 -3
  21. package/scripts/app-build/titlePreloads.d.mts +8 -0
  22. package/scripts/app-build/titlePreloads.mjs +69 -0
  23. package/scripts/app-build/worldMapAtlas.ts +10 -6
  24. package/scripts/app-build-pipeline.mjs +31 -3
  25. package/scripts/built-product.mjs +1 -1
  26. package/scripts/cell-mem-bench.mjs +83 -23
  27. package/scripts/check-custom-sections-zero.mjs +1 -1
  28. package/scripts/check-devserver.mjs +2 -0
  29. package/scripts/check-models.mjs +2 -0
  30. package/scripts/check-paths.allow.json +0 -115
  31. package/scripts/check-paths.mjs +2 -2
  32. package/scripts/check-platform-ratchets.mjs +2 -3
  33. package/scripts/chromium-keychain.d.mts +1 -1
  34. package/scripts/ci-static.sh +1 -1
  35. package/scripts/committed-fast-checks.mjs +0 -2
  36. package/scripts/content-sw-proof.mjs +2 -1
  37. package/scripts/cook-worker.mjs +9 -3
  38. package/scripts/cook.mjs +18 -5
  39. package/scripts/docs-inputs-proof.mjs +6 -6
  40. package/scripts/e7-voice-staging-proof.mjs +1 -1
  41. package/scripts/gate-related-tests.mjs +1 -1
  42. package/scripts/git-source-view.mjs +1 -1
  43. package/scripts/goldens/capture.mjs +17 -5
  44. package/scripts/grid-crossing-nightly.mjs +59 -0
  45. package/scripts/grid-crossing-qa.mjs +44 -0
  46. package/scripts/grid-crossing-ratchet.d.mts +6 -0
  47. package/scripts/grid-crossing-ratchet.mjs +52 -0
  48. package/scripts/grid-crossing-report.mjs +122 -0
  49. package/scripts/grid-crossing-stages.mjs +47 -0
  50. package/scripts/grid-crossing-tour.mjs +284 -0
  51. package/scripts/grid-crossing-walk-proof.mjs +126 -17
  52. package/scripts/host-ruler/roots.mjs +2 -2
  53. package/scripts/host-ruler.d.mts +91 -0
  54. package/scripts/host-ruler.mjs +565 -0
  55. package/scripts/land.mjs +2 -1
  56. package/scripts/live-prepush.py +3 -5
  57. package/scripts/loading-flow/benchmax.mjs +37 -12
  58. package/scripts/loading-flow/deskbench.mjs +276 -0
  59. package/scripts/loading-flow/stalls.d.mts +17 -3
  60. package/scripts/loading-flow/stalls.mjs +82 -3
  61. package/scripts/look-loop/test_look_loop.py +1 -38
  62. package/scripts/memory-proof.mjs +61 -6
  63. package/scripts/mmo-bots.mjs +8 -2
  64. package/scripts/net-lag-proof.mjs +219 -0
  65. package/scripts/night-market-kit-budget.mjs +2 -2
  66. package/scripts/nightly-model.ts +9 -6
  67. package/scripts/offline-proof-rules.d.mts +2 -2
  68. package/scripts/offline-proof-rules.mjs +15 -4
  69. package/scripts/offline-proof.mjs +80 -13
  70. package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
  71. package/scripts/page-release/content.d.mts +9 -1
  72. package/scripts/page-release/content.mjs +131 -17
  73. package/scripts/page-release/flow.mjs +36 -10
  74. package/scripts/page-release/stamp-content.mjs +24 -0
  75. package/scripts/page-release.mjs +28 -6
  76. package/scripts/page-size.mjs +2 -1
  77. package/scripts/parity/boot-smoke.mjs +13 -2
  78. package/scripts/pin-format.ts +5 -2
  79. package/scripts/pin-packs.ts +1 -1
  80. package/scripts/pins-reuse.d.mts +1 -0
  81. package/scripts/pins-reuse.mjs +22 -0
  82. package/scripts/pins.ts +4 -4
  83. package/scripts/precommit-checks.mjs +1 -7
  84. package/scripts/precommit-jobs.mjs +0 -1
  85. package/scripts/precommit-source.py +1 -9
  86. package/scripts/program-discovery.mjs +1 -1
  87. package/scripts/ring-cook.mjs +2 -1
  88. package/scripts/ring-step.ts +1 -1
  89. package/scripts/scratch-dir.mjs +95 -0
  90. package/scripts/scratch-sweep.mjs +182 -0
  91. package/scripts/script-scenario-metrics.mjs +1 -1
  92. package/scripts/shard-output-content.d.mts +1 -1
  93. package/scripts/shard-output-content.mjs +2 -2
  94. package/scripts/shard-outputs.mjs +1 -1
  95. package/scripts/shard-public.mjs +1 -1
  96. package/scripts/shard-wire-meter.mjs +24 -9
  97. package/scripts/side-parity.mjs +4 -2
  98. package/scripts/standalone-smoke.mjs +8 -3
  99. package/scripts/tier-textures.mjs +22 -4
  100. package/scripts/tile-bake-report.mjs +1 -1
  101. package/scripts/tile-bakes.mjs +1 -1
  102. package/scripts/title-assets.generated.json +2 -0
  103. package/scripts/tsconfig.json +2 -14
  104. package/scripts/vendor/basisu/LICENSE +201 -0
  105. package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
  106. package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
  107. package/scripts/vitest-push-guards.config.ts +1 -1
  108. package/scripts/vps/harden-apply.sh +4 -1
  109. package/scripts/vps/harden-prometheus.sh +179 -0
  110. package/scripts/vps/harden.sh +16 -0
  111. package/scripts/vps/rebuild.sh +18 -0
  112. package/scripts/vps/wildshard-config +6 -2
  113. package/scripts/worker-client-play.mjs +6 -2
  114. package/scripts/worktree-reap.mjs +59 -13
  115. package/scripts/worktree.mjs +19 -5
  116. package/src/.oxlintrc.json +3 -182
  117. package/src/client/app/entry.ts +10 -2
  118. package/src/client/engine/anim/rigParser.ts +2 -2
  119. package/src/client/engine/boot/bootCache.ts +2 -2
  120. package/src/client/engine/boot/bootTrace.ts +12 -4
  121. package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
  122. package/src/client/engine/boot/clearDownloads.ts +5 -2
  123. package/src/client/engine/boot/contentRead.ts +11 -0
  124. package/src/client/engine/boot/gpuFiles.ts +4 -2
  125. package/src/client/engine/boot/lastEnd.ts +99 -12
  126. package/src/client/engine/boot/texturePack.ts +2 -2
  127. package/src/client/engine/core/Game.ts +63 -19
  128. package/src/client/engine/core/gpuOnly.ts +10 -0
  129. package/src/client/engine/core/renderBudget.ts +134 -0
  130. package/src/client/engine/net/netPlayer.ts +19 -2
  131. package/src/client/engine/net/otherPlayers.ts +55 -8
  132. package/src/client/engine/net/predictor.ts +33 -9
  133. package/src/client/engine/net/redial.ts +68 -10
  134. package/src/client/engine/pwa/cacheNames.ts +58 -1
  135. package/src/client/engine/pwa/sw.js +41 -11
  136. package/src/client/engine/render/dataLook.ts +219 -44
  137. package/src/client/engine/render/families/detail.ts +89 -0
  138. package/src/client/engine/render/families/pbr.ts +9 -1
  139. package/src/client/engine/render/families/registry.ts +11 -2
  140. package/src/client/engine/render/families/sceneSurface.ts +116 -0
  141. package/src/client/engine/render/look.ts +12 -0
  142. package/src/client/engine/render/lookLight.ts +103 -11
  143. package/src/client/engine/render/lookRender.ts +105 -0
  144. package/src/client/engine/render/precompile.ts +4 -2
  145. package/src/client/engine/render/tiers.ts +4 -1
  146. package/src/client/engine/saves/indexed.ts +2 -2
  147. package/src/client/engine/telemetry/browserErrors.ts +24 -3
  148. package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
  149. package/src/client/engine/ui/debugOptions.ts +1 -1
  150. package/src/client/engine/ui/lookLightOption.ts +10 -6
  151. package/src/client/engine/ui/namePrompt.ts +7 -0
  152. package/src/client/engine/world/declaredProps.ts +5 -1
  153. package/src/client/engine/world/skyRig.ts +4 -1
  154. package/src/client/engine/world/terrainTileView.ts +64 -23
  155. package/src/client/game/boot/audio.generated.ts +114 -114
  156. package/src/client/game/boot/bytes.generated.ts +118 -220
  157. package/src/client/game/boot/placedSpawn.ts +35 -0
  158. package/src/client/game/boot/spawnDownload.ts +25 -6
  159. package/src/client/game/boot/versions.generated.ts +7 -5
  160. package/src/client/game/devScene/hook.ts +428 -0
  161. package/src/client/game/devScene/liveLook.ts +21 -0
  162. package/src/client/game/grid/cellLoading.ts +12 -2
  163. package/src/client/game/grid/live.ts +152 -19
  164. package/src/client/game/grid/liveSession.ts +53 -3
  165. package/src/client/game/grid/mapAtlas.ts +18 -4
  166. package/src/client/game/grid/minimapBlend.ts +15 -5
  167. package/src/client/game/grid/oneWayIn.ts +5 -1
  168. package/src/client/game/grid/pageEntry.ts +12 -1
  169. package/src/client/game/grid/placedCells.ts +114 -12
  170. package/src/client/game/grid/placedContent.ts +85 -0
  171. package/src/client/game/grid/prefetch.ts +9 -1
  172. package/src/client/game/grid/productInputs.ts +23 -10
  173. package/src/client/game/grid/productLeases.ts +4 -1
  174. package/src/client/game/grid/products.ts +8 -4
  175. package/src/client/game/grid/roadLook.ts +24 -15
  176. package/src/client/game/grid/roadLookPlatform.ts +4 -2
  177. package/src/client/game/grid/roadResources.ts +24 -0
  178. package/src/client/game/grid/roadSign.worker.ts +4 -3
  179. package/src/client/game/grid/roadSignPaint.ts +16 -5
  180. package/src/client/game/grid/roadSignPreparation.ts +4 -3
  181. package/src/client/game/grid/roadSignScale.ts +8 -0
  182. package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
  183. package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
  184. package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
  185. package/src/client/game/grid/roadTileWriter.ts +2 -1
  186. package/src/client/game/grid/screenReports.ts +39 -0
  187. package/src/client/game/grid/session.ts +32 -7
  188. package/src/client/game/grid/softWallLook.ts +25 -8
  189. package/src/client/game/mainMenu.ts +6 -2
  190. package/src/client/game/plugin/context.ts +2 -1
  191. package/src/client/game/plugin/followedMovers.ts +7 -1
  192. package/src/client/game/quest/figures.ts +2 -0
  193. package/src/client/game/session/finish.ts +9 -0
  194. package/src/client/game/shardfile/assetCache.ts +4 -4
  195. package/src/client/game/shardfile/client.ts +28 -8
  196. package/src/client/game/shardfile/clientAssets.ts +9 -5
  197. package/src/client/game/shardfile/clientLibrary.ts +1 -1
  198. package/src/client/game/shardfile/clientPropMaterials.ts +4 -1
  199. package/src/client/game/shardfile/clientViews.ts +36 -8
  200. package/src/client/game/shardfile/clientWater.ts +51 -9
  201. package/src/client/game/shardfile/clientWorker.ts +19 -7
  202. package/src/client/game/shardfile/constructionCheckpoint.ts +2 -2
  203. package/src/client/game/shardfile/groundMerge.ts +57 -5
  204. package/src/client/game/shardfile/hybrid.ts +2 -0
  205. package/src/client/game/shardfile/look.ts +8 -3
  206. package/src/client/game/shardfile/product.ts +34 -7
  207. package/src/client/game/shardfile/productChecks.ts +2 -2
  208. package/src/client/game/shardfile/productCost.ts +2 -2
  209. package/src/client/game/shardfile/readAsset.ts +2 -2
  210. package/src/client/game/shardfile/reflectingWater.ts +73 -0
  211. package/src/client/game/shardfile/seatGrace.ts +9 -0
  212. package/src/client/game/shardfile/skinPlayback.ts +1 -1
  213. package/src/client/game/shardfile/slabLibrary.ts +115 -49
  214. package/src/client/game/shardfile/tileContent.ts +1 -1
  215. package/src/client/game/shardfile/tileDriver.ts +38 -11
  216. package/src/client/game/shardfile/wirePage.ts +7 -3
  217. package/src/client/game/shardfile/worldScenes.ts +17 -10
  218. package/src/client/game/systems/npc/figureRows.ts +9 -0
  219. package/src/client/host/online/doctor.ts +22 -7
  220. package/src/client/host/online/doctorView.ts +2 -0
  221. package/src/client/host/online/linkScreens.ts +109 -5
  222. package/src/client/host/online/shell.ts +13 -4
  223. package/src/client/host/standalone/shell.ts +40 -0
  224. package/src/cook/game/astc6Encode.ts +55 -0
  225. package/src/cook/game/astc6Wasm.ts +176 -0
  226. package/src/cook/game/cookJob.ts +30 -6
  227. package/src/cook/game/cookWorker.ts +38 -11
  228. package/src/cook/game/entryTotals.ts +51 -24
  229. package/src/cook/game/shardCook.ts +35 -7
  230. package/src/cook/game/spawnParts.ts +33 -8
  231. package/src/cook/game/tierTextures.ts +87 -14
  232. package/src/server/engine/ai/bossContenders.ts +27 -3
  233. package/src/server/engine/ai/phases.ts +1 -1
  234. package/src/server/engine/entities/creatureRefill.ts +9 -2
  235. package/src/server/engine/net/ledgerBook.ts +2 -0
  236. package/src/server/engine/net/room.ts +15 -0
  237. package/src/server/engine/sim/respawn.ts +8 -0
  238. package/src/server/game/boss/arenaRoomEntry.ts +5 -1
  239. package/src/server/game/boss/arenaRoomNative.ts +2 -0
  240. package/src/server/game/boss/native.ts +2 -1
  241. package/src/server/game/boss/nativeWake.ts +9 -5
  242. package/src/server/game/boss/openArenaNative.ts +2 -2
  243. package/src/server/game/boss/openArenaRoom.ts +3 -1
  244. package/src/server/game/grid/room.ts +44 -3
  245. package/src/server/game/grid/simulation.ts +23 -0
  246. package/src/server/game/population/mixedRoster.ts +11 -3
  247. package/src/server/game/population/nativeBake.ts +8 -3
  248. package/src/server/game/population/nativeReturns.ts +6 -3
  249. package/src/server/game/population/roster.ts +5 -3
  250. package/src/server/game/quest/eliteDrops.ts +18 -3
  251. package/src/server/game/quest/nativeChapter.ts +1 -1
  252. package/src/server/game/quest/nativeComposition.ts +5 -1
  253. package/src/server/game/riding/nativeTaming.ts +22 -7
  254. package/src/server/game/riding/wildRefill.ts +3 -2
  255. package/src/server/game/shardfile/bossRow.ts +4 -2
  256. package/src/server/game/shardfile/homeKeeper.ts +4 -2
  257. package/src/server/host/bake/headlessWorker.ts +1 -1
  258. package/src/server/host/dedicated/cellHost.ts +112 -18
  259. package/src/server/host/dedicated/cellProtocol.ts +18 -1
  260. package/src/server/host/dedicated/cellWorker.ts +8 -5
  261. package/src/server/host/dedicated/dedicatedRoom.ts +38 -11
  262. package/src/server/host/dedicated/gridCells.ts +15 -6
  263. package/src/server/host/dedicated/loopLag.ts +21 -0
  264. package/src/server/host/dedicated/main.ts +13 -5
  265. package/src/server/host/dedicated/packReader.ts +3 -3
  266. package/src/server/host/dedicated/placementFile.ts +3 -2
  267. package/src/server/host/dedicated/roadRoom.ts +34 -4
  268. package/src/server/host/dedicated/serverMetrics.ts +135 -0
  269. package/src/server/host/dedicated/socketPump.ts +21 -4
  270. package/src/server/host/dedicated/workerTable.ts +32 -14
  271. package/src/server/host/dedicated/world.ts +65 -7
  272. package/src/server/host/headless.ts +1 -1
  273. package/src/server/host/headlessRuntime.ts +1 -1
  274. package/src/server/host/standalone/roadWorld.ts +15 -3
  275. package/src/server/host/standalone/serverHost.ts +57 -8
  276. package/src/server/host/standalone/serverProduct.ts +48 -16
  277. package/src/server/host/standalone/serverRuntime.ts +1 -1
  278. package/src/shared/engine/ai/BossBrain.ts +8 -0
  279. package/src/shared/engine/core/framePacing.ts +12 -1
  280. package/src/shared/engine/physics/terrainTiles.ts +20 -4
  281. package/src/shared/game/boss/wake.ts +6 -0
  282. package/src/shared/game/devColliders.ts +107 -0
  283. package/src/shared/game/devGameplay.ts +41 -0
  284. package/src/shared/game/eliteSystem.ts +8 -0
  285. package/src/shared/game/grid/allocator.ts +3 -0
  286. package/src/shared/game/grid/placementRows.ts +5 -2
  287. package/src/shared/game/plugin/bossRecord.ts +3 -2
  288. package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
  289. package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
  290. package/src/shared/game/shardfile/packReads.ts +28 -3
  291. package/src/shared/game/shardfile/serverPack.ts +9 -0
  292. package/src/shared/game/systems/looks/trampleField.ts +2 -0
  293. package/src/shared/host/formatJsonSchema.ts +2 -2
  294. package/src/tsconfig.json +1 -27
  295. package/lint/host-reviews.json +0 -14
  296. package/lint/listed-view-code.json +0 -13
  297. package/lint/platform-pending-users.json +0 -2520
  298. package/lint/platform-pending-users.md +0 -18
  299. package/scripts/cell-mem/metrics-preload.mjs +0 -65
  300. package/scripts/check-closed-components.d.mts +0 -7
  301. package/scripts/check-closed-components.mjs +0 -87
  302. package/scripts/g571-hosts.d.mts +0 -3
  303. package/scripts/g571-hosts.mjs +0 -54
  304. package/scripts/host-ruler/register-migrate.mjs +0 -242
  305. package/scripts/listed-view-code.d.mts +0 -7
  306. package/scripts/listed-view-code.mjs +0 -93
  307. package/scripts/look-loop/fit-lut.py +0 -142
  308. package/scripts/look-loop/palette-delta.py +0 -183
  309. package/scripts/look-loop/regions/driftwood-isle.json +0 -25
  310. package/scripts/look-loop/regions/far-reach.json +0 -225
  311. package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
  312. package/scripts/look-loop/regions/pine-hollow.json +0 -22
  313. package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
  314. package/scripts/platform-chargebacks.d.mts +0 -9
  315. package/scripts/platform-chargebacks.mjs +0 -135
  316. package/scripts/shard-component-spans.d.mts +0 -15
  317. package/scripts/shard-component-spans.mjs +0 -18
  318. package/scripts/shard-components.d.mts +0 -16
  319. package/scripts/shard-components.mjs +0 -363
  320. package/scripts/shard-platform-hosts.d.mts +0 -2
  321. package/scripts/shard-platform-hosts.mjs +0 -93
  322. package/scripts/shard-platform-sections.d.mts +0 -2
  323. package/scripts/shard-platform-sections.mjs +0 -9
  324. package/scripts/shard-platform.d.mts +0 -76
  325. package/scripts/shard-platform.mjs +0 -1072
  326. package/src/.oxfmtrc.json +0 -48
  327. package/src/scripts/ask-new.sh +0 -29
  328. package/src/scripts/asks.mjs +0 -142
  329. package/src/scripts/herdr-prompt.sh +0 -34
  330. package/src/scripts/herdr-question-open.sh +0 -67
  331. package/src/scripts/md-wrap.mjs +0 -229
  332. /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
  333. /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
  334. /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
@@ -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
- const returns = intake.returns(roster.ecology);
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
- const owner=policy===undefined?solid.owner??null:solid.ownerId===undefined?null:owners.get(solid.ownerId);
107
- // A hull or mesh is most of a Rapier heap; a declared owner's solid stays, since a script may look it up.
108
- if(near!==null&&typeof owner!=='string'&&solid.enabled!==false&&(solid.shape===9||solid.shape===6)&&solid.points!==undefined){
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
- constructor(host: SimHost, bodies: ReadonlyMap<string, ReturnBody>, hunt: StalkerBrain<HuntBody>, input: unknown) {
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
@@ -180,7 +180,7 @@ export function installPopulationRoster(host: SimHost, ports: PopulationRosterPo
180
180
 
181
181
  // J109, J108: a room's herds fill again; one player's stay as they fell, and their saves never carry this row
182
182
  const REFILL_STATE = `${ROSTER_STEP}.refill`, room = (): readonly PlayerSim[] => [...host.players.values()];
183
- const refill = new CreatureRefill({ players: room, room: () => BODY_COUNT - list.filter(body => body.actor.alive).length,
183
+ const refill = new CreatureRefill({ players: room, served: () => host.respawn.served, room: () => BODY_COUNT - list.filter(body => body.actor.alive).length,
184
184
  random: () => host.rng.stream('spawn').next(), spawn: ({ kind, variant, herd, x, z, from }, yaw) => {
185
185
  const fallen = list.find(body => body.id === from)?.actor, group = hunt.herds[herd];
186
186
  if (fallen?.alive === false) retire(fallen);
@@ -190,13 +190,14 @@ export function installPopulationRoster(host: SimHost, ports: PopulationRosterPo
190
190
  const at = fallen === undefined ? -1 : group?.members.indexOf(fallen) ?? -1;
191
191
  if (at === -1) group?.members.push(a); else if (group !== undefined) group.members[at] = a;
192
192
  } });
193
+ host.events.on('world.slept', ({ seconds }) => { refill.slept(seconds); }, host.scope);
193
194
  host.events.on('actor.died', ({ actor }) => {
194
- if (host.players.size <= 1) return;
195
+ if (host.players.size <= 1 && !host.respawn.served) return;
195
196
  const a = list.find(body => body.actor.combatActor() === actor)?.actor, group = a === undefined ? undefined : hunt.herds[a.herd];
196
197
  if (a !== undefined && group !== undefined) refill.left({ kind: a.kind, variant: a.variant, herd: a.herd, x: group.cx, z: group.cz, from: a.entityId });
197
198
  }, host.scope);
198
199
  host.events.on('creature.tamed', tamed => {
199
- if (host.players.size > 1 && list.some(body => body.id === tamed.id)) refill.left({ ...tamed, from: tamed.id });
200
+ if ((host.players.size > 1 || host.respawn.served) && list.some(body => body.id === tamed.id)) refill.left({ ...tamed, from: tamed.id });
200
201
  }, host.scope);
201
202
  host.onStep(ROSTER_STEP, dt => {
202
203
  cadence.observe(dt); continuation.advance(dt); cadence.decide();
@@ -224,6 +225,7 @@ export function installPopulationRoster(host: SimHost, ports: PopulationRosterPo
224
225
  herdOwners();
225
226
  },
226
227
  });
228
+ host.events.on('world.slept', ({ seconds }) => { refill.slept(seconds); }, host.scope);
227
229
  // a restoring install: the saved list's live spawns from the host's own recipes, in order (a body retired in play leaves it)
228
230
  const saved = ports.saved, keeper = saved === undefined ? undefined : v.parse(Saved, saved.adapters.find(adapter => adapter.id === ROSTER_STEP)?.state);
229
231
  if (saved?.adapters.some(adapter => adapter.id === REFILL_STATE) === true) host.adapters.set(REFILL_STATE, refill.state);
@@ -1,4 +1,5 @@
1
1
  import { actRoutes } from '@wildshard/engine/sim/actRoutes';
2
+ import { questBooks } from '@wildshard/engine/quest/players';
2
3
  import type { SimHost } from '@wildshard/engine/sim';
3
4
  import { itemPickupFloor, ITEM_PICKUP_HOVER } from '@wildshard/engine/world/interact/pickup';
4
5
  import { pickPrompt } from '@wildshard/engine/world/interact/prompts';
@@ -10,23 +11,37 @@ const REACH_EYE = 1.68;
10
11
  const PROMPT_ABOVE = 0.5, PROMPT_RADIUS = 1.8;
11
12
  type Body = EliteCoreActor & { readonly position: { readonly x: number; readonly y: number; readonly z: number } };
12
13
 
14
+ /** SC10: the flag in each player's own book that says they took this lair's skin, in a served world. */
15
+ export const eliteSkinFlag = (id: string): string => `elite.${id}.skin`;
16
+
13
17
  /**
14
18
  * A first kill's orb on the server (J130). The rules say a lair's skin is untaken as it falls; this lays the orb out on the lair's
15
19
  * row, and a press in reach takes it. What the skin does to what's in hand is the page's, as a boss's is: the server keeps that it
16
20
  * went, so the next kill drops none.
21
+ *
22
+ * SERVER-CELLS SC10 (J328): a served world is never rebuilt, so there the skin is each player's own: a kill lays the orb out while a
23
+ * player present has not taken it, a press takes it for the presser (a flag in their own book, which goes with their save), and an
24
+ * owner's press is refused. The orb stays until every player present has taken theirs. The lair's world record (`skinTaken`) is a page's or a tape's alone.
17
25
  */
18
26
  export function eliteDrops<S extends EliteCoreScript<Body>>(host: SimHost): { readonly hooks: EliteCoreHooks<S>; readonly bind: (core: EliteCore<S>) => void } {
19
27
  const routes = actRoutes(host);
20
28
  let core: EliteCore<S> | null = null;
21
- return { bind: owner => { core = owner; }, hooks: { fell: (entry, first) => {
22
- const { animal, def } = entry.script;
23
- if (!first || animal === null || def.drop === undefined || def.drop.skin === null) return;
29
+ const owns = (player: string, id: string): boolean => { const books = questBooks(host), flag = eliteSkinFlag(id); books.claim([flag]); return books.of(player).flags.has(flag); };
30
+ const lacking = (id: string): boolean => [...host.players.keys()].some(player => !host.parked.has(player) && !owns(player, id));
31
+ return { bind: owner => { core = owner; host.events.on('world.slept', ({ seconds }) => { owner.slept(seconds); }, host.scope); }, hooks: { fell: (entry, first) => {
32
+ const { animal, def } = entry.script, served = host.respawn.served;
33
+ if (animal === null || def.drop === undefined || def.drop.skin === null || !(served ? lacking(def.id) : first)) return;
24
34
  const at = itemPickupFloor(host.physics, animal.position);
25
35
  entry.drop = { x: at.x, y: at.y + ITEM_PICKUP_HOVER, z: at.z };
26
36
  routes.claims.set(`${def.id}.reward`, player => {
27
37
  const feet = host.players.get(player)?.position, { drop } = entry;
28
38
  if (feet === undefined || drop === null) return;
39
+ // an owner's press takes nothing; once nobody present lacks the skin, it clears the orb (review SHOULD: no orb left standing)
40
+ if (served && owns(player, def.id)) { if (!lacking(def.id)) entry.drop = null; return; }
29
41
  if (pickPrompt([{ position: { x: drop.x, y: drop.y + PROMPT_ABOVE, z: drop.z }, radius: PROMPT_RADIUS }], { x: feet.x, y: feet.y + REACH_EYE, z: feet.z }, host.physics) === undefined) return;
42
+ // SC10 review: in a served world the orb stays while anyone present still lacks the skin, so the first press takes it for the
43
+ // presser only, not for everyone who shared the kill
44
+ if (served) { questBooks(host).of(player).flags.set(eliteSkinFlag(def.id)); if (!lacking(def.id)) entry.drop = null; return; }
30
45
  entry.drop = null;
31
46
  const saved = core?.record(def.id);
32
47
  if (saved !== undefined) saved.skinTaken = true;
@@ -37,7 +37,7 @@ export function installNativeChapterDirector(host: SimHost, director: Awaited<Re
37
37
  if (!['flag', 'phase', 'cue', 'reward'].includes(effect.kind)) throw new Error('Native chapter requires closed native effects');
38
38
  }
39
39
  const population = policy.wake === undefined ? null : mixedPopulation(host, policy.wake.population);
40
- const encounter = policy.wake === undefined ? null : installWakeBoss(host, policy.wake.encounter, policy.wake.placement);
40
+ const encounter = policy.wake === undefined || population === null ? null : installWakeBoss(host, policy.wake.encounter, policy.wake.placement, population.retireCaptain);
41
41
  const reward = policy.reward === undefined ? null : installNativeQuestChannels(host, policy.reward, { started: false, completed: false });
42
42
  const leadBody = host.players.get(books.lead.player); if (leadBody === undefined) throw new Error('Native chapter requires its player');
43
43
  const timeline = new ChapterClock(host.scope, director, rows, host.flags,
@@ -475,7 +475,11 @@ export function installNativeQuestComposition(host: SimHost, ports: NativeQuestC
475
475
  value => ammunition.prepareRestore(v.parse(v.optional(NativeAmmunitionSavedSchema), value)));
476
476
  const keys = new Set<string>(rows.saved.snapshot);
477
477
  if (rows.saved.snapshot.some(key => !parts.has(key))) throw new Error('Native saved role has no mechanic');
478
- host.onStep(rows.step, dt => { for (const phase of rows.phases) need(phases.get(phase), 'phase')(dt); secret?.(dt); countSeatFeats(); }, {
478
+ host.onStep(rows.step, dt => {
479
+ for (const phase of rows.phases) need(phases.get(phase), 'phase')(dt); secret?.(dt); countSeatFeats();
480
+ // SC10 (J328): a long-lived world forgets the purchase lines of those who left (their goods are in their own save)
481
+ if (purchases.size > 0) for (const player of purchases.keys()) if (!host.players.has(player)) purchases.delete(player);
482
+ }, {
479
483
  snapshot: () => entry.saved.encode(Object.fromEntries(rows.saved.snapshot.flatMap(key => {
480
484
  const value = need(parts.get(key), 'saved role').capture(); return value === undefined ? [] : [[key, value]];
481
485
  }))),
@@ -46,6 +46,8 @@ export interface NativeTamingControls {
46
46
  readonly press: (id: string, press: NativeTamingPress) => void;
47
47
  /** A player's own session, once they have one. */
48
48
  readonly sessionOf: (id: string) => NativeTamingOwner | undefined;
49
+ /** SC10 review: this player's seat emptied (a served world's lead seat, parked): its bonded horses go and its session starts wild. */
50
+ readonly release: (id: string) => void;
49
51
  }
50
52
  export interface NativeTamingOwner {
51
53
  readonly scope: SimHost['scope'];
@@ -72,6 +74,8 @@ interface TamingSeat {
72
74
  readonly tick: (dt: number, read: boolean) => void;
73
75
  readonly shake: number; readonly roll: number;
74
76
  readonly holdOffer: (held: boolean) => void; readonly whistle: () => void;
77
+ /** SC5 (J328): its player left the room: the bodies it bonded go too, or a grid cell that never starts over gathers them past 64. */
78
+ readonly release: () => void;
75
79
  readonly save: () => { [Key in keyof v.InferOutput<typeof SessionSaved>]: v.InferOutput<typeof SessionSaved>[Key] };
76
80
  readonly load: (saved: v.InferOutput<typeof SessionSaved>, horses: readonly AnimalSim[]) => void;
77
81
  }
@@ -110,6 +114,10 @@ export function installNativeTaming(host: SimHost, context: NativeTamingContext,
110
114
  const mounted = mountedPlayerOf(host, player.id); if (mounted === undefined) throw new Error('Missing native mounted owner');
111
115
  let bond: string | null = null, pitch = 0, offer = false, heldOffer = false, calling = 0, lean = 0, shake = 0, roll = 0;
112
116
  const camera = new Vector3(), eye = new Vector3(), hurtDir = new Vector3(), mine = new Set<string>();
117
+ const retireBonded = (a: AnimalSim): void => {
118
+ mine.delete(a.entityId); creatures.retire(a.entityId); poses.delete(a.entityId);
119
+ const at = poseRows.indexOf(a); if (at === -1) throw new Error('Missing bonded pose'); poseRows.splice(at, 1);
120
+ };
113
121
  const law = new TamingSession<AnimalSim, HerdBrain<AnimalSim>>({
114
122
  profile: rows.binding,
115
123
  programs: rows.programs,
@@ -124,10 +132,7 @@ export function installNativeTaming(host: SimHost, context: NativeTamingContext,
124
132
  hud: { get offer() { return offer; }, get lean() { return lean; } }, herds: () => herds, rest: rows.rest,
125
133
  wind: () => wind, random: () => host.rng.stream('ai').next(),
126
134
  spawnBonded: (x, z, yaw, upgraded) => { const a = creatures.spawn(x, z, yaw, upgraded, mine.size); mine.add(a.entityId); addPose(a); return a; },
127
- hideStallion: a => { creatures.hide(a.entityId); }, retireBonded: a => {
128
- mine.delete(a.entityId); creatures.retire(a.entityId); poses.delete(a.entityId);
129
- const at = poseRows.indexOf(a); if (at === -1) throw new Error('Missing bonded pose'); poseRows.splice(at, 1);
130
- }, hurt: amount => {
135
+ hideStallion: a => { creatures.hide(a.entityId); }, retireBonded: a => { retireBonded(a); }, hurt: amount => {
131
136
  host.combat.hit({ source: 'env', sourceTags: ['env.ride'], target: player.health, amount, throughWalls: true,
132
137
  point: player.position, dir: hurtDir, cause: { kind: 'env.ride', label: rows.thrownLabel, text: rows.thrownLabel } });
133
138
  },
@@ -157,7 +162,10 @@ export function installNativeTaming(host: SimHost, context: NativeTamingContext,
157
162
  return taming;
158
163
  };
159
164
  const originalUpdate = law.update.bind(law);
160
- const session: TamingSeat = { player, law, get shake() { return shake; }, get roll() { return roll; }, holdOffer: held => { heldOffer = held; }, whistle: () => {
165
+ const session: TamingSeat = { player, law, get shake() { return shake; }, get roll() { return roll; }, holdOffer: held => { heldOffer = held; },
166
+ // SC10 review: a bonded horse is a mountable too (`addMountable` on adoption); it leaves the mounted owner's rows before it retires,
167
+ // or the next mounted step finds its pose with no body ("Missing mounted pose actor") and fails the worker
168
+ release: () => { for (const id of mine) { const a = poseRows.find(row => row.entityId === id); if (a === undefined) { mine.delete(id); continue; } if (mounted.mountables.includes(a)) mounted.removeMountable(id); retireBonded(a); } }, whistle: () => {
161
169
  const horse = law.companion;
162
170
  if (!mounted.mounted && horse !== null && horse.mem['whistle'] === 1 && mounted.canRide(horse.entityId) && horse.position.distanceTo(player.position) < 150) calling = 30;
163
171
  }, tick: (dt, read) => {
@@ -198,6 +206,8 @@ export function installNativeTaming(host: SimHost, context: NativeTamingContext,
198
206
  sessions.set(player.id, session); return session;
199
207
  };
200
208
  const first = sessionFor(firstSeat.player), { law } = first;
209
+ // SC10 review: the lead seat's session as a fresh world gives it, for when its player leaves a served world (the seat is parked)
210
+ const fresh = first.save();
201
211
  const others = (): TamingSeat[] => [...sessions.values()].filter(session => session !== first);
202
212
  host.events.on('creature.signal', ({ name, x, z }) => { for (const session of sessions.values()) session.law.noteEvent(name, x, z); }, host.scope);
203
213
  host.events.on('weapon.impact', ({ point }) => {
@@ -221,7 +231,7 @@ export function installNativeTaming(host: SimHost, context: NativeTamingContext,
221
231
  return best;
222
232
  };
223
233
  law.update = dt => {
224
- for (const [id, session] of sessions) if (host.players.get(id) !== session.player) sessions.delete(id);
234
+ for (const [id, session] of sessions) if (host.players.get(id) !== session.player) { session.release(); sessions.delete(id); }
225
235
  // Trust is the herd's: one voice speaks to it, the wild session closest to a stallion, or a far player would talk it down.
226
236
  const heard = sessions.size < 2 ? null : closestToWild();
227
237
  if (heard === null || first.law.phase !== 'wild' || heard === first) first.tick(dt, true);
@@ -260,7 +270,12 @@ export function installNativeTaming(host: SimHost, context: NativeTamingContext,
260
270
  },
261
271
  }, 'afterBodies');
262
272
  host.scope.onDispose(() => { for (let i = 0; i < 64; i++) { const actor = poseRows[i]; if (actor === undefined) break; poses.delete(actor.entityId); } poseRows.length = 0; installed.delete(host); });
263
- controls.set(host, { sessionOf: id => sessions.get(id)?.law, press: (id, press) => {
273
+ controls.set(host, { sessionOf: id => sessions.get(id)?.law, release: id => {
274
+ // an emptied seat keeps no one's taming: its horses go as any leaver's do, and the lead's own session starts wild again
275
+ const session = sessions.get(id); if (session === undefined) return;
276
+ session.release(); pending.delete(id);
277
+ if (session === first) first.load(fresh, []); else sessions.delete(id);
278
+ }, press: (id, press) => {
264
279
  if (!host.players.has(id)) throw new RangeError(`Unknown taming player ${id}`);
265
280
  pending.set(id, { ...pending.get(id), ...press });
266
281
  } });
@@ -18,16 +18,17 @@ export function installWildRefill(host: SimHost, mounts: BondedMountRoster, herd
18
18
  id: string, saved?: Readonly<Omit<SimSnapshot, 'physics'>>): (dt: number) => void {
19
19
  const state = `${id}.refill`;
20
20
  const herdOf = (actor: AnimalSim): HerdBrain<AnimalSim> | undefined => herds().find(row => row.members.includes(actor)) ?? herds()[0];
21
- const refill = new CreatureRefill({ players: () => [...host.players.values()], room: () => mounts.hidden.size,
21
+ const refill = new CreatureRefill({ players: () => [...host.players.values()], room: () => mounts.hidden.size, served: () => host.respawn.served,
22
22
  random: () => host.rng.stream('spawn').next(), spawn: ({ from, x, z }, yaw) => {
23
23
  const actor = host.entities.get(from), herd = actor === undefined ? undefined : herdOf(actor);
24
24
  if (actor === undefined || herd === undefined) return;
25
25
  mounts.reveal(from, x, z, yaw);
26
26
  herd.adoptStallion(actor); herd.addTrust(-100);
27
27
  } });
28
+ host.events.on('world.slept', ({ seconds }) => { refill.slept(seconds); }, host.scope);
28
29
  if (saved?.adapters.some(row => row.id === state) === true) host.adapters.set(state, refill.state);
29
30
  return dt => {
30
- if (host.players.size > 1) for (const hidden of mounts.hidden) {
31
+ if (host.players.size > 1 || host.respawn.served) for (const hidden of mounts.hidden) {
31
32
  if (refill.pending.some(entry => entry.from === hidden)) continue;
32
33
  const actor = host.entities.get(hidden), herd = actor === undefined ? undefined : herdOf(actor);
33
34
  if (actor !== undefined && herd !== undefined) refill.left({ kind: actor.kind, variant: actor.variant, herd: actor.herd, x: herd.cx, z: herd.cz, from: hidden });
@@ -76,8 +76,10 @@ const Saved = v.strictObject({ version: v.picklist([1, 2]), boss: Boss, fight: v
76
76
  * have this shape.
77
77
  */
78
78
  export function installBossRow(host: SimHost, spec: BossRowSpec): { boss: BossBrain; party: BossContenders; bounty: BossBounty; summon: () => void; locked: () => boolean } {
79
- const party = new BossContenders(host.players, point => spec.script.inArena(point), (player, position, yaw) => { player.position.copy(position); player.yaw = yaw; spec.returned?.(player); });
79
+ const party = new BossContenders(host.players, point => spec.script.inArena(point), (player, position, yaw) => { player.position.copy(position); player.yaw = yaw; spec.returned?.(player); },
80
+ { served: () => host.respawn.served, rearm: spec.armed === true });
80
81
  const bounty = new BossBounty(host, spec.body, spec.step);
82
+ host.events.on('world.slept', ({ seconds }) => { party.slept(seconds); }, host.scope);
81
83
  const ports = { events: host.events, player: party.player,
82
84
  lockInput: (on: boolean) => { if (actRoutes(host).introLocks === true) for (const player of host.players.values()) if (!on || spec.script.inArena(player.position)) player.moveScale = on ? 0 : 1; },
83
85
  skipHeld: () => actRoutes(host).skipHeld, respawn: party.respawn, faceToward: party.faceToward,
@@ -93,7 +95,7 @@ export function installBossRow(host: SimHost, spec: BossRowSpec): { boss: BossBr
93
95
  if (spec.armed === true) boss.arm();
94
96
  host.onStep(spec.step, dt => {
95
97
  const body = spec.body(); if (body !== null) host.focusOn(body.position);
96
- party.observe(boss);
98
+ party.observe(boss, dt);
97
99
  boss.update(dt, host.clock.now);
98
100
  }, {
99
101
  snapshot: () => { const { engaged } = party, { earned } = bounty; return JSON.stringify({ version: spec.stages === undefined ? 1 : 2, boss: boss.snapshot(), fight: spec.fight.snapshot(), ...(engaged === 0 ? {} : { engaged }), ...(earned.length === 0 ? {} : { earners: earned }) }); },
@@ -156,6 +156,8 @@ export function installHomeKeeper(host: SimHost, spec: HomeKeeperSpec, saved?: R
156
156
  const freeBody = (body: Body): void => { if (body.actor) { holders.delete(body.actor); host.retire(body.id); body.actor = null; body.brain = null; } };
157
157
  const respawn = (home: Home): void => { home.wait = 0; drawBody(home); };
158
158
  host.events.on('actor.died', ({ actor }) => { const home = homes.find(h => h.actor?.combatActor() === actor); if (home) home.wait = home.respawn; }, host.scope);
159
+ // SC10: a cell asleep with nobody in it: a fallen home's wait spends the time (it still respawns on its next tick, never asleep)
160
+ host.events.on('world.slept', ({ seconds }) => { for (const home of homes) if (home.wait > 0) home.wait = Math.max(Number.MIN_VALUE, home.wait - seconds); }, host.scope);
159
161
  host.onStep(step, dt => {
160
162
  // A boss's fight ends on blows, never on the plane: its flight follows a player down, and a fall would pay it out unstruck.
161
163
  // A held boss is a home body: under the plane it goes back to its anchor, never dies of it (HS3).
@@ -330,7 +332,7 @@ export function createNativeCreatureRoster<B extends NativeCreatureSlot>(host: S
330
332
  /** Identity lifecycle above the native body map, including dormant prewarm and permanent retirement. */
331
333
  identities: NativeActors<HuntBody>;
332
334
  /** Bind declared return rules to this roster's real identities and death events. */
333
- returns: (rows: unknown) => NativeReturns;
335
+ returns: (rows: unknown, reserved?: (id: string) => boolean) => NativeReturns;
334
336
  /** Advance native charge motion and report whether an owned live policy may move. */
335
337
  beforeBody: (id: string, dt: number) => boolean;
336
338
  /** Integrate the admitted pose, charge contact and hunted-body clearance in order. */
@@ -478,7 +480,7 @@ export function createNativeCreatureRoster<B extends NativeCreatureSlot>(host: S
478
480
  const level = saved.entities.find(entity => entity.id === item.id)?.state.flags.levelGround;
479
481
  return materialize(item, item.recipe, level ?? found.structure);
480
482
  };
481
- const returns = (input: unknown): NativeReturns => new NativeReturns(host, byId, hunt, input);
483
+ const returns = (input: unknown, reserved?: (id: string) => boolean): NativeReturns => new NativeReturns(host, byId, hunt, input, reserved);
482
484
  let poseNear = false;
483
485
  const beforeBody = (id: string, dt: number): boolean => {
484
486
  const actor = byId.get(id)?.actor;
@@ -23,7 +23,7 @@ import { simPlayerCommand, MAX_TICK_SNAPSHOT_CHARS, type HeadlessEffect, type He
23
23
  import { headlessSections } from '../../../shared/host/headlessSections';
24
24
  import { scriptAdmissionRows } from '@wildshard/format/scriptContract';
25
25
  import { validateShardfileAssets } from '@wildshard/format/assetAdmission';
26
- import { offlineMemoryAdmission, prepareAssetDecoders } from '@wildshard/format/product';
26
+ import { offlineMemoryAdmission, prepareAssetDecoders } from '@wildshard/format/shardfileAssets';
27
27
  import { leadCommands, leadPlayer } from '@wildshard/engine/sim/leadPlayer';
28
28
 
29
29
  await runTickWorker(async raw => {