castle-web-cli 0.4.239 → 0.4.241

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 (396) hide show
  1. package/dist/agent.js +5 -1
  2. package/dist/api.d.ts +20 -0
  3. package/dist/api.js +57 -0
  4. package/dist/bundle.d.ts +38 -1
  5. package/dist/bundle.js +309 -13
  6. package/dist/castle-host/host.js +163 -11
  7. package/dist/castleJson.d.ts +10 -0
  8. package/dist/castleJson.js +46 -2
  9. package/dist/check.js +5 -2
  10. package/dist/devSessionServer.js +4 -1
  11. package/dist/devSessionStorage.d.ts +1 -0
  12. package/dist/devSessionStorage.js +32 -7
  13. package/dist/importOrder.d.ts +2 -0
  14. package/dist/importOrder.js +29 -0
  15. package/dist/index.js +6 -3
  16. package/dist/init.js +24 -2
  17. package/dist/multiplayerDoc.d.ts +1 -1
  18. package/dist/multiplayerDoc.js +2 -0
  19. package/dist/platformDoc.js +3 -2
  20. package/dist/playPagePolicy.js +5 -1
  21. package/dist/resetLeaderboards.d.ts +8 -1
  22. package/dist/resetLeaderboards.js +43 -8
  23. package/dist/roomLogs.d.ts +1 -0
  24. package/dist/roomLogs.js +30 -6
  25. package/dist/save-deck.d.ts +32 -2
  26. package/dist/save-deck.js +240 -39
  27. package/kits/base/CLAUDE.md +1 -1
  28. package/kits/base/castle.json +1 -1
  29. package/kits/base/sdk/README.md +174 -6
  30. package/kits/base/sdk/analytics.d.ts +8 -0
  31. package/kits/base/sdk/analytics.js +92 -0
  32. package/kits/base/sdk/castle.d.ts +5 -1
  33. package/kits/base/sdk/castle.js +2 -0
  34. package/kits/base/sdk/commands.d.ts +48 -0
  35. package/kits/base/sdk/commands.js +1 -0
  36. package/kits/base/sdk/debugConsole.d.ts +17 -0
  37. package/kits/base/sdk/debugConsole.js +154 -0
  38. package/kits/base/sdk/experiments.js +24 -1
  39. package/kits/base/sdk/hostRetry.d.ts +7 -0
  40. package/kits/base/sdk/hostRetry.js +57 -0
  41. package/kits/base/sdk/hub.d.ts +20 -2
  42. package/kits/base/sdk/hub.js +99 -13
  43. package/kits/base/sdk/multiplayer.d.ts +2 -0
  44. package/kits/base/sdk/multiplayer.js +168 -26
  45. package/kits/base/sdk/reconnectBudget.d.ts +6 -0
  46. package/kits/base/sdk/reconnectBudget.js +41 -1
  47. package/kits/base/sdk/runtime.js +36 -19
  48. package/kits/base/sdk/server/hub.d.ts +19 -0
  49. package/kits/base/sdk/server/hub.js +12 -0
  50. package/kits/base/sdk/server/platformHandle.d.ts +1 -0
  51. package/kits/base/sdk/server/wrapper.d.ts +1 -1
  52. package/kits/base/sdk/server/wrapper.js +26 -1
  53. package/kits/base/sdk/transport.d.ts +2 -1
  54. package/kits/base/sdk/transport.js +35 -0
  55. package/kits/hub-game/CLAUDE.md +66 -19
  56. package/kits/hub-game/code/client/act.js +9 -6
  57. package/kits/hub-game/code/client/actCore.js +26 -6
  58. package/kits/hub-game/code/client/actGateLog.js +36 -0
  59. package/kits/hub-game/code/client/actionOverflow.js +29 -8
  60. package/kits/hub-game/code/client/actionRailSurface.js +186 -0
  61. package/kits/hub-game/code/client/actionRailTree.js +173 -0
  62. package/kits/hub-game/code/client/askSurface.js +85 -0
  63. package/kits/hub-game/code/client/askTree.js +51 -0
  64. package/kits/hub-game/code/client/attention.js +31 -6
  65. package/kits/hub-game/code/client/ballot.js +42 -5
  66. package/kits/hub-game/code/client/ballotSurface.js +115 -0
  67. package/kits/hub-game/code/client/ballotTree.js +180 -0
  68. package/kits/hub-game/code/client/catchingUp.js +19 -0
  69. package/kits/hub-game/code/client/celebrate.js +66 -0
  70. package/kits/hub-game/code/client/chrome.js +481 -57
  71. package/kits/hub-game/code/client/companion.js +93 -23
  72. package/kits/hub-game/code/client/companionDress.js +1 -1
  73. package/kits/hub-game/code/client/cornerSurface.js +106 -0
  74. package/kits/hub-game/code/client/cornerTree.js +83 -0
  75. package/kits/hub-game/code/client/decor.js +20 -11
  76. package/kits/hub-game/code/client/deviceStorage.js +121 -0
  77. package/kits/hub-game/code/client/disguise.js +23 -0
  78. package/kits/hub-game/code/client/disguiseDraw.js +87 -0
  79. package/kits/hub-game/code/client/dockSurface.js +206 -0
  80. package/kits/hub-game/code/client/dockTree.js +232 -0
  81. package/kits/hub-game/code/client/earned.js +29 -0
  82. package/kits/hub-game/code/client/emoteSurface.js +188 -0
  83. package/kits/hub-game/code/client/emoteTree.js +264 -0
  84. package/kits/hub-game/code/client/farAvatars.js +4 -3
  85. package/kits/hub-game/code/client/fpsTelemetry.js +3 -1
  86. package/kits/hub-game/code/client/grab.js +121 -50
  87. package/kits/hub-game/code/client/holdShow.js +19 -0
  88. package/kits/hub-game/code/client/hookLayer.js +96 -12
  89. package/kits/hub-game/code/client/hubControls.js +7 -1
  90. package/kits/hub-game/code/client/hudSurface.js +11 -3
  91. package/kits/hub-game/code/client/hudTree.js +7 -4
  92. package/kits/hub-game/code/client/idle.js +21 -3
  93. package/kits/hub-game/code/client/invites.js +24 -3
  94. package/kits/hub-game/code/client/keys.js +15 -0
  95. package/kits/hub-game/code/client/labelsNear.js +8 -1
  96. package/kits/hub-game/code/client/layoutCache.js +57 -8
  97. package/kits/hub-game/code/client/loadingCover.js +53 -4
  98. package/kits/hub-game/code/client/menuIcons.js +15 -0
  99. package/kits/hub-game/code/client/menuSurface.js +102 -0
  100. package/kits/hub-game/code/client/menuTree.js +135 -0
  101. package/kits/hub-game/code/client/modelLook.js +41 -0
  102. package/kits/hub-game/code/client/padCues.js +11 -7
  103. package/kits/hub-game/code/client/padReadability.js +3 -3
  104. package/kits/hub-game/code/client/pickerSurface.js +152 -0
  105. package/kits/hub-game/code/client/pickerTree.js +163 -0
  106. package/kits/hub-game/code/client/pushVisit.js +4 -2
  107. package/kits/hub-game/code/client/quality.js +188 -29
  108. package/kits/hub-game/code/client/qualityEntry.js +10 -1
  109. package/kits/hub-game/code/client/quickChatSurface.js +222 -0
  110. package/kits/hub-game/code/client/quickChatTree.js +201 -0
  111. package/kits/hub-game/code/client/rehello.js +75 -0
  112. package/kits/hub-game/code/client/renderVisibility.js +17 -0
  113. package/kits/hub-game/code/client/replay.js +118 -0
  114. package/kits/hub-game/code/client/role.js +3 -0
  115. package/kits/hub-game/code/client/safeLayout.js +441 -56
  116. package/kits/hub-game/code/client/safeStyle.js +13 -10
  117. package/kits/hub-game/code/client/say.js +2 -0
  118. package/kits/hub-game/code/client/soundSurface.js +77 -0
  119. package/kits/hub-game/code/client/soundTree.js +74 -0
  120. package/kits/hub-game/code/client/soundscape.js +12 -9
  121. package/kits/hub-game/code/client/soundscapeCues.js +1 -1
  122. package/kits/hub-game/code/client/state.js +67 -1
  123. package/kits/hub-game/code/client/stuckSurface.js +76 -0
  124. package/kits/hub-game/code/client/stuckTree.js +67 -0
  125. package/kits/hub-game/code/client/talk.js +42 -12
  126. package/kits/hub-game/code/client/talkTree.js +4 -2
  127. package/kits/hub-game/code/client/textAskSurface.js +147 -0
  128. package/kits/hub-game/code/client/textAskTree.js +67 -0
  129. package/kits/hub-game/code/client/tiers.js +252 -27
  130. package/kits/hub-game/code/client/together.js +4 -1
  131. package/kits/hub-game/code/client/uiDom.js +86 -8
  132. package/kits/hub-game/code/client/uiTree.js +33 -4
  133. package/kits/hub-game/code/client/vehicle.js +72 -51
  134. package/kits/hub-game/code/client/weakestTier.js +75 -31
  135. package/kits/hub-game/code/client/wear.js +159 -5
  136. package/kits/hub-game/code/client/worldLabels.js +205 -25
  137. package/kits/hub-game/code/companionSpec.js +4 -2
  138. package/kits/hub-game/code/server/act.js +3 -0
  139. package/kits/hub-game/code/server/actGate.js +83 -0
  140. package/kits/hub-game/code/server/actions.js +71 -15
  141. package/kits/hub-game/code/server/actors.js +20 -5
  142. package/kits/hub-game/code/server/analytics.js +35 -3
  143. package/kits/hub-game/code/server/ask.js +39 -3
  144. package/kits/hub-game/code/server/ballot.js +167 -4
  145. package/kits/hub-game/code/server/celebrate.js +64 -0
  146. package/kits/hub-game/code/server/companion.js +17 -2
  147. package/kits/hub-game/code/server/decor.js +11 -2
  148. package/kits/hub-game/code/server/disguise.js +63 -0
  149. package/kits/hub-game/code/server/earned.js +6 -2
  150. package/kits/hub-game/code/server/friendBests.js +13 -4
  151. package/kits/hub-game/code/server/friendsAmong.js +67 -8
  152. package/kits/hub-game/code/server/grab.js +12 -2
  153. package/kits/hub-game/code/server/heldOffers.js +142 -0
  154. package/kits/hub-game/code/server/holdShow.js +98 -0
  155. package/kits/hub-game/code/server/hub.js +991 -72
  156. package/kits/hub-game/code/server/idle.js +110 -9
  157. package/kits/hub-game/code/server/index.js +9 -0
  158. package/kits/hub-game/code/server/labels.js +13 -3
  159. package/kits/hub-game/code/server/manifest.js +94 -6
  160. package/kits/hub-game/code/server/menu.js +26 -3
  161. package/kits/hub-game/code/server/npcs.js +55 -9
  162. package/kits/hub-game/code/server/observe.js +67 -6
  163. package/kits/hub-game/code/server/players.js +14 -2
  164. package/kits/hub-game/code/server/replay.js +135 -0
  165. package/kits/hub-game/code/server/standing.js +7 -3
  166. package/kits/hub-game/code/server/storageLimit.js +4 -1
  167. package/kits/hub-game/code/server/townDay.js +74 -0
  168. package/kits/hub-game/code/server/vehicle.js +3 -0
  169. package/kits/hub-game/code/server/vis.js +26 -4
  170. package/kits/hub-game/code/server/wallet.js +677 -0
  171. package/kits/hub-game/code/server/wear.js +13 -3
  172. package/kits/hub-game/code/server/writerLease.js +191 -0
  173. package/kits/hub-game/code/shared/act.js +1 -1
  174. package/kits/hub-game/code/shared/expression.js +6 -0
  175. package/kits/hub-game/code/shared/replay.js +37 -0
  176. package/kits/hub-game/code/systems/hub.js +429 -55
  177. package/kits/hub-game/docs/analytics.md +16 -2
  178. package/kits/hub-game/docs/contract.md +956 -101
  179. package/kits/hub-game/docs/home-pieces.md +5 -6
  180. package/kits/hub-game/docs/observed-progress.md +49 -1
  181. package/kits/hub-game/docs/vehicle-preset.md +23 -0
  182. package/kits/hub-game/index.html +1 -0
  183. package/kits/hub-game/models/hats/baker-cap.pxmodel +3 -3
  184. package/kits/hub-game/models/hats/bat-clip.pxmodel +3 -3
  185. package/kits/hub-game/models/hats/beekeeper.pxmodel +3 -3
  186. package/kits/hub-game/models/hats/cap.pxmodel +3 -3
  187. package/kits/hub-game/models/hats/captain.pxmodel +3 -3
  188. package/kits/hub-game/models/hats/chef-toque.pxmodel +3 -3
  189. package/kits/hub-game/models/hats/crooked-top.pxmodel +3 -3
  190. package/kits/hub-game/models/hats/delivery-cap.pxmodel +3 -3
  191. package/kits/hub-game/models/hats/fire-helmet.pxmodel +3 -3
  192. package/kits/hub-game/models/hats/flower-crown.pxmodel +3 -3
  193. package/kits/hub-game/models/hats/foam-crown.pxmodel +3 -3
  194. package/kits/hub-game/models/hats/hard-hat.pxmodel +3 -3
  195. package/kits/hub-game/models/hats/lantern.pxmodel +3 -3
  196. package/kits/hub-game/models/hats/laurel.pxmodel +3 -3
  197. package/kits/hub-game/models/hats/lighthouse.pxmodel +3 -3
  198. package/kits/hub-game/models/hats/nurse-cap.pxmodel +3 -3
  199. package/kits/hub-game/models/hats/police-cap.pxmodel +3 -3
  200. package/kits/hub-game/models/hats/sailor.pxmodel +3 -3
  201. package/kits/hub-game/models/hats/souwester.pxmodel +3 -3
  202. package/kits/hub-game/models/hats/straw.pxmodel +3 -3
  203. package/kits/hub-game/models/hats/sunflower.pxmodel +3 -3
  204. package/kits/hub-game/models/hats/sweatband.pxmodel +3 -3
  205. package/kits/hub-game/models/hats/teacher-beret.pxmodel +3 -3
  206. package/kits/hub-game/models/hats/witch.pxmodel +3 -3
  207. package/kits/hub-game/models/hold-show/daisy.pxmodel +231 -0
  208. package/kits/hub-game/models/hold-show/moonflower.pxmodel +171 -0
  209. package/kits/hub-game/models/hold-show/rose.pxmodel +191 -0
  210. package/kits/hub-game/models/hold-show/square/daisy.pxmodel +233 -0
  211. package/kits/hub-game/models/hold-show/square/moonflower.pxmodel +173 -0
  212. package/kits/hub-game/models/hold-show/square/rose.pxmodel +193 -0
  213. package/kits/hub-game/models/hold-show/square/sunflower.pxmodel +313 -0
  214. package/kits/hub-game/models/hold-show/square/tulip.pxmodel +133 -0
  215. package/kits/hub-game/models/hold-show/sunflower.pxmodel +311 -0
  216. package/kits/hub-game/models/hold-show/tulip.pxmodel +131 -0
  217. package/kits/hub-game/package-lock.json +3 -3
  218. package/kits/hub-game/package.json +4 -3
  219. package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +1 -0
  220. package/kits/hub-game/scripts/fixtures/hud-surface.json +12 -12
  221. package/kits/hub-game/scripts/fixtures/talk-surface.json +8 -8
  222. package/kits/hub-game/scripts/gen-hats.mjs +1 -1
  223. package/kits/hub-game/scripts/gen-hold-show.mjs +27 -0
  224. package/kits/hub-game/scripts/pack.mjs +89 -23
  225. package/kits/hub-game/scripts/test-act-client.mjs +5 -0
  226. package/kits/hub-game/scripts/test-act-core.mjs +32 -0
  227. package/kits/hub-game/scripts/test-act-gate.mjs +186 -0
  228. package/kits/hub-game/scripts/test-action-rail-crowded-dom.mjs +7 -1
  229. package/kits/hub-game/scripts/test-action-rail-default-dom.mjs +102 -0
  230. package/kits/hub-game/scripts/test-action-rail-never-silent-dom.mjs +50 -0
  231. package/kits/hub-game/scripts/test-action-rail-surface.mjs +368 -0
  232. package/kits/hub-game/scripts/test-action-rail-town-jobs-dom.mjs +118 -0
  233. package/kits/hub-game/scripts/test-actions-client.mjs +5 -3
  234. package/kits/hub-game/scripts/test-actions.mjs +24 -0
  235. package/kits/hub-game/scripts/test-actors.mjs +19 -0
  236. package/kits/hub-game/scripts/test-again-corner-dom.mjs +59 -0
  237. package/kits/hub-game/scripts/test-analytics.mjs +79 -0
  238. package/kits/hub-game/scripts/test-arrival-pose-server.mjs +25 -8
  239. package/kits/hub-game/scripts/test-ask-client.mjs +9 -0
  240. package/kits/hub-game/scripts/test-ask-surface.mjs +188 -0
  241. package/kits/hub-game/scripts/test-attention.mjs +43 -1
  242. package/kits/hub-game/scripts/test-ballot-sheet-dom.mjs +71 -0
  243. package/kits/hub-game/scripts/test-ballot-surface.mjs +276 -0
  244. package/kits/hub-game/scripts/test-ballot.mjs +421 -4
  245. package/kits/hub-game/scripts/test-ban-join.mjs +1 -1
  246. package/kits/hub-game/scripts/test-celebrate-client.mjs +62 -0
  247. package/kits/hub-game/scripts/test-celebrate.mjs +116 -0
  248. package/kits/hub-game/scripts/test-chat.mjs +73 -0
  249. package/kits/hub-game/scripts/test-companion-client.mjs +203 -21
  250. package/kits/hub-game/scripts/test-companion.mjs +110 -3
  251. package/kits/hub-game/scripts/test-control-layout-dom.mjs +57 -10
  252. package/kits/hub-game/scripts/test-corner-surface.mjs +268 -0
  253. package/kits/hub-game/scripts/test-decor-client.mjs +59 -3
  254. package/kits/hub-game/scripts/test-decor.mjs +27 -0
  255. package/kits/hub-game/scripts/test-device-class.mjs +4 -1
  256. package/kits/hub-game/scripts/test-disguise-client.mjs +281 -0
  257. package/kits/hub-game/scripts/test-disguise.mjs +176 -0
  258. package/kits/hub-game/scripts/test-dock-surface.mjs +404 -0
  259. package/kits/hub-game/scripts/test-door-stay-client.mjs +602 -0
  260. package/kits/hub-game/scripts/test-door-stay.mjs +613 -0
  261. package/kits/hub-game/scripts/test-earned-client.mjs +119 -0
  262. package/kits/hub-game/scripts/test-emote-surface.mjs +616 -0
  263. package/kits/hub-game/scripts/test-fps-telemetry.mjs +39 -4
  264. package/kits/hub-game/scripts/test-friend-bests.mjs +38 -12
  265. package/kits/hub-game/scripts/test-ghost-click-dom.mjs +75 -0
  266. package/kits/hub-game/scripts/test-grab-client.mjs +29 -2
  267. package/kits/hub-game/scripts/test-grab-orbit.mjs +260 -11
  268. package/kits/hub-game/scripts/test-grab.mjs +10 -1
  269. package/kits/hub-game/scripts/test-hats.mjs +28 -0
  270. package/kits/hub-game/scripts/test-held-offers.mjs +394 -0
  271. package/kits/hub-game/scripts/test-high-only.mjs +3 -3
  272. package/kits/hub-game/scripts/test-hold-show-client.mjs +175 -0
  273. package/kits/hub-game/scripts/test-hold-show.mjs +355 -0
  274. package/kits/hub-game/scripts/test-hub-controls.mjs +3 -1
  275. package/kits/hub-game/scripts/test-hub-idle.mjs +348 -0
  276. package/kits/hub-game/scripts/test-hub-leaving.mjs +21 -0
  277. package/kits/hub-game/scripts/test-hub-ops.mjs +119 -0
  278. package/kits/hub-game/scripts/test-hub-trip.mjs +240 -4
  279. package/kits/hub-game/scripts/test-hud-clear.mjs +83 -0
  280. package/kits/hub-game/scripts/test-hud-rate.mjs +2 -1
  281. package/kits/hub-game/scripts/test-idle.mjs +160 -0
  282. package/kits/hub-game/scripts/test-invites-client.mjs +53 -0
  283. package/kits/hub-game/scripts/test-labels.mjs +11 -0
  284. package/kits/hub-game/scripts/test-landscape-layout.mjs +20 -0
  285. package/kits/hub-game/scripts/test-loading-cover.mjs +67 -1
  286. package/kits/hub-game/scripts/test-manifest.mjs +27 -0
  287. package/kits/hub-game/scripts/test-menu-client.mjs +54 -5
  288. package/kits/hub-game/scripts/test-menu-surface.mjs +236 -0
  289. package/kits/hub-game/scripts/test-npcs.mjs +128 -0
  290. package/kits/hub-game/scripts/test-observed.mjs +171 -3
  291. package/kits/hub-game/scripts/test-pack.mjs +166 -0
  292. package/kits/hub-game/scripts/test-pad-cues.mjs +39 -0
  293. package/kits/hub-game/scripts/test-picker-surface.mjs +321 -0
  294. package/kits/hub-game/scripts/test-placeat-server.mjs +648 -0
  295. package/kits/hub-game/scripts/test-placement-cache.mjs +1 -1
  296. package/kits/hub-game/scripts/test-pointer-clear-dom.mjs +82 -0
  297. package/kits/hub-game/scripts/test-progress-reset.mjs +184 -6
  298. package/kits/hub-game/scripts/test-push-visit.mjs +9 -0
  299. package/kits/hub-game/scripts/test-quality.mjs +312 -9
  300. package/kits/hub-game/scripts/test-quick-chat-surface.mjs +511 -0
  301. package/kits/hub-game/scripts/test-rehello.mjs +242 -3
  302. package/kits/hub-game/scripts/test-rejoin-yaw.mjs +138 -0
  303. package/kits/hub-game/scripts/test-relations-among.mjs +13 -7
  304. package/kits/hub-game/scripts/test-relations-refresh.mjs +90 -2
  305. package/kits/hub-game/scripts/test-replay-client.mjs +110 -0
  306. package/kits/hub-game/scripts/test-replay.mjs +178 -0
  307. package/kits/hub-game/scripts/test-resume-held.mjs +13 -0
  308. package/kits/hub-game/scripts/test-resume-pose-server.mjs +43 -5
  309. package/kits/hub-game/scripts/test-role-client.mjs +2 -1
  310. package/kits/hub-game/scripts/test-safe-act.mjs +233 -0
  311. package/kits/hub-game/scripts/test-safe-caption.mjs +364 -0
  312. package/kits/hub-game/scripts/test-safe-layout.mjs +79 -0
  313. package/kits/hub-game/scripts/test-safe-prompt.mjs +163 -0
  314. package/kits/hub-game/scripts/test-sound-surface.mjs +256 -0
  315. package/kits/hub-game/scripts/test-soundscape.mjs +85 -2
  316. package/kits/hub-game/scripts/test-standing.mjs +135 -2
  317. package/kits/hub-game/scripts/test-stuck-surface.mjs +174 -0
  318. package/kits/hub-game/scripts/test-stuck.mjs +36 -1
  319. package/kits/hub-game/scripts/test-talk-surface.mjs +23 -6
  320. package/kits/hub-game/scripts/test-talk-walk-dom.mjs +123 -0
  321. package/kits/hub-game/scripts/test-text-ask-surface.mjs +273 -0
  322. package/kits/hub-game/scripts/test-tiers.mjs +453 -3
  323. package/kits/hub-game/scripts/test-toast-no-row-dom.mjs +71 -0
  324. package/kits/hub-game/scripts/test-together.mjs +11 -0
  325. package/kits/hub-game/scripts/test-town-day.mjs +90 -0
  326. package/kits/hub-game/scripts/test-try-on.mjs +39 -0
  327. package/kits/hub-game/scripts/test-ui-dom-dom.mjs +49 -2
  328. package/kits/hub-game/scripts/test-ui-tree.mjs +28 -0
  329. package/kits/hub-game/scripts/test-vehicle-client.mjs +68 -1
  330. package/kits/hub-game/scripts/test-vis.mjs +145 -0
  331. package/kits/hub-game/scripts/test-wallet.mjs +650 -0
  332. package/kits/hub-game/scripts/test-weakest-tier.mjs +135 -1
  333. package/kits/hub-game/scripts/test-world-labels.mjs +340 -0
  334. package/kits/hub-game/scripts/test-writer-lease-server.mjs +234 -0
  335. package/kits/hub-game/scripts/test-writer-lease.mjs +281 -0
  336. package/kits/hub-game/scripts/writer-storage-fixture.mjs +37 -0
  337. package/kits/hub-game/tools/hubScene/export.mjs +6 -5
  338. package/kits/hub-game/tools/hubScene/hubdata.mjs +10 -0
  339. package/kits/hub-game/tools/hubScene/test/export-fixture.mjs +36 -2
  340. package/kits/hub-game/tools/hubScene/validate-manifest.mjs +10 -2
  341. package/kits/multiplayer-3d/castle.json +5 -5
  342. package/kits/multiplayer-3d/code/client/resumeGate.js +66 -2
  343. package/kits/multiplayer-3d/code/server/ownership.js +25 -6
  344. package/kits/multiplayer-3d/code/server/world.js +19 -4
  345. package/kits/multiplayer-3d/code/systems/multiplayer.js +108 -18
  346. package/kits/multiplayer-3d/package-lock.json +1 -1
  347. package/kits/multiplayer-3d/package.json +2 -1
  348. package/kits/multiplayer-3d/scripts/test-ground-half.mjs +56 -0
  349. package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +54 -3
  350. package/kits/multiplayer-3d/scripts/test-owned-moves.mjs +190 -0
  351. package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +417 -5
  352. package/kits/multiplayer-3d/scripts/test-resync-reconnect.mjs +68 -0
  353. package/kits/physics-2d/castle.json +2 -2
  354. package/kits/physics-2d/engine/scene.js +10 -2
  355. package/kits/physics-3d/CLAUDE.md +14 -0
  356. package/kits/physics-3d/behaviors/Player.jsx +39 -3
  357. package/kits/physics-3d/castle.json +3 -3
  358. package/kits/physics-3d/docs/engine-model-cache.md +109 -0
  359. package/kits/physics-3d/docs/engine-player.md +76 -0
  360. package/kits/physics-3d/docs/engine-skip-work.md +16 -0
  361. package/kits/physics-3d/docs/pxmodel-format.md +5 -1
  362. package/kits/physics-3d/engine3d/gait.js +16 -8
  363. package/kits/physics-3d/engine3d/groundsize.js +23 -0
  364. package/kits/physics-3d/engine3d/kithooks.js +50 -0
  365. package/kits/physics-3d/engine3d/look.js +110 -17
  366. package/kits/physics-3d/engine3d/lookbake.js +19 -1
  367. package/kits/physics-3d/engine3d/materialpresets.js +3 -2
  368. package/kits/physics-3d/engine3d/modelcache.js +280 -0
  369. package/kits/physics-3d/engine3d/modelcachedigest.js +37 -0
  370. package/kits/physics-3d/engine3d/modelcachegate.js +69 -0
  371. package/kits/physics-3d/engine3d/modelrefs.js +13 -0
  372. package/kits/physics-3d/engine3d/optimize.js +20 -9
  373. package/kits/physics-3d/engine3d/playerRun.js +26 -1
  374. package/kits/physics-3d/engine3d/pxmodel.js +7 -3
  375. package/kits/physics-3d/engine3d/templatecache.js +722 -0
  376. package/kits/physics-3d/engine3d/world3d.js +211 -17
  377. package/kits/physics-3d/package-lock.json +1 -1
  378. package/kits/physics-3d/package.json +2 -1
  379. package/kits/physics-3d/play/behaviors/Player.js +43 -3
  380. package/kits/physics-3d/scripts/render.mjs +56 -8
  381. package/kits/physics-3d/scripts/template-cache-fixtures.mjs +37 -0
  382. package/kits/physics-3d/scripts/template-cache-v1-bytes.json +49 -0
  383. package/kits/physics-3d/scripts/test-coaxial-escape.mjs +176 -0
  384. package/kits/physics-3d/scripts/test-gait.mjs +53 -9
  385. package/kits/physics-3d/scripts/test-ground-half.mjs +120 -0
  386. package/kits/physics-3d/scripts/test-model-cache.mjs +600 -0
  387. package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +1 -0
  388. package/kits/physics-3d/scripts/test-sleeping-models.mjs +384 -0
  389. package/kits/physics-3d/scripts/test-template-cache-minified.mjs +106 -0
  390. package/kits/physics-3d/scripts/test-template-cache.mjs +519 -0
  391. package/kits/physics-3d/scripts/test-wall-slide.mjs +272 -0
  392. package/kits/physics-3d/systems/physics3d.js +59 -2
  393. package/kits/real-time/castle.json +2 -2
  394. package/kits/real-time/code/client/connection.js +3 -0
  395. package/package.json +2 -2
  396. package/vendor/three/examples/jsm/libs/fflate.module.js +2672 -0
@@ -0,0 +1,116 @@
1
+ // Celebration v1.205: real hub layer, fake transport/body, no Rapier needed.
2
+ import assert from 'node:assert/strict';
3
+ import { register } from 'node:module';
4
+ const sceneStub = 'export const readScene = () => globalThis.__hubTestActors ?? [];';
5
+ register(`data:text/javascript,${encodeURIComponent(`
6
+ export async function resolve(specifier, context, next) {
7
+ if (specifier === '@imports/castle.multiplayer-3d/code/server/sceneBodies.js') return { url: ${JSON.stringify('data:text/javascript,' + encodeURIComponent(sceneStub))}, shortCircuit: true };
8
+ if (specifier === '@imports/castle.multiplayer-3d/code/server/players.js') return { url: 'data:text/javascript,export function setPose(sim,id,msg){sim.reports.push([id,msg])}', shortCircuit: true };
9
+ if (specifier === '@imports/castle.multiplayer-3d/code/server/limits.js') return { url: 'data:text/javascript,export const readPoint=()=>null', shortCircuit: true };
10
+ return next(specifier, context);
11
+ }
12
+ `)}`);
13
+ const { layer } = await import('../code/server/hub.js');
14
+
15
+
16
+ let clock = 1_800_000_000_000;
17
+ const realNow = Date.now;
18
+ Date.now = () => clock;
19
+ function boot({ retained = false, count = 3, arrived = true, grab = false, grabHook } = {}) {
20
+ globalThis.__hubTestActors = [
21
+ { id: 'spawn', components: { Player: {}, Transform: { x: 0, y: 1, z: 0 } } },
22
+ { id: 'car', components: { Model: { file: 'car.pxmodel' }, Transform: {} } },
23
+ { id: 'bench', components: { HubSeat: {}, Transform: {}, Shape: { kind: 'box', height: 0.3 } } },
24
+ { id: 'door', components: { HubDoor: { id: 'game', to: 'game' }, Transform: {} } },
25
+ ...(grab ? [{ id: 'crate', components: { Transform: { x: 0, y: 1, z: 1 }, Shape: { kind: 'box' }, Body: { type: 'dynamic' } } }] : []),
26
+ ];
27
+ const sent = [], broadcast = [], left = [];
28
+ const players = Array.from({ length: count }, (_, i) => ({ playerId: `p${i + 1}`, username: `user${i}`, userId: `${i + 1}` }));
29
+ const session = { sessionId: 'dev', players: [...players], send: (id, msg) => sent.push([id, msg]), broadcast: msg => broadcast.push(msg) };
30
+ const body = () => ({ at: { x: 0, y: 1, z: 0 }, facing: 0, body: { setTranslation() {} } });
31
+ const sim = { timeMs: 0, scenePath: retained ? 'scenes/game.scene' : 'scenes/main.scene', players: new Map(players.map(p => [p.playerId, body()])), objects: new Map(), bodies: new Map(), reports: [] };
32
+ let hub;
33
+ const opts = { title: 'Town', contract: 1, stuck: true, unlocks: [{ id: 'stadium-pin', class: 'pin', shape: 'pin-round', color: '#e5484d', name: 'Stadium pin', deed: 'Win in Stadium' }], idle: { seats: true, sounds: ['sounds/horn.wav'] }, places: { game: { title: 'Game', scene: 'scenes/game.scene', result: {}, ...(retained ? { resume: { keep: true } } : {}) } } };
34
+ if (grab) {opts.grab = grab;}
35
+ if (retained) {session.place = 'game'; opts.places.game.idle = opts.idle;}
36
+ // resolvePlace reads session's authoritative place field.
37
+ const hooks = { ready(ctx) {hub = ctx;}, leave(ctx, id) {left.push(id);}, grab: grabHook };
38
+ const server = layer({ server: { maxPlayers: Math.max(8, count) }, hub: opts }, hooks, { game: hooks }, () => true);
39
+ server.sceneFor(session); server.ready(sim);
40
+ const say = (id, data) => server.message(session, { playerId: id }, data);
41
+ const tick = (ms = 50) => {sim.timeMs += ms; clock += ms; server.place(sim); server.step(sim, []);};
42
+ if (arrived) {players.forEach(p => say(p.playerId, { k: 'hub-hello', avatar: 0, party: 1 }));
43
+ tick(2000); tick(5000);}
44
+ for (const p of sim.players.values()) {p.at = { x: 0, y: 1, z: 0 };}
45
+ const drop = id => {session.players.splice(session.players.findIndex(p => p.playerId === id), 1); sim.players.delete(id);};
46
+ const back = id => {session.players.push(players.find(p => p.playerId === id)); sim.players.set(id, body()); say(id, { k: 'hub-hello', avatar: 0, party: 1, resume: true });};
47
+ return { hub, server, sim, session, sent, broadcast, say, tick, drop, back, left };
48
+ }
49
+ const win = (tokens = 25, extra = {}) => ({ kind: 'win', door: 'game', tokens, ...extra });
50
+ const moments = (r) => r.sent.filter(([, m]) => m.k === 'celebrate');
51
+ let tests = 0;
52
+ async function test(name, fn) { await fn(); tests++; console.log(`ok: ${name}`); }
53
+ try {
54
+ await test('unused snapshot/delta/messages are byte-identical and no empty field is added', async () => {
55
+ const a = boot(), b = boot();
56
+ delete b.hub.celebrate;
57
+ assert.equal(JSON.stringify(a.server.join()), JSON.stringify(b.server.join()));
58
+ a.server.delta(); b.server.delta(); a.sent.length = b.sent.length = 0;
59
+ a.tick(); b.tick();
60
+ assert.equal(JSON.stringify(a.server.delta()), JSON.stringify(b.server.delta()));
61
+ assert.equal(JSON.stringify(a.sent), JSON.stringify(b.sent));
62
+ assert(!JSON.stringify(a.server.join()).includes('celebrat'));
63
+ const snapshot = JSON.stringify(a.server.join());
64
+ await a.hub.celebrate('p1', win());
65
+ assert.equal(JSON.stringify(a.server.join()), snapshot, 'moment never changes snapshot bytes');
66
+ assert.equal(a.server.delta(), null, 'moment never changes delta bytes');
67
+ });
68
+ await test('Town-only capability, server-only transport, validated ids and numeric bounds', async () => {
69
+ const r = boot();
70
+ r.sent.length = 0; r.say('p1', { k: 'celebrate', ...win(), player: 'p2' });
71
+ assert.equal(moments(r).length, 0, 'a client cannot forge a moment');
72
+ for (const spec of [null, [], win(NaN), win(Infinity), win('20'), win(2, { kind: 'lose' }), win(2, { streak: 4 }), win(2, { door: 'missing' }), win(2, { unlock: 'invented' }), win(2, { player: 'p2' })]) assert.equal(await r.hub.celebrate('p1', spec), false);
73
+ assert.equal(await r.hub.celebrate('missing', win()), false);
74
+ assert.equal(await r.hub.celebrate('p1', win(99.5, { streak: 3, unlock: 'stadium-pin' })), true);
75
+ assert.deepEqual(moments(r)[0][1], { k: 'celebrate', player: 'p1', kind: 'win', door: 'game', tokens: 40, streak: 3, unlock: 'stadium-pin' });
76
+ const game = boot({ retained: true }); assert.equal(game.hub.celebrate, undefined);
77
+ const lower = boot(); await lower.hub.celebrate('p1', win(-5)); assert.equal(moments(lower)[0][1].tokens, 0);
78
+ });
79
+ await test('25 m at send time, connected players only and hidden pairs excluded', async () => {
80
+ const r = boot(); r.sim.players.get('p2').at.x = 25; r.sim.players.get('p3').at.x = 25.001;
81
+ r.sent.length = 0; await r.hub.celebrate('p1', win());
82
+ assert.deepEqual(moments(r).map(([id]) => id), ['p1', 'p2']);
83
+ r.session.hub = { readResults: async () => ({ players: {} }), readBoards: async () => ({ doors: {} }), hiddenPair: (a, b) => a === 'p1' && b === 'p2' };
84
+ await r.hub.celebrate('p1', win()); r.sim.players.get('p3').at.x = 1;
85
+ r.tick(4000); assert.deepEqual(moments(r).slice(2).map(([id]) => id), ['p1', 'p3']);
86
+ });
87
+ await test('one per layer per 4 s, three queued and oldest beyond three dropped', async () => {
88
+ const r = boot(); r.sent.length = 0;
89
+ for (let i = 0; i < 6; i++) assert.equal(await r.hub.celebrate('p1', win(i)), true);
90
+ assert.equal(await r.hub.celebrate('p1', win(6)), false, 'six/day even if queue drops some');
91
+ const own = () => moments(r).filter(([id]) => id === 'p1').map(([, m]) => m.tokens);
92
+ assert.deepEqual(own(), [0]); r.tick(3999); assert.deepEqual(own(), [0]);
93
+ r.tick(1); assert.deepEqual(own(), [0, 3]); r.tick(4000); r.tick(4000); assert.deepEqual(own(), [0, 3, 4, 5]);
94
+ r.drop('p1'); r.back('p1'); assert.equal(await r.hub.celebrate('p1', win()), false);
95
+ clock += 86400000; assert.equal(await r.hub.celebrate('p1', win()), true, 'LA day resets the daily limit');
96
+ });
97
+ await test('atomic daily cap is shared across layers; ambiguous reservations fail closed', async () => {
98
+ const data = new Map();
99
+ const store = { async increment(k) { const n = (data.get(k) ?? 0) + 1; data.set(k, n); return n; } };
100
+ const a = boot(), b = boot(); a.session.storage = b.session.storage = { deck: store };
101
+ const accepted = await Promise.all(Array.from({ length: 12 }, (_, i) => (i % 2 ? a : b).hub.celebrate('p1', win())));
102
+ assert.equal(accepted.filter(Boolean).length, 6); assert.equal(data.size, 1);
103
+ const failed = boot(); failed.session.storage = { deck: { increment: async () => { throw Error('lost'); } } };
104
+ assert.equal(await failed.hub.celebrate('p1', win()), false); assert.equal(moments(failed).length, 0);
105
+ });
106
+ await test('queued leave, changed account and LA midnight never deliver stale moments', async () => {
107
+ for (const change of ['leave', 'account', 'day']) {
108
+ const r = boot(); await r.hub.celebrate('p1', win(1)); await r.hub.celebrate('p1', win(2));
109
+ if (change === 'leave') r.drop('p1');
110
+ if (change === 'account') r.session.players[0].userId = '99';
111
+ if (change === 'day') clock += 86400000;
112
+ r.tick(4000); assert.equal(moments(r).filter(([, m]) => m.tokens === 2).length, 0, change);
113
+ }
114
+ });
115
+ } finally { Date.now = realNow; }
116
+ console.log(`${tests} celebration server checks passed`);
@@ -243,6 +243,46 @@ let n = 0;
243
243
  await settle();
244
244
  assert.equal(canType, false);
245
245
  handlers.end();
246
+ // v1.175: a refused inspect still shows an authored opening's asks, as
247
+ // taps the place answers (never a mind turn); typing stays off.
248
+ hub.npcEvents.push({ k: 'hub-npc', npc: 'greeter', name: 'Rowan', open: true, mind: true, character: 'greeter', opening: { text: 'What do you like?', asks: ['Fishing', 'Gardens'] }, fallbackChoices: ['Fishing', 'Gardens'] });
249
+ frame();
250
+ assert.equal(canType, false, 'typing still waits for a successful inspect');
251
+ assert.deepEqual(asks, ['Fishing', 'Gardens'], 'the authored asks show while the inspect is refused');
252
+ handlers.send('Something else');
253
+ assert.equal(sent.at(-1).k, 'hub-npc-end', 'words outside the taps are not sent');
254
+ handlers.send('Fishing');
255
+ const tap = sent.at(-1);
256
+ assert.deepEqual([tap.k, tap.npc, tap.text, typeof tap.rid], ['hub-npc-say', 'greeter', 'Fishing', 'string']);
257
+ assert.equal(turns, 0, 'a fallback tap is never a mind turn');
258
+ hub.npcEvents.push({ k: 'hub-npc-line', npc: 'greeter', text: 'Me too.', why: 'authored', rid: tap.rid });
259
+ frame();
260
+ assert.equal(waiting, false, 'the place answered');
261
+ assert.deepEqual(asks, ['Gardens'], 'an answered ask is gone; the rest stay');
262
+ assert.equal(canType, false);
263
+ handlers.end();
264
+ // v1.153: a child's bundle chips also wait for the inspect; meanwhile the
265
+ // three canned lines show, answered by the place, never an empty row.
266
+ const canned = ['What can I do here?', 'Tell me about yourself.', 'Where should I go next?'];
267
+ hub.npcEvents.push({ k: 'hub-npc', npc: 'greeter', name: 'Rowan', open: true, mind: true, character: 'greeter', ageOff: true, choices: [{ id: 'hi', label: 'Hi!' }, { id: 'pets', label: 'Pets?' }, { id: 'bye', label: 'Bye!' }], fallbackChoices: canned, opening: { text: 'Hello.' } });
268
+ frame();
269
+ assert.equal(canType, false);
270
+ assert.deepEqual(asks, canned, 'canned lines, not an empty row');
271
+ clock += 1000;
272
+ handlers.send({ id: 'hi', label: 'Hi!' });
273
+ assert.equal(sent.at(-1).k, 'hub-npc-end', 'a bundle chip still waits for the inspect');
274
+ handlers.send(canned[0]);
275
+ const childTap = sent.at(-1);
276
+ assert.deepEqual([childTap.k, childTap.text], ['hub-npc-say', canned[0]]);
277
+ assert.equal(turns, 0);
278
+ hub.npcEvents.push({ k: 'hub-npc-line', npc: 'greeter', text: 'Look around!', why: 'authored', rid: childTap.rid });
279
+ frame();
280
+ assert.equal(waiting, false, 'the place answered the child');
281
+ assert.equal(lines.at(-1), 'Look around!');
282
+ assert.deepEqual(asks, canned, 'canned lines may be asked again');
283
+ assert.ok(polls.every((timer) => timer.cancelled), 'the answer cleared its wait');
284
+ polls.length = 0;
285
+ handlers.end();
246
286
  open();
247
287
  assert.equal(inspections, 1, 'a refusal holds the next read back');
248
288
  handlers.end();
@@ -563,6 +603,39 @@ let n = 0;
563
603
  n += 1;
564
604
  }
565
605
 
606
+ // v1.204: while catching up, opening an NPC and saying a line the place
607
+ // answers are refused with a line, once per press, and nothing is sent.
608
+ {
609
+ const { makeTalk } = await import('../code/client/talk.js');
610
+ const { hub } = await import('../code/client/state.js');
611
+ let handlers, catching = true;
612
+ const refusals = [], sent = [], drafts = [];
613
+ const chrome = {
614
+ onTalk: (h) => { handlers = h; },
615
+ openTalk() {}, closeTalk() {}, talkAsks() {}, talkWaiting() {}, talkTyping() {}, talkLine() {},
616
+ talkFocused: () => false, talkPrompt() {}, talkDraft: (text) => drafts.push(text),
617
+ };
618
+ const npc = { id: 'keeper', components: { HubNpc: { name: 'Mo' }, Transform: { x: 0, z: 1 } } };
619
+ const scene = { actorWith: () => ({ components: { Transform: { x: 0, z: 0 } } }), getActors: () => [npc] };
620
+ const net = { send: (msg) => sent.push(msg) };
621
+ const talk = makeTalk(chrome, () => { if (!catching) {return false;} refusals.push(1); return true; });
622
+ talk.frame(scene, { net }, true);
623
+ handlers.open();
624
+ assert.deepEqual(sent, []); assert.equal(refusals.length, 1);
625
+ catching = false; handlers.open();
626
+ assert.deepEqual(sent, [{ k: 'hub-npc-open', npc: 'keeper' }]);
627
+ hub.npcEvents.push({ k: 'hub-npc', npc: 'keeper', name: 'Mo', open: true, mind: false });
628
+ talk.frame(scene, { net }, true);
629
+ catching = true; handlers.send('Hello');
630
+ assert.equal(sent.length, 1, 'a refused line is not sent'); assert.equal(refusals.length, 2);
631
+ assert.deepEqual(drafts, ['Hello'], 'typed words go back into the field');
632
+ catching = false; handlers.send('Hello');
633
+ assert.equal(sent.at(-1).k, 'hub-npc-say'); assert.equal(sent.at(-1).text, 'Hello');
634
+ handlers.end();
635
+ hub.npcEvents.length = 0;
636
+ n += 1;
637
+ }
638
+
566
639
  // A new session on the same connection has no conversation with this player:
567
640
  // the old panel closes. A stale panel instead re-attaches once, explaining
568
641
  // a refused open before closing.
@@ -158,7 +158,7 @@ function rig(options = process.env.COMPANION_IDLE_TEST === '1' ? { idle: true }
158
158
  const hub = { place: { companion: true }, companion: { c: spec, n: 1 }, glow: new Set(['p1', 'p2']) };
159
159
  const scene = { three: { scene: root, nodes }, multiplayer: { net: { selfId: () => 'p1' }, avatars: { actors: new Map([['p2', 'other']]) } }, getActor: () => null };
160
160
  const drawer = Companion.makeCompanion(options);
161
- const frame = (now = 0, visible = true, busy = false) => drawer.frame(scene, local, hub, 0.05, now, visible, null, busy);
161
+ const frame = (now = 0, visible = true, busy = false, low = false) => drawer.frame(scene, local, hub, 0.05, now, visible, null, busy, null, low);
162
162
  const labels = (now = 0) => drawer.labels({}, {}, (cam, x, y, z) => ({ x, y, z }), now);
163
163
  return { scene, local, own, other, root, hub, drawer, frame, labels };
164
164
  }
@@ -182,25 +182,60 @@ test('followTarget: facing-relative rest, feet height, point direction and half-
182
182
  near(Companion.followTarget(player, null, 2).y, 1.75);
183
183
  assert.deepEqual(Companion.followTarget(player, { x: 2, z: 3 }, 0), Companion.followTarget(player, null, 0));
184
184
  });
185
- test('chat target follows camera forward at eye height, faces player, lifts above a panel and exits to follow', () => {
185
+ test('chat target holds Chirp between camera and player sized to the screen, faces the lens, lifts above a panel and exits to follow', () => {
186
186
  const player = { x: 2, y: 1, z: 3, yaw: 0 };
187
+ const size = Companion.build('bird').userData.size;
187
188
  const camera = { forward: { x: 0, z: -1 }, position: { x: 2, y: 2, z: 8 } };
188
- const target = Companion.chatTarget(player, camera, 0);
189
- near(target.x, 2); near(target.z, 1.7); near(target.y, 1.85); near(target.yaw, 0);
190
- const lifted = Companion.chatTarget(player, camera, 0, { left: 0, right: 360, top: 400, bottom: 668 }, { w: 360, h: 668 }, (at) => ({ x: 180, y: 450 - (at.y - 1.85) * 200 }));
191
- near(lifted.y, 2.25);
192
- const offscreen = Companion.chatTarget(player, camera, 0, null, { w: 360, h: 668 }, (at) => ({ x: 180, y: 700 - (at.y - 1.85) * 200 }));
193
- near(offscreen.y, 2.25);
189
+ const target = Companion.chatTarget(player, camera, 0, undefined, undefined, undefined, size);
190
+ // On the sightline from the lens to the face (y 1.85), short of the player.
191
+ near(target.x, 2); assert(target.z > 3.9 && target.z < 8 - 0.9, `${target.z}`);
192
+ near((target.y - 2) / (target.z - 8), (1.85 - 2) / (3 - 8)); near(target.yaw, 0);
193
+ // The old spot 1.3 m past the player is gone at every orbit distance: the
194
+ // bird's paper fills CHAT_SHARE of view height at a phone and a tablet orbit.
195
+ const face = new THREE.Vector3(0, 1.85, 0);
196
+ const at = {};
197
+ for (const [name, orbit] of [['phone', 6], ['tablet', 11]]) {
198
+ const lens = new THREE.PerspectiveCamera(70, 412 / 870, 0.1, 100);
199
+ lens.position.copy(face).add(new THREE.Vector3(0, Math.sin(Math.PI / 7), Math.cos(Math.PI / 7)).multiplyScalar(orbit));
200
+ lens.lookAt(face); lens.updateMatrixWorld(true);
201
+ const input = { position: lens.position, forward: lens.getWorldDirection(new THREE.Vector3()), fov: lens.fov, near: lens.near };
202
+ const spot = Companion.chatTarget({ x: 0, y: 1, z: 0 }, input, 0, undefined, undefined, undefined, size);
203
+ const offset = new THREE.Vector3(spot.x, spot.y, spot.z).sub(lens.position);
204
+ const along = offset.dot(face.clone().sub(lens.position)) / face.distanceToSquared(lens.position);
205
+ assert(along > 0 && along < 1, `${name} between camera and player`);
206
+ assert(offset.length() >= 0.9, `${name} clear of the camera`);
207
+ assert(Math.hypot(spot.x, spot.z) >= 0.9, `${name} clear of the player`);
208
+ const depth = offset.dot(input.forward);
209
+ assert(Math.abs(size / (2 * depth * Math.tan(lens.fov * Math.PI / 360)) - Companion.CHAT_SHARE) < 1e-9, `${name} screen share`);
210
+ const ndc = (y) => new THREE.Vector3(spot.x, spot.y + y, spot.z).project(lens).y;
211
+ assert(Math.abs((ndc(size / 2) - ndc(-size / 2)) / 2 - Companion.CHAT_SHARE) < 0.02, `${name} projected share`);
212
+ near(spot.yaw, Math.atan2(lens.position.x - spot.x, lens.position.z - spot.z));
213
+ at[name] = offset.length();
214
+ }
215
+ near(at.phone, at.tablet);
216
+ // Far from the lens the depth stops 0.9 m short of the player; a camera too
217
+ // tight behind them for both clearances keeps the old spot past them.
218
+ const owl = Companion.chatTarget(player, camera, 0, undefined, undefined, undefined, 40);
219
+ near(owl.z, 3.9);
220
+ const tightCamera = { ...camera, position: { x: 2, y: 2, z: 4.6 } };
221
+ assert.deepEqual(Companion.chatTarget(player, tightCamera, 0, undefined, undefined, undefined, size), Companion.frontTarget(player, tightCamera, 0));
222
+ const panel = { left: 0, right: 360, top: 400, bottom: 668 }, view = { w: 360, h: 668 };
223
+ const lifted = Companion.chatTarget(player, camera, 0, panel, view, (p) => ({ x: 180, y: 450 - (p.y - target.y) * 200 }), size);
224
+ near(lifted.y, target.y + 0.4); near(lifted.z, target.z);
225
+ const offscreen = Companion.chatTarget(player, camera, 0, null, view, (p) => ({ x: 180, y: 700 - (p.y - target.y) * 200 }), size);
226
+ near(offscreen.y, target.y + 0.4);
194
227
  // Every lift covered (a far orbit): the highest on-screen candidate, never the last one tried.
195
- const covered = Companion.chatTarget(player, camera, 0, { left: 0, right: 360, top: 400, bottom: 668 }, { w: 360, h: 668 }, (at) => ({ x: 180, y: 600 - (at.y - 1.85) * 20 }));
196
- near(covered.y, 3.85);
228
+ const covered = Companion.chatTarget(player, camera, 0, panel, view, (p) => ({ x: 180, y: 600 - (p.y - target.y) * 20 }), size);
229
+ near(covered.y, target.y + 2);
230
+ // A camera in front of the player looking away keeps the bird ahead of the lens.
197
231
  const over = { ...camera, position: { x: 2, y: 2.8, z: 1.7 } };
198
- const raisedSafe = Companion.chatTarget(player, over, 0, { left: 0, right: 360, top: 400, bottom: 668 }, { w: 360, h: 668 }, (at) => ({ x: 180, y: 450 - (at.y - 1.85) * 200 }));
232
+ const raisedSafe = Companion.chatTarget(player, over, 0, panel, view, (p) => ({ x: 180, y: 450 - (p.y - 1.85) * 200 }), size);
199
233
  assert(Math.hypot(raisedSafe.x - over.position.x, raisedSafe.y - over.position.y, raisedSafe.z - over.position.z) >= 0.9);
200
- const rotated = Companion.chatTarget(player, { forward: { x: 1, z: 0 } }, 0);
201
- near(rotated.x, 3.3); near(rotated.z, 3); near(rotated.yaw, -Math.PI / 2);
234
+ // Without a camera position: the nominal 6 m orbit behind the camera forward.
235
+ const rotated = Companion.chatTarget(player, { forward: { x: 1, z: 0 } }, 0, undefined, undefined, undefined, size);
236
+ assert(rotated.x > -4 + 0.9 && rotated.x < 2 - 0.9, `${rotated.x}`); near(rotated.z, 3); near(rotated.yaw, -Math.PI / 2);
202
237
  const closeCamera = { ...camera, position: { x: 2, y: 1.85, z: 1.7 } };
203
- const safe = Companion.chatTarget(player, closeCamera, 0);
238
+ const safe = Companion.chatTarget(player, closeCamera, 0, undefined, undefined, undefined, size);
204
239
  assert(Math.hypot(safe.x - closeCamera.position.x, safe.y - closeCamera.position.y, safe.z - closeCamera.position.z) >= 0.9);
205
240
  assert(Math.hypot(safe.x - player.x, safe.z - player.z) >= 0.9);
206
241
  assert.deepEqual(Companion.motionTarget(player, null, 0, false, null), Companion.followTarget(player, null, 0));
@@ -212,9 +247,10 @@ test('chat holds through 30 s and 3 min away, then smoothly follows when closed'
212
247
  const frame = (now, talking) => r.drawer.frame(r.scene, r.local, r.hub, 0.05, now, true, talking ? chat : null);
213
248
  frame(0, true); frame(away, true);
214
249
  const bird = r.root.children.find((n) => n.name === 'companion:bird');
215
- near(bird.position.z, 1.7); near(bird.rotation.y, 0);
216
- frame(away + 50, false); assert(bird.position.z > 1.7 && bird.position.z < 2.65);
217
- frame(away * 2, false); assert(bird.position.z > 1.7);
250
+ const spot = Companion.chatTarget({ x: 2, y: 1, z: 3, yaw: 0 }, chat.camera, 0, undefined, undefined, undefined, bird.userData.size).z;
251
+ near(bird.position.z, spot); near(bird.rotation.y, 0);
252
+ frame(away + 50, false); assert(bird.position.z < spot && bird.position.z > 2.65);
253
+ frame(away * 2, false); assert(bird.position.z < spot);
218
254
  r.drawer.dispose();
219
255
  }
220
256
  });
@@ -318,6 +354,13 @@ function modelView(bird, cam) {
318
354
  });
319
355
  return { share: (top - bottom) / 2, depth, left: (left + 1) / 2, right: (right + 1) / 2, top: (1 - top) / 2, bottom: (1 - bottom) / 2, x: (left + right + 2) / 4, y: (2 - top - bottom) / 4 };
320
356
  }
357
+ // The player's left side on screen (0..1): its centre less a 0.4 m half-width
358
+ // along the camera's right axis, as the show fit measures it.
359
+ function playerLeftScreen(player, cam) {
360
+ const right = new THREE.Vector3(1, 0, 0).applyQuaternion(cam.quaternion);
361
+ const side = new THREE.Vector3(player.x, player.y, player.z).addScaledVector(right, -0.4).project(cam);
362
+ return (side.x + 1) / 2;
363
+ }
321
364
  function assertShowAngle(bird, cam, seconds) {
322
365
  const localCamera = new THREE.Vector3(0, 0, 1).applyQuaternion(cam.quaternion).applyQuaternion(bird.quaternion.clone().invert());
323
366
  const yaw = Math.atan2(localCamera.x, localCamera.z) * 180 / Math.PI;
@@ -418,6 +461,8 @@ test('town camera shows actual geometry at one third height and completes show f
418
461
  if (!landscape) {
419
462
  const playerScreen = new THREE.Vector3(player.x, player.y, player.z).project(cam);
420
463
  assert(box.right <= (playerScreen.x + 1) / 2 - 0.02, `${species}: fitted box clears the player centre`);
464
+ } else {
465
+ assert(box.right <= playerLeftScreen(player, cam) - 0.02, `${species}: landscape box clears the player's left side`);
421
466
  }
422
467
  assertShowAngle(bird, cam, 1.6);
423
468
  assertScreenUp(bird, cam);
@@ -453,6 +498,8 @@ test('town camera shows actual geometry at one third height and completes show f
453
498
  if (!landscape) {
454
499
  const playerScreen = new THREE.Vector3(player.x, player.y, player.z).project(cam);
455
500
  assert(turnBox.right <= (playerScreen.x + 1) / 2 - 0.02, `${species}: player margin throughout the turn`);
501
+ } else {
502
+ assert(turnBox.right <= playerLeftScreen(player, cam) - 0.02, `${species}: landscape player margin throughout the turn`);
456
503
  }
457
504
  assertShowAngle(bird, cam, now / 1000);
458
505
  assertScreenUp(bird, cam);
@@ -461,6 +508,49 @@ test('town camera shows actual geometry at one third height and completes show f
461
508
  }
462
509
  }
463
510
  });
511
+ // From the House wardrobe (#1105): a close landscape menu shot of the player
512
+ // put Chirp's show spot over the player's head. In landscape the fitted box
513
+ // now stays left of the player's left side, with the portrait margin.
514
+ test('a close landscape menu camera keeps the show box off the player', () => {
515
+ for (const species of ['songbird', 'owl', 'parrot', 'hummingbird']) {
516
+ for (const [w, h] of [[844, 390], [740, 360]]) {
517
+ const r = rig(), player = r.local.components.Transform;
518
+ const cam = new THREE.PerspectiveCamera(50, w / h, 0.1, 100);
519
+ cam.position.set(player.x + 0.2, player.y + 1.3, player.z + 1.8); cam.lookAt(player.x, player.y + 1, player.z); cam.updateMatrixWorld(true);
520
+ r.scene.three.camera = cam; r.scene.cameraControl = 'fixed';
521
+ const dress = { species };
522
+ r.hub.companion = { c: { look: 'bird', dress }, n: 2 }; r.frame(0);
523
+ r.hub.companion = { c: { look: 'bird', dress, pose: 'show' }, n: 3 };
524
+ for (let now = 50; now <= 1600; now += 50) { r.frame(now); }
525
+ const bird = r.root.children.find((n) => n.name === 'companion:bird');
526
+ const box = modelView(bird, cam);
527
+ assert(box.right <= playerLeftScreen(player, cam) - 0.02, `${species} ${w}x${h}: box right ${box.right} clears the player's left side ${playerLeftScreen(player, cam)}`);
528
+ assert(box.left >= 0.04 && box.top >= 0.04 && box.bottom <= 0.96, `${species}: inside the inset ${JSON.stringify(box)}`);
529
+ assert(box.depth >= cam.near + 0.15);
530
+ r.drawer.dispose();
531
+ }
532
+ }
533
+ });
534
+ // Review: with the player's left side at or past the left inset there is no
535
+ // strip left of the player; the box keeps the usual spot inside the inset
536
+ // rather than centring on (or past) the screen's edge.
537
+ test('a close landscape shot with the player at the left edge keeps the show box on screen', () => {
538
+ for (const species of ['songbird', 'owl']) {
539
+ const r = rig(), player = r.local.components.Transform;
540
+ const cam = new THREE.PerspectiveCamera(50, 844 / 390, 0.1, 100);
541
+ cam.position.set(player.x + 1.6, player.y + 1.3, player.z + 1.8); cam.lookAt(player.x + 2.2, player.y + 1, player.z); cam.updateMatrixWorld(true);
542
+ const left = playerLeftScreen(player, cam);
543
+ assert(left <= 0.04, `the player's left side is at or past the inset (${left})`);
544
+ r.scene.three.camera = cam; r.scene.cameraControl = 'fixed';
545
+ r.hub.companion = { c: { look: 'bird', dress: { species } }, n: 2 }; r.frame(0);
546
+ r.hub.companion = { c: { look: 'bird', dress: { species }, pose: 'show' }, n: 3 };
547
+ for (let now = 50; now <= 2400; now += 50) { r.frame(now); }
548
+ const box = modelView(r.root.children.find((n) => n.name === 'companion:bird'), cam);
549
+ assert(box.left >= 0.04 && box.right <= 0.96 && box.top >= 0.04 && box.bottom <= 0.96, `${species}: inside the inset ${JSON.stringify(box)}`);
550
+ assert(Math.abs(box.x - 0.35) < 0.015, `${species}: the usual landscape spot, ${box.x}`);
551
+ r.drawer.dispose();
552
+ }
553
+ });
464
554
  test('show restores quiet tophat to full scale and opaque paper on its first approach frame, including the orbit lens first frame', () => {
465
555
  for (const fov of [undefined, 90]) {
466
556
  const r = rig(), player = r.local.components.Transform;
@@ -794,8 +884,9 @@ test('walk-away within the target leash aborts once, and any chat returns home b
794
884
  const chat = { camera: { forward: { x: 0, z: -1 } } };
795
885
  r.drawer.frame(r.scene, r.local, r.hub, 0.05, 2050, true, chat);
796
886
  for (let now = 2100; now <= 4000; now += 50) r.drawer.frame(r.scene, r.local, r.hub, 0.05, now, true, chat);
797
- assert(Math.abs(bird.position.z - 1.7) < 0.05); assert(Math.abs(bird.rotation.y) < 0.01);
798
- r.frame(4050); const chatSpot = bird.position.clone(); assert(chatSpot.z < 2, 'new lead starts at the shared front spot');
887
+ const spot = Companion.chatTarget({ x: 2, y: 1, z: 3, yaw: 0 }, chat.camera, 0, undefined, undefined, undefined, bird.userData.size).z;
888
+ assert(Math.abs(bird.position.z - spot) < 0.05); assert(Math.abs(bird.rotation.y) < 0.01);
889
+ r.frame(4050); const chatSpot = bird.position.clone(); assert(Math.abs(chatSpot.z - spot) < 0.5, 'new lead starts from the chat spot');
799
890
  for (let now = 4100; now <= 7600; now += 50) { r.local.components.Transform.x += 0.1; r.frame(now); }
800
891
  const player = r.local.components.Transform;
801
892
  for (let now = 7650; now <= 10_000; now += 50) r.frame(now);
@@ -968,6 +1059,93 @@ test('glows skip self, follow/rebuild avatar nodes, hide on trips; absent local
968
1059
  r.hub.glow.clear(); r.frame(250); assert.equal(replacement.children.length, 0);
969
1060
  r.drawer.clear();
970
1061
  });
1062
+
1063
+ test('v1.181 hubChirp parses dress tuples, latches deltas and clears with place/session', () => {
1064
+ State.clear();
1065
+ assert(!Object.hasOwn(State.hub, 'chirp'));
1066
+ hook.state({}, { hubPlace: { id: 'main', companion: true }, hubChirp: [
1067
+ ['p1', null, null, null], ['p2', 'owl', 'tophat', 'mint'],
1068
+ ['bad', 'unknown', null, null], ['bad2', null, 'typed', null],
1069
+ ['bad3', null, null, 'unknown'], ['bad4', null, null, null, 'words'],
1070
+ ['bad5', undefined, null, null], null,
1071
+ ] });
1072
+ assert.deepEqual(State.hub.chirp, new Map([['p1', {}], ['p2', { species: 'owl', wear: 'tophat', tint: 'mint' }]]));
1073
+ hook.state({}, { hubGlow: ['p1', 'p2'] });
1074
+ assert.equal(State.hub.chirp.size, 2, 'absent delta key retains the whole block');
1075
+ hook.state({}, { hubChirp: [] }); assert.equal(State.hub.chirp.size, 0);
1076
+ hook.state({}, { hubChirp: [['p2', null, null, null]] });
1077
+ hook.state({}, { hubPlace: { id: 'main', companion: true } }); assert(!Object.hasOwn(State.hub, 'chirp'));
1078
+ hook.state({}, { hubChirp: [['p2', null, null, null]] });
1079
+ hook.state({}, { hubPlace: { id: 'plain' }, hubChirp: [['p2', null, null, null]] });
1080
+ assert(!Object.hasOwn(State.hub, 'chirp'));
1081
+ hook.state({}, { hubPlace: { id: 'main', companion: true }, hubChirp: [['p2', null, null, null]] });
1082
+ State.clear(); assert(!Object.hasOwn(State.hub, 'chirp'));
1083
+ });
1084
+ test('v1.181 others draw dressed birds at the shoulder; owner keeps full private follower', () => {
1085
+ for (const species of ['songbird', 'owl', 'parrot', 'hummingbird']) {
1086
+ const r = rig();
1087
+ r.hub.companion = { c: { look: 'bird', shown: true, dress: { species, tint: 'rose', wear: 'bow' }, say: 'Only me' }, n: 2 };
1088
+ r.frame();
1089
+ const own = r.root.children.find(n => n.name === 'companion:bird');
1090
+ const position = own.position.clone(), scale = own.scale.clone();
1091
+ r.hub.chirp = Companion.chirpMap([['p1', species, 'bow', 'rose'], ['p2', species, 'tophat', 'mint']]);
1092
+ r.frame();
1093
+ assert.equal(r.root.children.find(n => n.name === 'companion:bird'), own);
1094
+ assert(own.position.equals(position)); assert(own.scale.equals(scale));
1095
+ assert.equal(r.own.children.length, 0, 'no duplicate on self shoulder');
1096
+ const bird = r.other.children[0];
1097
+ assert.equal(bird.name, 'companion:bird'); assert.equal(r.other.children.length, 1, 'replaces the bare glow');
1098
+ near(bird.position.x, 0.4); near(bird.position.y, 0.75); near(bird.position.z, 0);
1099
+ assert(bird.scale.x < own.scale.x); assert(bird.getObjectByName('companion:wear:tophat'));
1100
+ const paper = [];
1101
+ bird.traverse(n => { if (n.material?.color.getHexString() === '87d8b0') paper.push(n); });
1102
+ assert(paper.length > 0, 'remote paper takes the public tint');
1103
+ assert.deepEqual(r.labels()[0].text, 'Only me'); assert.equal(r.labels().length, 1);
1104
+ let geometries = 0, materials = 0, disposedGeometry = 0, disposedMaterial = 0;
1105
+ bird.traverse(n => {
1106
+ if (n.geometry) { geometries++; n.geometry.addEventListener('dispose', () => disposedGeometry++); }
1107
+ if (n.material) { materials++; n.material.addEventListener('dispose', () => disposedMaterial++); }
1108
+ });
1109
+ r.hub.chirp = Companion.chirpMap([['p2', 'parrot', 'scarf', 'gold']]); r.frame(50);
1110
+ assert.equal(disposedGeometry, geometries); assert.equal(disposedMaterial, materials);
1111
+ assert(!bird.parent); assert(r.other.children[0].getObjectByName('companion:wear:scarf'));
1112
+ r.hub.chirp.clear(); r.frame(100); assert(r.other.children[0].isMesh, 'unshown follower returns to bare glow');
1113
+ r.hub.glow.clear(); r.frame(150); assert.equal(r.other.children.length, 0);
1114
+ r.drawer.dispose();
1115
+ }
1116
+ });
1117
+ test('v1.181 Low uses a tint-coloured glow, restores paper on High and disposes each replacement', () => {
1118
+ const r = rig(); r.hub.chirp = Companion.chirpMap([['p2', 'owl', 'tophat', 'midnight']]); r.frame();
1119
+ const bird = r.other.children[0]; let disposed = 0;
1120
+ bird.traverse(n => n.geometry?.addEventListener('dispose', () => disposed++));
1121
+ r.frame(50, true, false, true);
1122
+ assert(disposed > 0); assert(!bird.parent);
1123
+ const glow = r.other.children[0]; assert(glow.isMesh); assert.equal(glow.geometry.type, 'OctahedronGeometry');
1124
+ assert.equal(glow.material.color.getHexString(), '39436b');
1125
+ let glowDisposed = 0; glow.material.addEventListener('dispose', () => glowDisposed++);
1126
+ r.frame(100); assert.equal(glowDisposed, 1); assert.equal(r.other.children[0].name, 'companion:bird');
1127
+ r.hub.chirp = Companion.chirpMap([['p2', null, null, null]]); r.frame(150, true, false, true);
1128
+ assert.equal(r.other.children[0].material.color.getHexString(), 'ffd27a');
1129
+ r.drawer.dispose(); assert.equal(r.other.children.length, 0);
1130
+ });
1131
+ test('v1.181 birds hide with the drawn avatar and disappear for a blocked pair, including stale nodes', () => {
1132
+ State.clear();
1133
+ const r = rig(); r.hub.chirp = Companion.chirpMap([['p2', 'owl', 'bow', 'rose']]); r.frame();
1134
+ const bird = r.other.children[0];
1135
+ r.other.visible = false; r.frame(50);
1136
+ assert.equal(bird.parent.visible, false, 'avatar visibility hides its child bird');
1137
+ r.other.visible = true; r.frame(100, false); assert.equal(bird.visible, false, 'trip hides the bird');
1138
+ r.frame(150); assert.equal(bird.visible, true);
1139
+ // A blocked pair is omitted from this viewer's avatar map. Even a fading
1140
+ // old body must not retain its bird; unaffected viewers retain theirs.
1141
+ hook.state({}, { hubPlace: { id: 'main', companion: true }, hubAv: { p1: 0 }, hubChirp: [['p2', 'owl', 'bow', 'rose']] });
1142
+ r.hub.avatars = State.hub.avatars; r.hub.chirp = State.hub.chirp; r.frame(200);
1143
+ assert.equal(hook.avatar('p2', 'Blocked'), null); assert.equal(r.other.children.length, 0);
1144
+ hook.state({}, { hubAv: { p1: 0, p2: 0 } }); r.hub.avatars = State.hub.avatars; r.frame(250);
1145
+ assert.equal(r.other.children[0].name, 'companion:bird');
1146
+ r.scene.multiplayer.avatars.actors.delete('p2'); r.frame(300); assert.equal(r.other.children.length, 0);
1147
+ r.drawer.dispose(); State.clear();
1148
+ });
971
1149
  test('unknown point is ignored, known point faces the bird; clearing disposes both looks', () => {
972
1150
  const r = rig(); r.hub.companion.c = { ...spec, look: 'bird' }; r.frame();
973
1151
  const bird = r.root.children.find((n) => n.name === 'companion:bird');
@@ -980,13 +1158,13 @@ test('unknown point is ignored, known point faces the bird; clearing disposes bo
980
1158
  });
981
1159
  test('rehello drops stale private follower; avatar hello keeps it; new identity clears all', () => {
982
1160
  let system; installSystem({ registerSystem(value) { system = value; } });
983
- State.clear(); State.hub.place = { companion: true }; State.hub.companion = { c: spec, n: 1 }; State.hub.glow = new Set(['p1']);
1161
+ State.clear(); State.hub.place = { companion: true }; State.hub.companion = { c: spec, n: 1 }; State.hub.glow = new Set(['p1']); State.hub.chirp = new Map([['p1', {}]]);
984
1162
  const scene = { persistent: {} }, sent = []; let playerId = 'p1';
985
1163
  const net = { selfId: () => playerId, send: (msg) => sent.push(msg), drain: () => [] }, mp = { net };
986
1164
  system.sendHello(scene, mp, net, 0, { again: true }); assert.deepEqual(State.hub.companion, { c: spec, n: 1 });
987
1165
  system.sendHello(scene, mp, net, 0, { resume: true }); assert(!Object.hasOwn(State.hub, 'companion')); assert.equal(sent.at(-1).resume, true);
988
1166
  hook.message({}, { k: 'hub-companion', c: spec, n: 1 });
989
- playerId = 'p2'; net.drain(); assert(!Object.hasOwn(State.hub, 'companion')); assert(!Object.hasOwn(State.hub, 'glow'));
1167
+ playerId = 'p2'; net.drain(); assert(!Object.hasOwn(State.hub, 'chirp')); assert(!Object.hasOwn(State.hub, 'companion')); assert(!Object.hasOwn(State.hub, 'glow'));
990
1168
  });
991
1169
  test('same-id rehello asks the open talk panel to reattach after sending hello', () => {
992
1170
  let system; installSystem({ registerSystem(value) { system = value; } });
@@ -1024,6 +1202,10 @@ test('system keyless frame creates nothing; opt-in creates drawer and removal di
1024
1202
  system.talk.talkingWith = () => 'rowan'; system.afterBehaviors(scene, 0.05); assert.equal(busy.at(-1), false);
1025
1203
  system.companionTappedUntil = performance.now() + 3000; system.afterBehaviors(scene, 0.05); assert.equal(busy.at(-1), true);
1026
1204
  system.companionTappedUntil = -Infinity; system.afterBehaviors(scene, 0.05); assert.equal(busy.at(-1), false);
1205
+ const low = []; system.companion.frame = (...args) => low.push(args[9]);
1206
+ system.lowTier = true; system.afterBehaviors(scene, 0.05); assert.equal(low.at(-1), true);
1207
+ system.lowTier = false; system.afterBehaviors(scene, 0.05); assert.equal(low.at(-1), false);
1208
+ delete system.lowTier;
1027
1209
  hook.state({}, { hubPlace: { id: 'main' } }); system.afterBehaviors(scene, 0.05); assert(!Object.hasOwn(system, 'companion'));
1028
1210
  assert(!Object.hasOwn(system, 'companionTappedUntil'));
1029
1211
  });