castle-web-cli 0.4.232 → 0.4.234

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 (587) hide show
  1. package/dist/agent-failures.d.ts +8 -0
  2. package/dist/agent-failures.js +19 -2
  3. package/dist/agent-prompts.d.ts +1 -1
  4. package/dist/agent-prompts.js +10 -3
  5. package/dist/agent.d.ts +64 -3
  6. package/dist/agent.js +170 -81
  7. package/dist/api.d.ts +11 -0
  8. package/dist/api.js +43 -0
  9. package/dist/bundle.d.ts +64 -0
  10. package/dist/bundle.js +558 -2
  11. package/dist/castle-host/host.d.ts +18 -2
  12. package/dist/castle-host/host.js +844 -39
  13. package/dist/castleJson.d.ts +23 -2
  14. package/dist/castleJson.js +46 -2
  15. package/dist/check.d.ts +3 -1
  16. package/dist/check.js +20 -3
  17. package/dist/chunkLoader.d.ts +3 -0
  18. package/dist/chunkLoader.js +111 -0
  19. package/dist/devParty.d.ts +26 -0
  20. package/dist/devParty.js +231 -0
  21. package/dist/devSaveStorage.js +4 -0
  22. package/dist/devSessionStorage.js +50 -2
  23. package/dist/devSocial.d.ts +24 -0
  24. package/dist/devSocial.js +70 -0
  25. package/dist/ide.d.ts +2 -0
  26. package/dist/ide.js +119 -15
  27. package/dist/importPinMismatch.d.ts +22 -0
  28. package/dist/importPinMismatch.js +77 -0
  29. package/dist/importRegression.js +3 -15
  30. package/dist/imports.d.ts +10 -3
  31. package/dist/imports.js +88 -20
  32. package/dist/index.js +11 -4
  33. package/dist/init.js +1 -1
  34. package/dist/platformDoc.js +22 -0
  35. package/dist/routerFences.d.ts +5 -0
  36. package/dist/routerFences.js +12 -2
  37. package/dist/save-deck.d.ts +25 -1
  38. package/dist/save-deck.js +178 -9
  39. package/dist/serve.js +32 -11
  40. package/dist/shell/assets/{index-D2tWM896.js → index-DulbYIJm.js} +97 -97
  41. package/dist/shell/assets/index-MVLfNYd9.css +1 -0
  42. package/dist/shell/index.html +2 -2
  43. package/dist/taskSteer.d.ts +13 -0
  44. package/dist/taskSteer.js +22 -2
  45. package/dist/vitePlugins.d.ts +2 -1
  46. package/dist/vitePlugins.js +13 -0
  47. package/kits/base/castle.json +1 -1
  48. package/kits/base/package-lock.json +1 -1
  49. package/kits/base/sdk/README.md +339 -5
  50. package/kits/base/sdk/avatar.d.ts +6 -2
  51. package/kits/base/sdk/avatar.js +12 -4
  52. package/kits/base/sdk/castle.d.ts +7 -3
  53. package/kits/base/sdk/castle.js +2 -0
  54. package/kits/base/sdk/commands.d.ts +176 -1
  55. package/kits/base/sdk/commands.js +3 -0
  56. package/kits/base/sdk/display.d.ts +3 -0
  57. package/kits/base/sdk/display.js +9 -3
  58. package/kits/base/sdk/hub.d.ts +37 -6
  59. package/kits/base/sdk/hub.js +63 -4
  60. package/kits/base/sdk/multiplayer.d.ts +7 -1
  61. package/kits/base/sdk/multiplayer.js +148 -32
  62. package/kits/base/sdk/multiplayerProtocol.d.ts +2 -0
  63. package/kits/base/sdk/party.d.ts +23 -0
  64. package/kits/base/sdk/party.js +91 -0
  65. package/kits/base/sdk/reconnectBudget.d.ts +23 -0
  66. package/kits/base/sdk/reconnectBudget.js +96 -0
  67. package/kits/base/sdk/save.d.ts +38 -1
  68. package/kits/base/sdk/save.js +81 -7
  69. package/kits/base/sdk/server/hub.d.ts +117 -0
  70. package/kits/base/sdk/server/hub.js +119 -2
  71. package/kits/base/sdk/server/platformHandle.d.ts +43 -1
  72. package/kits/base/sdk/server/storage.d.ts +17 -0
  73. package/kits/base/sdk/server/storage.js +65 -3
  74. package/kits/base/sdk/server/wrapper.d.ts +43 -6
  75. package/kits/base/sdk/server/wrapper.js +93 -9
  76. package/kits/base/sdk/social.d.ts +9 -0
  77. package/kits/base/sdk/social.js +5 -0
  78. package/kits/hub-game/CLAUDE.md +451 -13
  79. package/kits/hub-game/README.md +63 -0
  80. package/kits/hub-game/blueprints/avatar-10.scene +28 -0
  81. package/kits/hub-game/blueprints/avatar-11.scene +28 -0
  82. package/kits/hub-game/blueprints/avatar-12.scene +28 -0
  83. package/kits/hub-game/blueprints/avatar-13.scene +28 -0
  84. package/kits/hub-game/blueprints/avatar-14.scene +28 -0
  85. package/kits/hub-game/blueprints/avatar-15.scene +28 -0
  86. package/kits/hub-game/blueprints/avatar-4.scene +28 -0
  87. package/kits/hub-game/blueprints/avatar-5.scene +28 -0
  88. package/kits/hub-game/blueprints/avatar-6.scene +28 -0
  89. package/kits/hub-game/blueprints/avatar-7.scene +28 -0
  90. package/kits/hub-game/blueprints/avatar-8.scene +28 -0
  91. package/kits/hub-game/blueprints/avatar-9.scene +28 -0
  92. package/kits/hub-game/castle.json +5 -5
  93. package/kits/hub-game/code/client/act.js +312 -0
  94. package/kits/hub-game/code/client/actionLayout.js +147 -0
  95. package/kits/hub-game/code/client/actionOverflow.js +556 -0
  96. package/kits/hub-game/code/client/actorBudget.js +47 -0
  97. package/kits/hub-game/code/client/arrivalCamera.js +50 -0
  98. package/kits/hub-game/code/client/askSlot.js +117 -0
  99. package/kits/hub-game/code/client/attention.js +11 -2
  100. package/kits/hub-game/code/client/avatar.js +311 -35
  101. package/kits/hub-game/code/client/avatarCap.js +228 -0
  102. package/kits/hub-game/code/client/avatarColors.js +70 -0
  103. package/kits/hub-game/code/client/avatarFaces.js +21 -0
  104. package/kits/hub-game/code/client/avatarShare.js +253 -0
  105. package/kits/hub-game/code/client/backVisibility.js +13 -0
  106. package/kits/hub-game/code/client/ballot.js +472 -0
  107. package/kits/hub-game/code/client/build.js +38 -0
  108. package/kits/hub-game/code/client/chat.js +41 -5
  109. package/kits/hub-game/code/client/chatModeration.js +5 -0
  110. package/kits/hub-game/code/client/chrome.js +2144 -160
  111. package/kits/hub-game/code/client/companion.js +716 -0
  112. package/kits/hub-game/code/client/companionDress.js +99 -0
  113. package/kits/hub-game/code/client/crowdNames.js +241 -0
  114. package/kits/hub-game/code/client/decor.js +515 -0
  115. package/kits/hub-game/code/client/defaultEnvironment.js +194 -0
  116. package/kits/hub-game/code/client/doorErrors.js +39 -0
  117. package/kits/hub-game/code/client/earned.js +131 -0
  118. package/kits/hub-game/code/client/emoteBubble.js +75 -0
  119. package/kits/hub-game/code/client/fall.js +18 -0
  120. package/kits/hub-game/code/client/farAvatars.js +233 -0
  121. package/kits/hub-game/code/client/firstJoin.js +9 -2
  122. package/kits/hub-game/code/client/fpsTelemetry.js +50 -0
  123. package/kits/hub-game/code/client/frameBatch.js +5 -0
  124. package/kits/hub-game/code/client/grab.js +368 -29
  125. package/kits/hub-game/code/client/hookLayer.js +385 -20
  126. package/kits/hub-game/code/client/hudCopy.js +51 -0
  127. package/kits/hub-game/code/client/hudRate.js +20 -0
  128. package/kits/hub-game/code/client/idle.js +177 -24
  129. package/kits/hub-game/code/client/interestCap.js +81 -0
  130. package/kits/hub-game/code/client/invites.js +231 -0
  131. package/kits/hub-game/code/client/joinError.js +9 -0
  132. package/kits/hub-game/code/client/keys.js +36 -0
  133. package/kits/hub-game/code/client/labelsNear.js +234 -0
  134. package/kits/hub-game/code/client/landscapeLayout.js +17 -0
  135. package/kits/hub-game/code/client/layoutCache.js +264 -0
  136. package/kits/hub-game/code/client/loadTelemetry.js +20 -0
  137. package/kits/hub-game/code/client/loadingCover.js +148 -0
  138. package/kits/hub-game/code/client/loadingEntry.js +8 -0
  139. package/kits/hub-game/code/client/menuIcons.js +34 -0
  140. package/kits/hub-game/code/client/menuRows.js +43 -0
  141. package/kits/hub-game/code/client/modelReady.js +7 -0
  142. package/kits/hub-game/code/client/pack.js +6 -2
  143. package/kits/hub-game/code/client/packFormat.js +3 -3
  144. package/kits/hub-game/code/client/padCueArrival.js +23 -0
  145. package/kits/hub-game/code/client/padCues.js +112 -0
  146. package/kits/hub-game/code/client/padOccupancy.js +88 -0
  147. package/kits/hub-game/code/client/padReadability.js +26 -0
  148. package/kits/hub-game/code/client/padRings.js +69 -0
  149. package/kits/hub-game/code/client/pushVisit.js +14 -0
  150. package/kits/hub-game/code/client/quality.js +205 -0
  151. package/kits/hub-game/code/client/qualityEntry.js +55 -0
  152. package/kits/hub-game/code/client/rehello.js +167 -0
  153. package/kits/hub-game/code/client/safeLayout.js +338 -0
  154. package/kits/hub-game/code/client/safeStyle.js +42 -0
  155. package/kits/hub-game/code/client/say.js +12 -3
  156. package/kits/hub-game/code/client/shot.js +146 -0
  157. package/kits/hub-game/code/client/shotFit.js +56 -0
  158. package/kits/hub-game/code/client/signIn.js +28 -0
  159. package/kits/hub-game/code/client/sound.js +63 -8
  160. package/kits/hub-game/code/client/soundscape.js +1151 -0
  161. package/kits/hub-game/code/client/soundscapeActions.js +99 -0
  162. package/kits/hub-game/code/client/soundscapeAmbience.js +453 -0
  163. package/kits/hub-game/code/client/soundscapeBaked.js +143 -0
  164. package/kits/hub-game/code/client/soundscapeBusker.js +217 -0
  165. package/kits/hub-game/code/client/soundscapeCourt.js +200 -0
  166. package/kits/hub-game/code/client/soundscapeCrowd.js +331 -0
  167. package/kits/hub-game/code/client/soundscapeCues.js +362 -0
  168. package/kits/hub-game/code/client/soundscapeMap.js +181 -0
  169. package/kits/hub-game/code/client/soundscapeMarket.js +176 -0
  170. package/kits/hub-game/code/client/soundscapeMusic.js +126 -0
  171. package/kits/hub-game/code/client/soundscapeMusicEngine.js +460 -0
  172. package/kits/hub-game/code/client/soundscapeSimlish.js +737 -0
  173. package/kits/hub-game/code/client/soundscapeSongs.js +127 -0
  174. package/kits/hub-game/code/client/soundscapeSongsRound3.js +63 -0
  175. package/kits/hub-game/code/client/soundscapeSynthesis.js +168 -0
  176. package/kits/hub-game/code/client/soundscapeUi.js +211 -0
  177. package/kits/hub-game/code/client/soundscapeVoice.js +1209 -0
  178. package/kits/hub-game/code/client/soundscapeWaves.js +206 -0
  179. package/kits/hub-game/code/client/spin.js +101 -0
  180. package/kits/hub-game/code/client/state.js +162 -1
  181. package/kits/hub-game/code/client/stuck.js +259 -0
  182. package/kits/hub-game/code/client/talk.js +714 -59
  183. package/kits/hub-game/code/client/tiers.js +543 -52
  184. package/kits/hub-game/code/client/toastBand.js +37 -0
  185. package/kits/hub-game/code/client/together.js +39 -2
  186. package/kits/hub-game/code/client/visibility.js +43 -0
  187. package/kits/hub-game/code/client/weakestLookBake.js +92 -0
  188. package/kits/hub-game/code/client/weakestTier.js +295 -0
  189. package/kits/hub-game/code/client/wear.js +461 -170
  190. package/kits/hub-game/code/client/worldLabels.js +241 -0
  191. package/kits/hub-game/code/client/yours.js +200 -0
  192. package/kits/hub-game/code/companionSpec.js +45 -0
  193. package/kits/hub-game/code/npcDisplayText.js +55 -0
  194. package/kits/hub-game/code/privateText.js +7 -0
  195. package/kits/hub-game/code/server/act.js +124 -0
  196. package/kits/hub-game/code/server/actions.js +138 -0
  197. package/kits/hub-game/code/server/actors.js +11 -2
  198. package/kits/hub-game/code/server/analytics.js +83 -0
  199. package/kits/hub-game/code/server/anonymousEntry.js +49 -0
  200. package/kits/hub-game/code/server/arrivalPose.js +36 -0
  201. package/kits/hub-game/code/server/ask.js +155 -0
  202. package/kits/hub-game/code/server/ballot.js +539 -0
  203. package/kits/hub-game/code/server/cells.js +100 -0
  204. package/kits/hub-game/code/server/companion.js +107 -0
  205. package/kits/hub-game/code/server/cues.js +70 -0
  206. package/kits/hub-game/code/server/decor.js +269 -0
  207. package/kits/hub-game/code/server/doorAnalytics.js +52 -0
  208. package/kits/hub-game/code/server/earned.js +478 -0
  209. package/kits/hub-game/code/server/frameBatch.js +183 -0
  210. package/kits/hub-game/code/server/friendBests.js +166 -0
  211. package/kits/hub-game/code/server/friendsAmong.js +272 -0
  212. package/kits/hub-game/code/server/history.js +7 -0
  213. package/kits/hub-game/code/server/hub.js +2510 -95
  214. package/kits/hub-game/code/server/idle.js +60 -12
  215. package/kits/hub-game/code/server/index.js +28 -6
  216. package/kits/hub-game/code/server/invites.js +19 -0
  217. package/kits/hub-game/code/server/labels.js +36 -2
  218. package/kits/hub-game/code/server/loadAbandon.js +106 -0
  219. package/kits/hub-game/code/server/manifest.js +586 -7
  220. package/kits/hub-game/code/server/menu.js +161 -0
  221. package/kits/hub-game/code/server/npcs.js +1025 -113
  222. package/kits/hub-game/code/server/observe.js +408 -0
  223. package/kits/hub-game/code/server/padOccupancy.js +85 -0
  224. package/kits/hub-game/code/server/party.js +2 -2
  225. package/kits/hub-game/code/server/players.js +30 -0
  226. package/kits/hub-game/code/server/resumePose.js +152 -0
  227. package/kits/hub-game/code/server/say.js +1 -1
  228. package/kits/hub-game/code/server/shot.js +110 -0
  229. package/kits/hub-game/code/server/standing.js +123 -0
  230. package/kits/hub-game/code/server/storageLimit.js +187 -0
  231. package/kits/hub-game/code/server/vis.js +175 -0
  232. package/kits/hub-game/code/server/wear.js +12 -0
  233. package/kits/hub-game/code/server/yours.js +59 -0
  234. package/kits/hub-game/code/shared/act.js +35 -0
  235. package/kits/hub-game/code/shared/cues.js +9 -0
  236. package/kits/hub-game/code/shared/danceIdle.js +28 -0
  237. package/kits/hub-game/code/shared/decor.js +41 -0
  238. package/kits/hub-game/code/shared/loadStages.js +12 -0
  239. package/kits/hub-game/code/shared/quality.js +74 -0
  240. package/kits/hub-game/code/shared/say.js +2 -0
  241. package/kits/hub-game/code/shared/shot.js +53 -0
  242. package/kits/hub-game/code/shared/spin.js +57 -0
  243. package/kits/hub-game/code/systems/hub.js +1753 -202
  244. package/kits/hub-game/docs/analytics.md +279 -0
  245. package/kits/hub-game/docs/content-pack.md +1 -1
  246. package/kits/hub-game/docs/contract.md +3475 -77
  247. package/kits/hub-game/docs/home-pieces.md +71 -0
  248. package/kits/hub-game/docs/observed-progress.md +252 -0
  249. package/kits/hub-game/main.jsx +2 -0
  250. package/kits/hub-game/models/avatar-10.pxmodel +28 -0
  251. package/kits/hub-game/models/avatar-11.pxmodel +28 -0
  252. package/kits/hub-game/models/avatar-12.pxmodel +27 -0
  253. package/kits/hub-game/models/avatar-13.pxmodel +24 -0
  254. package/kits/hub-game/models/avatar-14.pxmodel +29 -0
  255. package/kits/hub-game/models/avatar-15.pxmodel +24 -0
  256. package/kits/hub-game/models/avatar-4.pxmodel +29 -0
  257. package/kits/hub-game/models/avatar-5.pxmodel +27 -0
  258. package/kits/hub-game/models/avatar-6.pxmodel +26 -0
  259. package/kits/hub-game/models/avatar-7.pxmodel +25 -0
  260. package/kits/hub-game/models/avatar-8.pxmodel +24 -0
  261. package/kits/hub-game/models/avatar-9.pxmodel +30 -0
  262. package/kits/hub-game/models/earned/badge-round.pxmodel +100 -0
  263. package/kits/hub-game/models/earned/badge-shield.pxmodel +117 -0
  264. package/kits/hub-game/models/earned/badge-star.pxmodel +87 -0
  265. package/kits/hub-game/models/earned/belt-plain.pxmodel +72 -0
  266. package/kits/hub-game/models/earned/held-ball.pxmodel +43 -0
  267. package/kits/hub-game/models/earned/held-lantern.pxmodel +85 -0
  268. package/kits/hub-game/models/earned/held-net.pxmodel +57 -0
  269. package/kits/hub-game/models/earned/held-trophy.pxmodel +109 -0
  270. package/kits/hub-game/models/earned/pin-round.pxmodel +62 -0
  271. package/kits/hub-game/models/earned/sash-plain.pxmodel +66 -0
  272. package/kits/hub-game/models/earned/square/belt-plain.pxmodel +104 -0
  273. package/kits/hub-game/models/earned/square/sash-plain.pxmodel +98 -0
  274. package/kits/hub-game/models/hats/bat-clip.pxmodel +206 -0
  275. package/kits/hub-game/models/hats/beekeeper.pxmodel +149 -0
  276. package/kits/hub-game/models/hats/cap.pxmodel +162 -0
  277. package/kits/hub-game/models/hats/captain.pxmodel +178 -0
  278. package/kits/hub-game/models/hats/crooked-top.pxmodel +172 -0
  279. package/kits/hub-game/models/hats/flower-crown.pxmodel +451 -0
  280. package/kits/hub-game/models/hats/foam-crown.pxmodel +179 -0
  281. package/kits/hub-game/models/hats/lantern.pxmodel +230 -0
  282. package/kits/hub-game/models/hats/laurel.pxmodel +533 -0
  283. package/kits/hub-game/models/hats/lighthouse.pxmodel +96 -0
  284. package/kits/hub-game/models/hats/sailor.pxmodel +141 -0
  285. package/kits/hub-game/models/hats/souwester.pxmodel +131 -0
  286. package/kits/hub-game/models/hats/straw.pxmodel +139 -0
  287. package/kits/hub-game/models/hats/sunflower.pxmodel +406 -0
  288. package/kits/hub-game/models/hats/sweatband.pxmodel +112 -0
  289. package/kits/hub-game/models/hats/witch.pxmodel +147 -0
  290. package/kits/hub-game/package-lock.json +10 -1
  291. package/kits/hub-game/package.json +6 -2
  292. package/kits/hub-game/play/player.js +142 -0
  293. package/kits/hub-game/play/registry.js +47 -0
  294. package/kits/hub-game/play.jsx +37 -0
  295. package/kits/hub-game/scripts/check.mjs +117 -16
  296. package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
  297. package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +132 -0
  298. package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
  299. package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +26 -0
  300. package/kits/hub-game/scripts/fixtures/fake-dom.mjs +123 -0
  301. package/kits/hub-game/scripts/fixtures/interest-legacy.json +385 -0
  302. package/kits/hub-game/scripts/fixtures/npc-notes-v1.77.jsonl +4 -0
  303. package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -0
  304. package/kits/hub-game/scripts/gen-avatars.mjs +933 -16
  305. package/kits/hub-game/scripts/gen-earned.mjs +285 -0
  306. package/kits/hub-game/scripts/gen-hats.mjs +827 -0
  307. package/kits/hub-game/scripts/grab.before-orbit.mjs +400 -0
  308. package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -0
  309. package/kits/hub-game/scripts/soundscape-wave-analysis.mjs +125 -0
  310. package/kits/hub-game/scripts/test-act-client.mjs +186 -0
  311. package/kits/hub-game/scripts/test-act.mjs +171 -0
  312. package/kits/hub-game/scripts/test-action-layout.mjs +80 -0
  313. package/kits/hub-game/scripts/test-action-observers.mjs +46 -0
  314. package/kits/hub-game/scripts/test-actions-client.mjs +853 -0
  315. package/kits/hub-game/scripts/test-actions.mjs +298 -0
  316. package/kits/hub-game/scripts/test-actor-budget.mjs +44 -0
  317. package/kits/hub-game/scripts/test-actors.mjs +38 -23
  318. package/kits/hub-game/scripts/test-analytics.mjs +76 -0
  319. package/kits/hub-game/scripts/test-anonymous-entry.mjs +28 -0
  320. package/kits/hub-game/scripts/test-arrival-pose-server.mjs +196 -0
  321. package/kits/hub-game/scripts/test-arrival-pose.mjs +24 -0
  322. package/kits/hub-game/scripts/test-ask-client.mjs +358 -0
  323. package/kits/hub-game/scripts/test-ask-slot.mjs +85 -0
  324. package/kits/hub-game/scripts/test-ask.mjs +269 -0
  325. package/kits/hub-game/scripts/test-attention.mjs +10 -1
  326. package/kits/hub-game/scripts/test-avatar-cap.mjs +379 -0
  327. package/kits/hub-game/scripts/test-avatar-colors.mjs +72 -0
  328. package/kits/hub-game/scripts/test-avatar-models.mjs +181 -0
  329. package/kits/hub-game/scripts/test-avatar-share.mjs +318 -0
  330. package/kits/hub-game/scripts/test-avatar-wire.mjs +792 -0
  331. package/kits/hub-game/scripts/test-avatar.mjs +584 -7
  332. package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
  333. package/kits/hub-game/scripts/test-ballot.mjs +1008 -0
  334. package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
  335. package/kits/hub-game/scripts/test-build.mjs +49 -0
  336. package/kits/hub-game/scripts/test-cells.mjs +71 -0
  337. package/kits/hub-game/scripts/test-chat.mjs +863 -0
  338. package/kits/hub-game/scripts/test-classic.mjs +2 -0
  339. package/kits/hub-game/scripts/test-companion-chat.mjs +216 -0
  340. package/kits/hub-game/scripts/test-companion-client.mjs +1167 -0
  341. package/kits/hub-game/scripts/test-companion.mjs +259 -0
  342. package/kits/hub-game/scripts/test-control-layout-dom.mjs +120 -0
  343. package/kits/hub-game/scripts/test-crowd-names.mjs +205 -0
  344. package/kits/hub-game/scripts/test-decor-client.mjs +344 -0
  345. package/kits/hub-game/scripts/test-decor.mjs +464 -0
  346. package/kits/hub-game/scripts/test-default-environment-root.mjs +95 -0
  347. package/kits/hub-game/scripts/test-default-environment.mjs +267 -0
  348. package/kits/hub-game/scripts/test-door-analytics.mjs +58 -0
  349. package/kits/hub-game/scripts/test-door-jump.mjs +100 -0
  350. package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
  351. package/kits/hub-game/scripts/test-earned.mjs +1224 -0
  352. package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
  353. package/kits/hub-game/scripts/test-far-avatars.mjs +340 -0
  354. package/kits/hub-game/scripts/test-fps-telemetry.mjs +112 -0
  355. package/kits/hub-game/scripts/test-frame-batch.mjs +252 -0
  356. package/kits/hub-game/scripts/test-fresh-friends.mjs +118 -0
  357. package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
  358. package/kits/hub-game/scripts/test-grab-orbit.mjs +961 -0
  359. package/kits/hub-game/scripts/test-grab.mjs +7 -0
  360. package/kits/hub-game/scripts/test-hats.mjs +422 -168
  361. package/kits/hub-game/scripts/test-high-only.mjs +170 -0
  362. package/kits/hub-game/scripts/test-hub-leaving.mjs +203 -0
  363. package/kits/hub-game/scripts/test-hub-ops.mjs +758 -2
  364. package/kits/hub-game/scripts/test-hub-trip.mjs +1594 -12
  365. package/kits/hub-game/scripts/test-hud-clear.mjs +484 -57
  366. package/kits/hub-game/scripts/test-hud-defects-dom.mjs +100 -0
  367. package/kits/hub-game/scripts/test-hud-rate.mjs +224 -0
  368. package/kits/hub-game/scripts/test-hud-safe-visibility-dom.mjs +83 -0
  369. package/kits/hub-game/scripts/test-idle.mjs +427 -1
  370. package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
  371. package/kits/hub-game/scripts/test-interest-cells.mjs +513 -0
  372. package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
  373. package/kits/hub-game/scripts/test-interest.mjs +15 -0
  374. package/kits/hub-game/scripts/test-invites-client.mjs +430 -0
  375. package/kits/hub-game/scripts/test-invites.mjs +109 -0
  376. package/kits/hub-game/scripts/test-keys.mjs +46 -1
  377. package/kits/hub-game/scripts/test-labels.mjs +664 -0
  378. package/kits/hub-game/scripts/test-landscape-layout.mjs +194 -0
  379. package/kits/hub-game/scripts/test-list-scroll-dom.mjs +49 -0
  380. package/kits/hub-game/scripts/test-load-abandon.mjs +246 -0
  381. package/kits/hub-game/scripts/test-loading-cover.mjs +162 -0
  382. package/kits/hub-game/scripts/test-manifest.mjs +472 -0
  383. package/kits/hub-game/scripts/test-menu-client.mjs +585 -0
  384. package/kits/hub-game/scripts/test-menu.mjs +319 -0
  385. package/kits/hub-game/scripts/test-npcs.mjs +2528 -13
  386. package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
  387. package/kits/hub-game/scripts/test-observed.mjs +745 -0
  388. package/kits/hub-game/scripts/test-pack.mjs +7 -0
  389. package/kits/hub-game/scripts/test-pad-cues.mjs +304 -0
  390. package/kits/hub-game/scripts/test-pad-occupancy.mjs +177 -0
  391. package/kits/hub-game/scripts/test-picker.mjs +541 -0
  392. package/kits/hub-game/scripts/test-placement-cache.mjs +690 -0
  393. package/kits/hub-game/scripts/test-progress-reset.mjs +559 -0
  394. package/kits/hub-game/scripts/test-push-visit.mjs +26 -0
  395. package/kits/hub-game/scripts/test-quality.mjs +385 -0
  396. package/kits/hub-game/scripts/test-rehello.mjs +1733 -0
  397. package/kits/hub-game/scripts/test-relations-among.mjs +222 -0
  398. package/kits/hub-game/scripts/test-relations-refresh.mjs +188 -0
  399. package/kits/hub-game/scripts/test-resume-action-order.mjs +598 -0
  400. package/kits/hub-game/scripts/test-resume-held.mjs +239 -0
  401. package/kits/hub-game/scripts/test-resume-pose.mjs +142 -0
  402. package/kits/hub-game/scripts/test-safe-events-dom.mjs +116 -0
  403. package/kits/hub-game/scripts/test-safe-layout.mjs +330 -0
  404. package/kits/hub-game/scripts/test-say.mjs +1 -1
  405. package/kits/hub-game/scripts/test-shot.mjs +901 -0
  406. package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
  407. package/kits/hub-game/scripts/test-soundscape.mjs +5437 -0
  408. package/kits/hub-game/scripts/test-spin.mjs +314 -0
  409. package/kits/hub-game/scripts/test-standing.mjs +449 -0
  410. package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
  411. package/kits/hub-game/scripts/test-stuck.mjs +1904 -0
  412. package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
  413. package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
  414. package/kits/hub-game/scripts/test-tiers-render.mjs +412 -0
  415. package/kits/hub-game/scripts/test-tiers.mjs +476 -2
  416. package/kits/hub-game/scripts/test-toast-band.mjs +61 -0
  417. package/kits/hub-game/scripts/test-try-on.mjs +22 -22
  418. package/kits/hub-game/scripts/test-vis.mjs +770 -0
  419. package/kits/hub-game/scripts/test-visibility.mjs +134 -0
  420. package/kits/hub-game/scripts/test-weakest-tier.mjs +924 -0
  421. package/kits/hub-game/scripts/test-world-labels.mjs +367 -0
  422. package/kits/hub-game/scripts/test-yours-chrome.mjs +210 -0
  423. package/kits/hub-game/scripts/test-yours.mjs +403 -0
  424. package/kits/multiplayer-3d/CLAUDE.md +50 -0
  425. package/kits/multiplayer-3d/castle.json +5 -5
  426. package/kits/multiplayer-3d/code/client/avatars.js +7 -0
  427. package/kits/multiplayer-3d/code/client/gait.js +65 -0
  428. package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
  429. package/kits/multiplayer-3d/code/client/nameTags.js +59 -4
  430. package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
  431. package/kits/multiplayer-3d/code/options.js +5 -0
  432. package/kits/multiplayer-3d/code/server/ownership.js +10 -2
  433. package/kits/multiplayer-3d/code/server/sceneBodies.js +12 -0
  434. package/kits/multiplayer-3d/code/server/world.js +7 -0
  435. package/kits/multiplayer-3d/code/systems/multiplayer.js +443 -34
  436. package/kits/multiplayer-3d/package-lock.json +8 -1
  437. package/kits/multiplayer-3d/package.json +3 -1
  438. package/kits/multiplayer-3d/scripts/fixtures/README.md +11 -0
  439. package/kits/multiplayer-3d/scripts/fixtures/ownership-legacy.json +2 -0
  440. package/kits/multiplayer-3d/scripts/ownership-harness.mjs +102 -0
  441. package/kits/multiplayer-3d/scripts/ownership-loader.mjs +46 -0
  442. package/kits/multiplayer-3d/scripts/ownership-worker.mjs +15 -0
  443. package/kits/multiplayer-3d/scripts/record-ownership-session.mjs +98 -0
  444. package/kits/multiplayer-3d/scripts/test-eligible-claims.mjs +167 -0
  445. package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
  446. package/kits/multiplayer-3d/scripts/test-own-name-tag.mjs +247 -0
  447. package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
  448. package/kits/physics-2d/CLAUDE.md +19 -1
  449. package/kits/physics-2d/castle.json +2 -2
  450. package/kits/physics-2d/engine/frozenActors.js +233 -0
  451. package/kits/physics-2d/engine/scene.js +337 -3
  452. package/kits/physics-2d/engine/skyKey.js +129 -0
  453. package/kits/physics-2d/engine/stillClock.js +106 -0
  454. package/kits/physics-2d/engine/updateBudget.js +21 -0
  455. package/kits/physics-2d/eslint.config.js +1 -1
  456. package/kits/physics-2d/play/behaviors/AnalogStick.js +198 -0
  457. package/kits/physics-2d/play/behaviors/Camera.js +40 -0
  458. package/kits/physics-2d/play/behaviors/Collider.js +122 -0
  459. package/kits/physics-2d/play/behaviors/Draggable.js +115 -0
  460. package/kits/physics-2d/play/behaviors/Goal.js +46 -0
  461. package/kits/physics-2d/play/behaviors/Joints.js +126 -0
  462. package/kits/physics-2d/play/behaviors/Layout.js +71 -0
  463. package/kits/physics-2d/play/behaviors/RigidBody.js +57 -0
  464. package/kits/physics-2d/play/behaviors/Slingshot.js +142 -0
  465. package/kits/physics-2d/play/behaviors/SoundPlayer.js +263 -0
  466. package/kits/physics-2d/play/behaviors/Sprite.js +406 -0
  467. package/kits/physics-2d/play/behaviors/Style.js +209 -0
  468. package/kits/physics-2d/play/behaviors/Text.js +85 -0
  469. package/kits/physics-2d/play/behaviors/Video.js +93 -0
  470. package/kits/physics-2d/scripts/test-skip-unchanged.mjs +326 -1
  471. package/kits/physics-3d/CLAUDE.md +42 -529
  472. package/kits/physics-3d/behaviors/Body.jsx +3 -0
  473. package/kits/physics-3d/behaviors/Model.jsx +3 -0
  474. package/kits/physics-3d/behaviors/Player.jsx +661 -87
  475. package/kits/physics-3d/behaviors/Shape.jsx +3 -0
  476. package/kits/physics-3d/behaviors/Solid.jsx +3 -0
  477. package/kits/physics-3d/behaviors/Transform.jsx +3 -0
  478. package/kits/physics-3d/castle.json +3 -3
  479. package/kits/physics-3d/docs/engine-camera.md +542 -0
  480. package/kits/physics-3d/docs/engine-frame-cap.md +136 -0
  481. package/kits/physics-3d/docs/engine-load.md +149 -0
  482. package/kits/physics-3d/docs/engine-look.md +114 -0
  483. package/kits/physics-3d/docs/engine-shadows.md +372 -0
  484. package/kits/physics-3d/docs/engine-skip-work.md +187 -0
  485. package/kits/physics-3d/docs/engine-sky.md +198 -0
  486. package/kits/physics-3d/docs/engine-static-actors.md +226 -0
  487. package/kits/physics-3d/docs/engine-view.md +37 -0
  488. package/kits/physics-3d/docs/pxmodel-format.md +9 -1
  489. package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
  490. package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -277
  491. package/kits/physics-3d/engine3d/actornode.js +87 -0
  492. package/kits/physics-3d/engine3d/animationBudget.js +23 -0
  493. package/kits/physics-3d/engine3d/branches.js +3 -13
  494. package/kits/physics-3d/engine3d/cage.js +2 -7
  495. package/kits/physics-3d/engine3d/cageops.js +2 -17
  496. package/kits/physics-3d/engine3d/dataBehaviors.js +12 -0
  497. package/kits/physics-3d/engine3d/editorWorld.js +6 -0
  498. package/kits/physics-3d/engine3d/emptynodes.js +232 -0
  499. package/kits/physics-3d/engine3d/framecap.js +99 -0
  500. package/kits/physics-3d/engine3d/frozenphysics.js +140 -0
  501. package/kits/physics-3d/engine3d/frozenstatics.js +273 -0
  502. package/kits/physics-3d/engine3d/gait.js +126 -0
  503. package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
  504. package/kits/physics-3d/engine3d/kithooks.js +47 -0
  505. package/kits/physics-3d/engine3d/look.js +514 -48
  506. package/kits/physics-3d/engine3d/lookbake.js +208 -0
  507. package/kits/physics-3d/engine3d/materialpresets.js +2 -0
  508. package/kits/physics-3d/engine3d/modelFiles.js +3 -17
  509. package/kits/physics-3d/engine3d/modelMath.js +49 -0
  510. package/kits/physics-3d/engine3d/modelready.js +16 -0
  511. package/kits/physics-3d/engine3d/motion.js +39 -10
  512. package/kits/physics-3d/engine3d/nearshadows.js +106 -21
  513. package/kits/physics-3d/engine3d/optimize.js +9 -5
  514. package/kits/physics-3d/engine3d/orbitinput.js +522 -10
  515. package/kits/physics-3d/engine3d/orbitlens.js +48 -0
  516. package/kits/physics-3d/engine3d/ownmodel.js +213 -0
  517. package/kits/physics-3d/engine3d/partgeometry.js +1 -16
  518. package/kits/physics-3d/engine3d/paths.js +1 -9
  519. package/kits/physics-3d/engine3d/playTimings.js +50 -0
  520. package/kits/physics-3d/engine3d/playerRun.js +372 -0
  521. package/kits/physics-3d/engine3d/pxmodel.js +42 -11
  522. package/kits/physics-3d/engine3d/rapier.js +27 -0
  523. package/kits/physics-3d/engine3d/scatter.js +1 -11
  524. package/kits/physics-3d/engine3d/shadowfade.js +890 -0
  525. package/kits/physics-3d/engine3d/sky.js +547 -0
  526. package/kits/physics-3d/engine3d/skylife.js +306 -0
  527. package/kits/physics-3d/engine3d/squarefirst.js +177 -0
  528. package/kits/physics-3d/engine3d/stillshadows.js +399 -0
  529. package/kits/physics-3d/engine3d/sweep.js +1 -25
  530. package/kits/physics-3d/engine3d/unchanged.js +11 -0
  531. package/kits/physics-3d/engine3d/viewrange.js +52 -0
  532. package/kits/physics-3d/engine3d/world3d.js +1253 -76
  533. package/kits/physics-3d/eslint.config.js +2 -1
  534. package/kits/physics-3d/main.jsx +10 -2
  535. package/kits/physics-3d/package-lock.json +7 -0
  536. package/kits/physics-3d/package.json +5 -1
  537. package/kits/physics-3d/play/behaviors/Body.js +31 -0
  538. package/kits/physics-3d/play/behaviors/Door.js +37 -0
  539. package/kits/physics-3d/play/behaviors/Lookable.js +16 -0
  540. package/kits/physics-3d/play/behaviors/Model.js +23 -0
  541. package/kits/physics-3d/play/behaviors/Pickup.js +46 -0
  542. package/kits/physics-3d/play/behaviors/Player.js +1204 -0
  543. package/kits/physics-3d/play/behaviors/Shape.js +47 -0
  544. package/kits/physics-3d/play/behaviors/Solid.js +16 -0
  545. package/kits/physics-3d/play/behaviors/Transform.js +29 -0
  546. package/kits/physics-3d/pnpm-lock.yaml +8 -0
  547. package/kits/physics-3d/scripts/bench-shadow-fade.mjs +37 -0
  548. package/kits/physics-3d/scripts/build-rapier-gz.mjs +56 -0
  549. package/kits/physics-3d/scripts/frozen-statics-fixture.mjs +141 -0
  550. package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
  551. package/kits/physics-3d/scripts/test-camera-follow.mjs +5 -1
  552. package/kits/physics-3d/scripts/test-camera-orbit.mjs +2613 -82
  553. package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +2 -2
  554. package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
  555. package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +438 -0
  556. package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -0
  557. package/kits/physics-3d/scripts/test-frozen-nested.mjs +49 -0
  558. package/kits/physics-3d/scripts/test-frozen-statics-legacy-physics2d.mjs +123 -0
  559. package/kits/physics-3d/scripts/test-frozen-statics.mjs +434 -0
  560. package/kits/physics-3d/scripts/test-gait.mjs +387 -0
  561. package/kits/physics-3d/scripts/test-look-bake.mjs +1056 -0
  562. package/kits/physics-3d/scripts/test-model-parse-cache.mjs +92 -0
  563. package/kits/physics-3d/scripts/test-near-shadows.mjs +5 -2
  564. package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +2001 -0
  565. package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +582 -0
  566. package/kits/physics-3d/scripts/test-orbit-shot.mjs +657 -0
  567. package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -0
  568. package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
  569. package/kits/physics-3d/scripts/test-skip-empty-nodes.mjs +845 -0
  570. package/kits/physics-3d/scripts/test-sky.mjs +2470 -0
  571. package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
  572. package/kits/physics-3d/scripts/test-static-actors.mjs +10 -1
  573. package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
  574. package/kits/physics-3d/scripts/test-static-scenery.mjs +2174 -0
  575. package/kits/physics-3d/scripts/test-steady-hover.mjs +7 -2
  576. package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
  577. package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
  578. package/kits/physics-3d/systems/physics3d.js +419 -9
  579. package/kits/real-time/castle.json +2 -2
  580. package/kits/real-time/code/client/connection.js +33 -10
  581. package/kits/real-time/code/client/gameHooks.js +2 -0
  582. package/kits/real-time/code/client/joinOverlay.js +9 -4
  583. package/kits/real-time/code/server/gameHooks.js +7 -0
  584. package/kits/real-time/code/server/session.js +102 -22
  585. package/kits/real-time/package-lock.json +1 -1
  586. package/package.json +2 -2
  587. package/dist/shell/assets/index-Cf61cNfT.css +0 -1
@@ -7,14 +7,84 @@
7
7
  import * as castleSdk from 'castle-web-sdk';
8
8
  import * as Avatars from '@imports/castle.multiplayer-3d/code/client/avatars.js';
9
9
  import * as Avatar from './avatar.js';
10
+ import * as AvatarCap from './avatarCap.js';
11
+ import { mergeDictionary } from './interestCap.js';
10
12
  import * as Cabinets from './cabinets.js';
11
13
  import { firstJoinFor } from './firstJoin.js';
12
- import { deck, hub, wearingNow } from './state.js';
14
+ import { deck, earnedNow, hub, localArrival, mergeHidden, receiveParty, wearingNow } from './state.js';
15
+ import { clearShot, receiveShot } from './shot.js';
16
+ import * as Ballot from './ballot.js';
17
+ import * as Rehello from './rehello.js';
18
+ import { guestName } from './signIn.js';
19
+ import { sanitise, ownStamp } from './companion.js';
20
+ import { buildStamp } from './build.js';
21
+ import { unpackFrame } from './frameBatch.js';
22
+ import { setFpsTelemetry } from './fpsTelemetry.js';
23
+ import { setLoadTelemetry } from './loadTelemetry.js';
24
+ import { readQuality } from '../shared/quality.js';
25
+ import { noteQualityInteraction } from './quality.js';
26
+ import { readDanceIdle } from '../shared/danceIdle.js';
13
27
 
14
28
  // Root-anchored: the deck's own castle.json once this kit is imported.
15
29
  const castleJson = Object.values(import.meta.glob('/castle.json', { eager: true, import: 'default' }))[0] ?? {};
30
+ deck.title = typeof castleJson.title === 'string' ? castleJson.title : '';
31
+ // Read only when a scene opts into the spawn locator; never sent or saved.
32
+ localArrival.for = (id) => (id === 'main' ? castleJson.hub?.places?.main ?? castleJson.hub : castleJson.hub?.places?.[id])?.arrival;
33
+ // The assembly's build stamp beside it; an absent file matches nothing.
34
+ deck.build = buildStamp(Object.values(import.meta.glob('/build.json', { eager: true, import: 'default' }))[0]);
35
+ // Read the installed copy's identity, rather than the assembly's requested pin.
36
+ const kitBuild = Object.values(import.meta.glob('/imports/castle.hub-game/.castle-import-version.json', { eager: true, import: 'default', exhaustive: true }))[0];
37
+ if (deck.build && kitBuild?.source === 'builtin' && typeof kitBuild.version === 'string') {
38
+ deck.build = Object.freeze({ ...deck.build, hubGameBuiltinVersion: kitBuild.version,
39
+ ...(typeof kitBuild.digest === 'string' ? { hubGameBuiltinDigest: kitBuild.digest } : {}) });
40
+ }
41
+
42
+ if (castleJson?.hub?.pongTimeoutMs > 0) { deck.pongTimeoutMs = castleJson.hub.pongTimeoutMs; }
43
+ else { delete deck.pongTimeoutMs; }
44
+ deck.invite = (castleJson?.hub?.places?.main?.invite ?? castleJson?.hub?.invite) === true;
45
+ deck.defaultEnvironment = castleJson?.hub?.defaultEnvironment !== false;
16
46
  deck.tiers = castleJson?.hub?.tiers === true;
47
+ if (castleJson?.hub?.highOnly === true && deck.tiers) { deck.highOnly = true; }
48
+ else { delete deck.highOnly; }
49
+ if (castleJson?.hub?.quality !== undefined && deck.tiers) { deck.quality = readQuality(castleJson.hub.quality, true, []); }
50
+ else { delete deck.quality; }
51
+ if (castleJson?.hub?.safeInsets === true) { deck.safeInsets = true; }
52
+ else { delete deck.safeInsets; }
53
+ if (castleJson?.hub?.weakestTier === true) { deck.weakestTier = true; }
54
+ else { delete deck.weakestTier; }
55
+ if (castleJson?.hub?.weakestLookBake === true) { deck.weakestLookBake = true; }
56
+ else { delete deck.weakestLookBake; }
57
+ if (castleJson?.hub?.mergeFarAvatars === true) { deck.mergeFarAvatars = true; }
58
+ else { delete deck.mergeFarAvatars; }
59
+ if (castleJson?.hub?.lowActorDistance === true) { deck.lowActorDistance = true; }
60
+ else { delete deck.lowActorDistance; }
61
+ if (castleJson?.hub?.lowActorBudget === true) { deck.lowActorBudget = true; }
62
+ else { delete deck.lowActorBudget; }
63
+ if (castleJson?.hub?.companionIdle === true) { deck.companionIdle = true; }
64
+ else { delete deck.companionIdle; }
65
+ if (castleJson?.hub?.act === true) {deck.act = true;}
66
+ else {delete deck.act;}
17
67
  deck.cues = castleJson?.hub?.cues === true;
68
+ deck.playCards = castleJson?.hub?.playCards === true;
69
+ deck.yourGames = castleJson?.hub?.yourGames === true;
70
+ if (castleJson?.hub?.avatarColors === true) {
71
+ deck.avatarColors = true;
72
+ }
73
+ deck.stuck = castleJson?.hub?.stuck === true;
74
+ deck.labels = castleJson?.hub?.labels === 'near';
75
+ // `hub.soundscape`: true, or an object with optional ground, ambience and UI.
76
+ const soundscape = castleJson?.hub?.soundscape;
77
+ deck.soundscape = soundscape === true || (soundscape && typeof soundscape === 'object' && !Array.isArray(soundscape)) ? {
78
+ babble: soundscape.babble !== false,
79
+ steps: soundscape.steps && typeof soundscape.steps === 'object' && !Array.isArray(soundscape.steps) ? soundscape.steps : soundscape.steps !== false,
80
+ ...(typeof soundscape.zones === 'string' ? { zones: soundscape.zones } : {}),
81
+ ...(soundscape.ambience && typeof soundscape.ambience === 'object' && !Array.isArray(soundscape.ambience) ? { ambience: soundscape.ambience } : {}),
82
+ ...(Object.hasOwn(soundscape, 'ui') && typeof soundscape.ui === 'boolean' ? { ui: soundscape.ui } : {}),
83
+ ...(Object.hasOwn(soundscape, 'cues') && typeof soundscape.cues === 'boolean' ? { cues: soundscape.cues } : {}),
84
+ } : null;
85
+ if (deck.soundscape?.cues === true) {
86
+ hub.cueEvents = [];
87
+ }
18
88
 
19
89
  let files = null;
20
90
  // The scene and multiplayer system of the newest snapshot, for a message that
@@ -25,22 +95,72 @@ let drawnStyle = null;
25
95
 
26
96
  // Everyone's avatars with this player's own over them. A player whose avatar
27
97
  // changed is dropped and respawns in the new one.
98
+ // A `hubAv2` block (v1.51) as a map, or an empty one for anything else.
99
+ function realAvatars(block) {
100
+ return new Map(Object.entries(block && typeof block === 'object' ? block : {}));
101
+ }
102
+
28
103
  function setAvatars(scene, system) {
29
104
  const next = new Map([...hub.avatarsAll, ...hub.avatarsMe]);
105
+ // v1.51: `hubAv` carries a stand-in from the first four for a player who
106
+ // wears a later avatar, for clients from before them; the one really worn
107
+ // is in `hubAv2`, and is the one drawn here. Only for a player `hubAv`
108
+ // lists, and only an avatar index.
109
+ // A viewer's block only names players omitted from the shared one. For a
110
+ // shared player, its real index (or its absence) wins over a stale message.
111
+ const own = [...hub.avatars2Me].filter(([playerId]) => !hub.avatarsAll.has(playerId));
112
+ for (const [playerId, avatar] of [...hub.avatars2All, ...own]) {
113
+ if (next.has(playerId) && Number.isInteger(avatar) && avatar >= 0) {
114
+ next.set(playerId, avatar);
115
+ }
116
+ }
117
+ const colors = new Map();
118
+ const ownColors = [...hub.avatarColorsMe].filter(([playerId]) => !hub.avatarsAll.has(playerId));
119
+ for (const [playerId, color] of [...hub.avatarColorsAll, ...ownColors]) {
120
+ if (next.has(playerId) && Number.isInteger(color) && color > 0 && color < 16) {
121
+ colors.set(playerId, color);
122
+ }
123
+ }
30
124
  if (system) {
31
- const keep = new Map(system.net?.others() ?? []);
32
- let changed = false;
125
+ const changed = [];
126
+ const later = new Set();
33
127
  for (const [playerId, avatar] of next) {
34
- if (hub.avatars.has(playerId) && hub.avatars.get(playerId) !== avatar) {
35
- keep.delete(playerId);
36
- changed = true;
128
+ const colorChanged = (hub.avatarColors.get(playerId) ?? 0) !== (colors.get(playerId) ?? 0);
129
+ if (hub.avatars.has(playerId) && (hub.avatars.get(playerId) !== avatar || colorChanged)) {
130
+ changed.push(playerId);
131
+ // Changes involving a later avatar must not restore its old fading
132
+ // actor. The first four keep their original fade behavior.
133
+ if (colorChanged || Avatar.known(hub.avatars.get(playerId)) >= Avatar.DEFAULT_AVATARS || Avatar.known(avatar) >= Avatar.DEFAULT_AVATARS) {
134
+ later.add(playerId);
135
+ }
37
136
  }
38
137
  }
39
- if (changed) {
40
- Avatars.dropMissing(system.avatars, scene, keep);
41
- }
138
+ redraw(scene, system, changed, later);
42
139
  }
43
140
  hub.avatars = next;
141
+ hub.avatarColors = colors;
142
+ }
143
+
144
+ // Drops `playerIds`' bodies so each respawns in the avatar it is drawn as
145
+ // now (`hooks.avatar`). One of them still fading out in `fading` is taken
146
+ // down too, so it cannot come back as it was.
147
+ function redraw(scene, system, playerIds, fading) {
148
+ if (playerIds.length === 0) {
149
+ return;
150
+ }
151
+ const keep = new Map(system.net?.others() ?? []);
152
+ for (const playerId of playerIds) {
153
+ keep.delete(playerId);
154
+ const leaving = system.avatars.leaving.get(playerId);
155
+ if (leaving && fading.has(playerId)) {
156
+ if (scene.getActor(leaving.actorId)) {
157
+ system.avatars.retired?.add(leaving.actorId);
158
+ scene.despawnActor(leaving.actorId);
159
+ }
160
+ system.avatars.leaving.delete(playerId);
161
+ }
162
+ }
163
+ Avatars.dropMissing(system.avatars, scene, keep);
44
164
  }
45
165
 
46
166
  // Everyone's wearables with this player's own over them (v1.4), and over
@@ -49,11 +169,18 @@ function setWearing() {
49
169
  hub.wearing = wearingNow();
50
170
  }
51
171
 
172
+ // `{ spot, to }` of a place's word on "Stuck?" (v1.39).
173
+ function stuckAnswer(msg) {
174
+ return { spot: msg.spot === true, to: typeof msg.to === 'string' && msg.to ? msg.to.slice(0, 40) : null };
175
+ }
176
+
52
177
  function wearMap(value) {
53
178
  return new Map(Object.entries(value && typeof value === 'object' ? value : {}));
54
179
  }
55
180
 
56
181
  export default {
182
+ // Travel retains these hooks: decode offers from any opted-in destination.
183
+ unpack: unpackFrame,
57
184
  // A place whose NPCs have minds (`hub.npcs`, contract §13) is joined like any
58
185
  // other, on one of its public layers, when the SDK can address the place's
59
186
  // characters from a layer (`Multiplayer.placeCharacters`): ghost and the host
@@ -66,17 +193,81 @@ export default {
66
193
  return firstJoinFor(castleJson, castleSdk.Multiplayer);
67
194
  },
68
195
 
196
+ // Each deck message is marked with the player id it arrived under, so one
197
+ // from a session the connection has since left is dropped (`rehello.js`).
198
+ // Handles nothing: it goes on to the queue as before.
199
+ arrive(msg, system) {
200
+ if (msg.k === 'hub-frame-offer') {
201
+ if (system?.net?.unpacks === true) {
202
+ system.net.send({ k: 'hub-frame-ready' });
203
+ }
204
+ return true;
205
+ }
206
+ Rehello.tag(msg, system?.net ?? null);
207
+ return false;
208
+ },
209
+
69
210
  message(scene, msg) {
70
211
  files = scene.files ?? files;
71
212
  switch (msg.k) {
213
+ case 'hub-companion':
214
+ // As actions: keep a private message before WORLD until its gate is known.
215
+ if ((!hub.place || hub.place.companion === true) && Number.isSafeInteger(msg.n) && msg.n >= 0) {
216
+ hub.companion = { c: sanitise(msg.c), n: msg.n, ...(hub.companion?.stamps !== undefined ? { stamps: hub.companion.stamps } : {}) };
217
+ }
218
+ break;
219
+ case 'hub-menu':
220
+ if ((!hub.place || hub.place.menu === true) && Number.isSafeInteger(msg.n) && msg.n >= 0 &&
221
+ (!hub.menu || msg.n > hub.menu.n)) {
222
+ hub.menu = { spec: msg.spec, n: msg.n };
223
+ }
224
+ break;
225
+ case 'hub-ask':
226
+ // Buffer before WORLD; a known keyless place keeps nothing.
227
+ if ((!hub.place || hub.place.ask === true) && Number.isSafeInteger(msg.n) &&
228
+ (!hub.ask || msg.n > hub.ask.n)) {
229
+ hub.ask = msg.id === null ? { id: null, n: msg.n } : { id: msg.id, title: msg.title, max: msg.max, n: msg.n };
230
+ }
231
+ break;
232
+ case 'hub-prompts':
233
+ if (deck.act === true && Array.isArray(msg.items)) {
234
+ hub.prompts = msg.items.filter(item => item && typeof item.id === 'string' && typeof item.verb === 'string' && typeof item.hold === 'boolean');
235
+ }
236
+ break;
237
+ case 'hub-actions':
238
+ // Buffer before WORLD; nothing draws until the place is known to opt in.
239
+ // A WORLD naming a keyless place drops this private offer.
240
+ if (!hub.place || hub.place.actions === true) {
241
+ hub.actions = { items: msg.items ?? null, n: msg.n };
242
+ }
243
+ break;
244
+ case 'hub-decor':
245
+ hub.decor = { button: msg.button ?? null, spec: msg.spec ?? null, grid: msg.grid ?? null };
246
+ break;
247
+ case 'hub-shot':
248
+ // Accepted lease renewals refresh a held or resumable shot.
249
+ receiveShot(scene, msg.shot, msg.lease === true);
250
+ break;
251
+ case 'hub-home-unlock':
252
+ hub.commands.push(msg);
253
+ break;
254
+ case 'hub-invite':
255
+ if (hub.place?.invite === true) {hub.commands.push({ k: 'hub-invite', ...(msg.share === true ? { share: true } : {}) });}
256
+ break;
72
257
  case 'hub-go':
73
258
  case 'hub-end':
74
259
  case 'hub-result':
260
+ if (msg.k !== 'hub-result') {
261
+ clearShot();
262
+ }
75
263
  hub.commands.push(msg);
76
264
  break;
77
265
  case 'hub-tune':
78
266
  hub.tune = msg.tune && typeof msg.tune === 'object' ? msg.tune : null;
79
267
  break;
268
+ case 'hub-leaving':
269
+ hub.leaving = typeof msg.text === 'string' ? msg.text.trim().slice(0, 120) || null : null;
270
+ break;
80
271
  case 'hub-hud':
81
272
  hub.hudMe = msg.hud ?? null;
82
273
  break;
@@ -96,6 +287,16 @@ export default {
96
287
  if (typeof msg.to === 'string') {
97
288
  hub.jumpedTo = msg.to;
98
289
  }
290
+ // v1.39, after "Stuck?" in a place with the `unstick` hook: where it put this player.
291
+ if (deck.stuck && msg.stuck && typeof msg.stuck === 'object') {
292
+ hub.unstuck = stuckAnswer(msg.stuck);
293
+ }
294
+ break;
295
+ case 'hub-unstick-to':
296
+ // v1.39: what a tap on the chip would do now. Only a deck with `hub.stuck` asks.
297
+ if (deck.stuck) {
298
+ hub.stuckTo = stuckAnswer(msg);
299
+ }
99
300
  break;
100
301
  case 'hub-where':
101
302
  // Laid over what is known: one answer covers at most twelve players.
@@ -108,37 +309,65 @@ export default {
108
309
  }
109
310
  break;
110
311
  case 'hub-said':
312
+ if (deck.quality) {noteQualityInteraction(scene, msg.player);}
111
313
  if (hub.saidEvents.length < 64) {
112
314
  hub.saidEvents.push(msg);
113
315
  }
114
316
  break;
317
+ case 'hub-yours':
318
+ if (deck.yourGames) {
319
+ hub.yours = { rows: Array.isArray(msg.rows) ? msg.rows.slice(0, 5) : [], hearts: Array.isArray(msg.hearts) ? msg.hearts.slice(0, 8) : [] };
320
+ }
321
+ return;
322
+ case 'hub-friends-wanted':
323
+ hub.friendsWanted = true;
324
+ break;
115
325
  case 'hub-party':
116
- hub.party = {
117
- members: Array.isArray(msg.members) ? msg.members : null,
118
- away: Number(msg.away) || 0,
119
- invite: msg.invite ?? null,
120
- proposal: msg.proposal ?? null,
121
- };
326
+ receiveParty(msg);
122
327
  break;
123
328
  case 'hub-av':
329
+ if (hub.place?.anonymousEntry === true && Array.isArray(msg.hubGuests)) {
330
+ hub.guestsMe = new Set(msg.hubGuests.filter((id) => typeof id === 'string'));
331
+ hub.guests = new Set([...(hub.guestsAll ?? []), ...hub.guestsMe]);
332
+ }
124
333
  hub.avatarsMe = new Map(Object.entries(msg.hubAv && typeof msg.hubAv === 'object' ? msg.hubAv : {}));
334
+ // The message is whole: without `hubAv2`, none of them wears a later avatar.
335
+ hub.avatars2Me = realAvatars(msg.hubAv2);
336
+ hub.avatarColorsMe = realAvatars(msg.hubAvC);
125
337
  setAvatars(netSystem?.scene ?? scene, netSystem?.system ?? null);
126
338
  break;
127
339
  case 'hub-wear':
128
340
  hub.wearMe = wearMap(msg.hubWear);
129
341
  setWearing();
130
342
  break;
343
+ case 'hub-earned':
344
+ // v1.53: earned items of players in a hidden pair this player may see.
345
+ hub.earnedMe = wearMap(msg.hubEarned);
346
+ hub.earned = earnedNow();
347
+ break;
131
348
  case 'hub-try':
132
349
  // v1.28: try-ons of players in a hidden pair this player may see.
133
350
  hub.tryMe = wearMap(msg.hubTry);
134
351
  setWearing();
135
352
  break;
353
+ case 'hub-ballot-card':
354
+ // v1.68: the one entry to the choice card (`ballot.js` `gate`).
355
+ Ballot.gate(hub.place, scene?.multiplayer?.net ?? null, msg.card);
356
+ break;
136
357
  case 'hub-labels':
137
358
  hub.labelsMe = msg.labels && typeof msg.labels === 'object' ? msg.labels : {};
138
359
  break;
360
+ case 'hub-vis':
361
+ hub.hiddenMe = new Set(Array.isArray(msg.hide) ? msg.hide : []);
362
+ hub.shownMe = new Set(Array.isArray(msg.show) ? msg.show : []);
363
+ mergeHidden();
364
+ break;
139
365
  case 'hub-npc':
140
366
  case 'hub-npc-line':
367
+ case 'hub-npc-opening':
141
368
  case 'hub-npc-notes':
369
+ case 'hub-npc-preferred':
370
+ case 'hub-npc-hooks':
142
371
  hub.npcEvents.push(msg);
143
372
  break;
144
373
  case 'hub-grab-deny':
@@ -151,10 +380,22 @@ export default {
151
380
  break;
152
381
  case 'hub-sound':
153
382
  // At most a few unplayed one-shots wait: a backgrounded tab plays none late.
154
- if (hub.soundEvents.length < 8) {
383
+ if (hub.soundEvents.length < 8 && (!hub.soundGate || hub.soundGate())) {
155
384
  hub.soundEvents.push(msg);
156
385
  }
157
386
  break;
387
+ case 'hub-cue':
388
+ // Independent of audio mute/gesture gates; private transport only.
389
+ if (hub.place?.companion === true && hub.companion?.c && ownStamp(msg)) {
390
+ hub.companion.stamps = (hub.companion.stamps ?? 0) + 1;
391
+ }
392
+ if (deck.soundscape?.cues === true && (!hub.soundGate || hub.soundGate())) {
393
+ const events = (hub.cueEvents ??= []);
394
+ if (events.length < 8) {
395
+ events.push(msg);
396
+ }
397
+ }
398
+ break;
158
399
  default:
159
400
  break;
160
401
  }
@@ -166,8 +407,70 @@ export default {
166
407
  hub.lastT = msg.t;
167
408
  hub.lastTAt = msg.localMs ?? performance.now();
168
409
  }
410
+ // `hub-arrived` is sent before the state block containing the server's
411
+ // own-player clamp. Multiplayer applies that clamp after this hook, so
412
+ // the hub system observes this latch on the following frame, once the
413
+ // corrected position has reached Transform. A later WORLD is equivalent
414
+ // on reconnect; the initial WORLD cannot qualify before hub-arrived.
415
+ if (!hub.arrivalPlaced && hub.arrivedFacing !== null && (
416
+ msg.k === 'w' ||
417
+ // Match multiplayer's clamp acceptance exactly. `packPlayer` puts 1/0
418
+ // on the wire, while older composed fixtures may still carry true.
419
+ (msg.ps ?? []).some((row) => row?.[0] === system?.net?.selfId?.() && Boolean(row[5]))
420
+ )) {
421
+ hub.arrivalPlaced = true;
422
+ }
169
423
  if (msg.hubPlace) {
424
+ setFpsTelemetry(system?.net, msg.hubPlace.fpsTelemetry);
425
+ setLoadTelemetry(system?.net, msg.hubPlace.loadTelemetry);
426
+ if (Object.hasOwn(hub, 'menu') && hub.place && hub.place.id !== msg.hubPlace.id) {
427
+ hub.menuClose?.();
428
+ delete hub.menu;
429
+ }
430
+ if (Object.hasOwn(hub, 'ask') && hub.place && hub.place.id !== msg.hubPlace.id) {
431
+ hub.askClose?.();
432
+ delete hub.ask;
433
+ }
170
434
  hub.place = msg.hubPlace;
435
+ if (hub.place.anonymousEntry !== true) {
436
+ delete hub.guests;
437
+ delete hub.guestsAll;
438
+ delete hub.guestsMe;
439
+ }
440
+ if (hub.place.menu !== true) {
441
+ hub.menuClose?.();
442
+ delete hub.menuClose;
443
+ delete hub.menu;
444
+ }
445
+ if (hub.place.actions !== true && Object.hasOwn(hub, 'actions')) {
446
+ delete hub.actions;
447
+ }
448
+ if (hub.place.companion !== true) {
449
+ delete hub.companion;
450
+ delete hub.glow;
451
+ }
452
+ if (hub.place.ask !== true && Object.hasOwn(hub, 'ask')) {
453
+ hub.askClose?.();
454
+ delete hub.ask;
455
+ }
456
+ if (!hub.place.decor) {
457
+ delete hub.decor;
458
+ }
459
+ }
460
+ if (hub.place?.anonymousEntry === true && Array.isArray(msg.hubGuests)) {
461
+ hub.guestsAll = new Set(msg.hubGuests.filter((id) => typeof id === 'string'));
462
+ hub.guests = new Set([...hub.guestsAll, ...(hub.guestsMe ?? [])]);
463
+ }
464
+ // v1.68: a card the gate held before the place was known is kept or
465
+ // dropped by it. Nothing unless the gate held one.
466
+ if (msg.hubPlace && Ballot.held) {
467
+ Ballot.settle(msg.hubPlace);
468
+ }
469
+ // v1.33: a snapshot (it carries `hubPlace`) says whether this place takes
470
+ // "Stuck?". Read only in a deck with `hub.stuck`.
471
+ if (deck.stuck && msg.hubPlace) {
472
+ const to = msg.hubStuck && typeof msg.hubStuck === 'object' ? msg.hubStuck.to : undefined;
473
+ hub.stuck = to === undefined ? null : { to: typeof to === 'string' && to ? to.slice(0, 40) : null, ...(msg.hubStuck.hook === true ? { hook: true } : {}) };
171
474
  }
172
475
  netSystem = { scene, system };
173
476
  // The viewer's set changed under a running page (the experiment answered
@@ -185,14 +488,49 @@ export default {
185
488
  system.avatars.leaving.clear();
186
489
  }
187
490
  drawnStyle = style;
491
+ // v1.51: `hubAv2` comes only from a place where someone wears a later
492
+ // avatar, `{}` once when the last is gone; a snapshot (it carries
493
+ // `hubPlace`) without it means nobody does.
494
+ const hadColors = hub.avatarColorsAll.size > 0;
495
+ if (msg.hubAvC && typeof msg.hubAvC === 'object') {
496
+ hub.avatarColorsAll = realAvatars(msg.hubAvC);
497
+ } else if (msg.hubPlace) {
498
+ hub.avatarColorsAll = new Map();
499
+ }
500
+ const hadReal = hub.avatars2All.size > 0;
501
+ if (msg.hubAv2 && typeof msg.hubAv2 === 'object') {
502
+ hub.avatars2All = realAvatars(msg.hubAv2);
503
+ } else if (msg.hubPlace && hadReal) {
504
+ hub.avatars2All = new Map();
505
+ }
188
506
  if (msg.hubAv) {
189
507
  hub.avatarsAll = new Map(Object.entries(msg.hubAv));
508
+ }
509
+ if (msg.hubAv || msg.hubAv2 || msg.hubAvC || (msg.hubPlace && (hadReal || hadColors))) {
190
510
  setAvatars(scene, system);
191
511
  }
512
+ // The farthest of too many different characters are drawn as their
513
+ // stand-ins (`avatarCap.js`); a change is a later avatar's either way.
514
+ if (system?.avatars) {
515
+ const swapped = AvatarCap.frame(scene, system);
516
+ redraw(scene, system, swapped, new Set(swapped));
517
+ }
518
+ if (hub.place?.companion === true) {
519
+ if (Array.isArray(msg.hubGlow)) {
520
+ hub.glow = new Set(msg.hubGlow.filter((id) => typeof id === 'string'));
521
+ } else if (msg.hubPlace) {
522
+ delete hub.glow;
523
+ }
524
+ }
192
525
  if (msg.hubWear) {
193
526
  hub.wearAll = wearMap(msg.hubWear);
194
527
  setWearing();
195
528
  }
529
+ // v1.53: only a place where someone shows an earned item sends this.
530
+ if (msg.hubEarned) {
531
+ hub.earnedAll = wearMap(msg.hubEarned);
532
+ hub.earned = earnedNow();
533
+ }
196
534
  // v1.28: only a place that shows a try-on sends this. A snapshot (it
197
535
  // carries `hubPlace`) without one means none is up. `tryMe` is not the
198
536
  // snapshot's to clear: the place sends `hub-try` on the tick before a
@@ -209,17 +547,24 @@ export default {
209
547
  hub.hud = msg.hud ?? null;
210
548
  }
211
549
  if (msg.hidden) {
212
- hub.hidden = new Set(msg.hidden);
550
+ hub.hiddenAll = new Set(msg.hidden);
551
+ mergeHidden();
213
552
  }
214
553
  if (msg.tints) {
215
554
  hub.tints = msg.tints;
216
555
  }
556
+ if (msg.tintsD) {
557
+ hub.tints = mergeDictionary(hub.tints, msg.tintsD);
558
+ }
217
559
  if (msg.hubDoors) {
218
560
  hub.doors = msg.hubDoors;
219
561
  }
220
562
  if (msg.marks) {
221
563
  hub.marks = msg.marks;
222
564
  }
565
+ if (msg.marksD) {
566
+ hub.marks = mergeDictionary(hub.marks, msg.marksD);
567
+ }
223
568
  if (msg.spawnTemplates) {
224
569
  hub.spawnTemplates = msg.spawnTemplates;
225
570
  }
@@ -232,6 +577,9 @@ export default {
232
577
  if (msg.labels) {
233
578
  hub.labels = msg.labels;
234
579
  }
580
+ if (msg.labelsD) {
581
+ hub.labels = mergeDictionary(hub.labels, msg.labelsD);
582
+ }
235
583
  // v1.27: only a place that keeps an object for a player sends this.
236
584
  if (msg.hubKept && typeof msg.hubKept === 'object') {
237
585
  hub.keptFor = new Map(Object.entries(msg.hubKept));
@@ -240,24 +588,41 @@ export default {
240
588
  if (msg.hubEmotes && typeof msg.hubEmotes === 'object') {
241
589
  hub.emotes = msg.hubEmotes;
242
590
  }
591
+ // v1.47: only a place where an NPC has emoted sends this.
592
+ if (msg.hubNpcEmotes && typeof msg.hubNpcEmotes === 'object') {
593
+ hub.npcEmotes = msg.hubNpcEmotes;
594
+ }
243
595
  if (msg.hubSeated && typeof msg.hubSeated === 'object') {
244
596
  hub.seated = msg.hubSeated;
245
597
  }
246
598
  if (msg.hubSounds && typeof msg.hubSounds === 'object') {
247
599
  hub.sounds = msg.hubSounds;
248
600
  }
601
+ if (Object.hasOwn(msg, 'hubDanceIdle')) {
602
+ hub.danceIdle = readDanceIdle(msg.hubDanceIdle);
603
+ }
249
604
  },
250
605
 
251
606
  // Everyone is drawn as their avatar; until a player's hello has reached the
252
607
  // place they are not drawn, so nobody flashes in a default body. The set
253
608
  // is this viewer's own (`Avatar.style`).
254
609
  avatar(playerId, username) {
255
- const index = hub.avatars.has(playerId) ? hub.avatars.get(playerId) : null;
256
- const blueprint = index === null ? null : Avatar.blueprint(files, index);
257
- return blueprint ? { blueprint, username } : null;
610
+ // An index past this kit's own (a later kit's character) is drawn as one
611
+ // of the first four (`Avatar.known`), never left out.
612
+ // Or its stand-in while the cap has this player as one (`avatarCap.js`).
613
+ const index = AvatarCap.shown(playerId);
614
+ const blueprint = index === null ? null : Avatar.blueprint(files, index, Avatar.style(), AvatarCap.shownColor(playerId));
615
+ return blueprint ? { blueprint, username: hub.guests?.has(playerId) ? guestName(username) : username } : null;
258
616
  },
259
617
 
260
618
  presence(status) {
261
619
  return status.solo ? 'solo' : `${status.others + 1} here`;
262
620
  },
621
+
622
+ reset() {
623
+ clearShot();
624
+ },
625
+ dispose() {
626
+ clearShot();
627
+ },
263
628
  };
@@ -0,0 +1,51 @@
1
+ // v1.131: title above the world and one next-action sentence below it.
2
+ // Door authors shorten prompts to about 48 characters; layout QA flags wrapping.
3
+ export const HUD_COPY_STYLE = {
4
+ background: 'rgba(20,16,12,0.78)',
5
+ borderRadius: '14px',
6
+ padding: '4px 8px',
7
+ boxSizing: 'border-box',
8
+ width: 'max-content',
9
+ maxWidth: '100%',
10
+ margin: '0 auto',
11
+ lineHeight: '1.3',
12
+ whiteSpace: 'normal',
13
+ overflowWrap: 'anywhere',
14
+ overflow: 'hidden',
15
+ };
16
+
17
+ const checked = new WeakMap();
18
+ // Called only in dev serving. Check again when copy or viewport changes, so a
19
+ // timer frame never repeats an author's warning. Effective width includes
20
+ // safe-inset reconciliation, which can narrow a row after setHud.
21
+ export function warnHudCopy(node, row, lines = 2) {
22
+ const key = [node.textContent, window.innerWidth, window.innerHeight, node.clientWidth, lines].join('\u0001');
23
+ if (checked.get(node) === key) { return; }
24
+ checked.set(node, key);
25
+ if (!node.textContent) { return; }
26
+ const style = getComputedStyle(node);
27
+ const room = lines * parseFloat(style.lineHeight) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);
28
+ if (node.scrollHeight > Math.ceil(room)) {
29
+ console.warn(`[hub HUD] ${row} exceeds ${lines === 1 ? 'one line' : 'two lines'} at ${window.innerWidth}x${window.innerHeight}; shorten door copy (check at 844x390):`, node.textContent);
30
+ }
31
+ }
32
+
33
+ // Preserve authored bytes on the wire; only presentation takes the first
34
+ // sentence. Decimal points are not sentence endings. Never add an ellipsis.
35
+ export function firstPromptSentence(text) {
36
+ const words = String(text ?? '').trim();
37
+ for (const end of words.matchAll(/[.!?](?:["'”’)]*)(?=\s|$)/gu)) {
38
+ const before = words.slice(0, end.index);
39
+ // A person's title is not the end of the action naming them.
40
+ if (end[0] === '.' && /\b(?:Mr|Mrs|Ms|Dr|Prof|St)$/i.test(before)) {continue;}
41
+ return words.slice(0, end.index + end[0].length);
42
+ }
43
+ return words;
44
+ }
45
+
46
+ // A projected label crossing the bottom prompt moves just above it. The top
47
+ // HUD keeps its existing downward clearance; the prompt is a separate band.
48
+ export function promptShift(box, prompt) {
49
+ if (!prompt || box.right <= prompt.left || box.left >= prompt.right || box.bottom <= prompt.top || box.top >= prompt.bottom) { return 0; }
50
+ return Math.max(-box.top, prompt.top - 6 - box.bottom);
51
+ }
@@ -0,0 +1,20 @@
1
+ const INPUT_EVENTS = ['pointerdown', 'pointerup', 'touchstart', 'touchend', 'keydown', 'keyup'];
2
+
3
+ // Only panels rest on alternate Weakest frames; motion and input never do.
4
+ export function makeHudRate(target = globalThis.window) {
5
+ let input = false, skip = false, previous;
6
+ const onInput = () => { input = true; };
7
+ for (const type of INPUT_EVENTS) {target?.addEventListener?.(type, onInput, true);}
8
+ return {
9
+ frame(weakest, signature) {
10
+ const tick = !weakest || input || signature !== previous || !skip;
11
+ previous = signature;
12
+ if (tick) {input = false;}
13
+ skip = weakest && tick;
14
+ return tick;
15
+ },
16
+ dispose() {
17
+ for (const type of INPUT_EVENTS) {target?.removeEventListener?.(type, onInput, true);}
18
+ },
19
+ };
20
+ }