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
@@ -1,8 +1,12 @@
1
- // Writes the kit's four player avatars, `models/avatar-0.pxmodel` to
2
- // `avatar-3.pxmodel`: the Castle mascot, Petal, Beat and Star, in the hub's
3
- // toon style. Run from the kit: `node scripts/gen-avatars.mjs` (or with a
4
- // directory to write into instead of `models/`). The model files are this
5
- // script's output; change a character here and run it again.
1
+ // Writes the kit's sixteen player avatars, `models/avatar-0.pxmodel` to
2
+ // `avatar-15.pxmodel`, in the hub's toon style: the Castle mascot, Petal, Beat
3
+ // and Star, then (v1.51) Biscuit, Mochi, Hop, Pip, Ribbit, Ember, Bolt, Gloop,
4
+ // Cap, Toast, Scoop and Zest. It also writes `code/client/avatarFaces.js`, each
5
+ // character's name and the small face the picker shows for it. Run from the
6
+ // kit: `node scripts/gen-avatars.mjs` (or with a directory to write everything
7
+ // into instead). The model files and the faces are this script's output;
8
+ // change a character here and run it again (scripts/test-avatar.mjs holds the
9
+ // files to it).
6
10
  //
7
11
  // What every avatar keeps, because the kit and the phone budget depend on it:
8
12
  // - part ids `torso`, `head`, `legL`, `legR`, `armL`, `armR` (the walk moves
@@ -11,7 +15,13 @@
11
15
  // batches (torso, head, two legs, two arms) plus an outline on the torso and
12
16
  // the head only. The limbs are ink-coloured and unoutlined, since an outline
13
17
  // on each would be four more draw calls;
14
- // - flat colours: no textures and no glow.
18
+ // - flat colours: no textures and no glow;
19
+ // - a crown a hat can sit on: rounded or flat, with ears, horns, stalks and
20
+ // leaves beside or behind it. Each avatar's height and hat fit, measured on
21
+ // its model, are in `code/client/avatar.js` (`TOPS`, `HAT_FITS`);
22
+ // - no part under 3.5 cm in radius on the torso or the head (the engine
23
+ // outlines those apart, a draw call more), and no part called `tail`,
24
+ // `wingL` or `wingR` (the engine moves those by name, each in its own batch).
15
25
 
16
26
  import fs from 'node:fs';
17
27
  import path from 'node:path';
@@ -19,6 +29,10 @@ import { fileURLToPath } from 'node:url';
19
29
 
20
30
  const KIT_DIR = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
21
31
  const OUT_DIR = process.argv[2] ? path.resolve(process.argv[2]) : path.join(KIT_DIR, 'models');
32
+ const FACES_FILE = path.join(
33
+ process.argv[2] ? OUT_DIR : path.join(KIT_DIR, 'code', 'client'),
34
+ 'avatarFaces.js',
35
+ );
22
36
 
23
37
  const INK = '#241a2e';
24
38
  const WHITE = '#ffffff';
@@ -156,7 +170,7 @@ function onHead({ radius, scale }, x, y, lift = 0) {
156
170
  // A round patch lying on the face, +z before `at` turns it: an eye, a glint,
157
171
  // a cheek. A squashed sphere, not a disc: a disc's outline hull shows as a
158
172
  // ring round it, while a sphere's only thickens its edge.
159
- function patch(id, at, { r, wide = 1, tall = 1, segments = 6, mirror = true }, color) {
173
+ function patch(id, at, { r, wide = 1, tall = 1, deep = 0.3, segments = 6, mirror = true }, color) {
160
174
  const part = {
161
175
  id,
162
176
  parent: 'head',
@@ -164,7 +178,7 @@ function patch(id, at, { r, wide = 1, tall = 1, segments = 6, mirror = true }, c
164
178
  radius: r,
165
179
  position: at.position,
166
180
  rotation: at.rotation,
167
- scale: [wide, tall, 0.3],
181
+ scale: [wide, tall, deep],
168
182
  segments,
169
183
  };
170
184
  if (mirror) {
@@ -175,12 +189,12 @@ function patch(id, at, { r, wide = 1, tall = 1, segments = 6, mirror = true }, c
175
189
 
176
190
  // Two ink ovals with a white glint each. `at(x, y, lift)` places a point on
177
191
  // the face.
178
- function eyes(at, { x, y, r, wide = 1, tall = 1, glint = 0.036 }) {
192
+ function eyes(at, { x, y, r, wide = 1, tall = 1, glint = 0.036, lift = 0 }) {
179
193
  return [
180
- patch('eye', at(x, y, 0), { r, wide, tall, segments: 8 }, INK),
194
+ patch('eye', at(x, y, lift), { r, wide, tall, segments: 8 }, INK),
181
195
  patch(
182
196
  'glint',
183
- at(x + r * wide * 0.3, y + r * tall * 0.4, r * 0.3),
197
+ at(x + r * wide * 0.3, y + r * tall * 0.4, lift + r * 0.3),
184
198
  { r: glint, segments: 4 },
185
199
  WHITE,
186
200
  ),
@@ -199,6 +213,19 @@ function starOutline(count, outer, inner) {
199
213
  return points;
200
214
  }
201
215
 
216
+ // A character's face for the picker: the inside of a 24 x 24 SVG, drawn in
217
+ // the character's own colours with the ink line (`write` adds the rest).
218
+ // Two ink dots for eyes, unless a face draws its own.
219
+ function dots(y, x = 2.6, r = 1.5) {
220
+ return `<g fill="${INK}" stroke="none"><circle cx="${12 - x}" cy="${y}" r="${r}"/><circle cx="${12 + x}" cy="${y}" r="${r}"/></g>`;
221
+ }
222
+ const disc = (cx, cy, r, fill, more = '') =>
223
+ `<circle cx="${cx}" cy="${cy}" r="${r}" fill="${fill}"${more}/>`;
224
+ const oval = (cx, cy, rx, ry, fill) =>
225
+ `<ellipse cx="${cx}" cy="${cy}" rx="${rx}" ry="${ry}" fill="${fill}"/>`;
226
+ const shape = (d, fill, more = '') => `<path d="${d}" fill="${fill}"${more}/>`;
227
+ const BARE = ' stroke="none"';
228
+
202
229
  //
203
230
  // 0: the Castle mascot. One black body rounded on top, one almond eye, and
204
231
  // the logo's white sheen down its side.
@@ -316,7 +343,13 @@ function mascot() {
316
343
  patch('pupil', flatOn(0, 0, -0.01), { r: 0.108, segments: 10, mirror: false }, INK),
317
344
  patch('glint', flatOn(0.042, 0.046, 0.016), { r: 0.038, mirror: false }, WHITE),
318
345
  );
319
- return { name: 'Castle', look: { ...LOOK, outlineColor: MASCOT_LINE }, parts };
346
+ const icon = [
347
+ shape('M5 22V10a7 7 0 0 1 14 0v12z', '#4a4556'),
348
+ shape('M7.2 19.5V10a4.8 4.8 0 0 1 1.6-3.6', 'none', ` stroke="${WHITE}"`),
349
+ shape('M7.6 13.4q4.4-4.6 8.8 0q-4.4 4.6-8.8 0z', WHITE),
350
+ disc(12, 13.4, 1.8, INK, BARE),
351
+ ];
352
+ return { name: 'Castle', look: { ...LOOK, outlineColor: MASCOT_LINE }, parts, icon };
320
353
  }
321
354
 
322
355
  //
@@ -412,7 +445,11 @@ function petal() {
412
445
  ),
413
446
  );
414
447
  parts.find((part) => part.id === 'mouth').rotation[2] = 180;
415
- return { name: 'Petal', parts };
448
+ const icon = [0, 60, 120, 180, 240, 300].map((turn) =>
449
+ disc(round(12 + 6.6 * Math.sin(rad(turn))), round(12 - 6.6 * Math.cos(rad(turn))), 4, pink),
450
+ );
451
+ icon.push(disc(12, 12, 6.4, '#fff1cf'), dots(12));
452
+ return { name: 'Petal', parts, icon };
416
453
  }
417
454
 
418
455
  //
@@ -512,7 +549,14 @@ function beat() {
512
549
  ),
513
550
  patch('tongue', at(0, -0.118, 0.012), { r: 0.045, tall: 0.5, mirror: false }, '#ff5fa2'),
514
551
  );
515
- return { name: 'Beat', parts };
552
+ const icon = [
553
+ shape('M4 13a8 8 0 0 1 16 0', 'none', ' stroke-width="2.2"'),
554
+ disc(12, 14, 7.5, '#38b6ff'),
555
+ oval(3.6, 14.5, 2, 3.4, orange),
556
+ oval(20.4, 14.5, 2, 3.4, orange),
557
+ dots(13.5),
558
+ ];
559
+ return { name: 'Beat', parts, icon };
516
560
  }
517
561
 
518
562
  //
@@ -572,7 +616,847 @@ function star() {
572
616
  orange,
573
617
  ),
574
618
  );
575
- return { name: 'Star', parts };
619
+ const icon = [
620
+ shape(
621
+ 'M12 1.5l3 6.6 7.2.8-5.4 4.9 1.5 7.1L12 17.3l-6.3 3.6 1.5-7.1L1.8 8.9l7.2-.8z',
622
+ '#ffd21f',
623
+ ),
624
+ dots(11.5, 2.2, 1.3),
625
+ ];
626
+ return { name: 'Star', parts, icon };
627
+ }
628
+
629
+ //
630
+ // Shared by the twelve after Star.
631
+ //
632
+
633
+ // The usual body: a rounded lathe from the hips to the neck.
634
+ const BODY = [
635
+ [0, -0.07],
636
+ [0.19, -0.02],
637
+ [0.24, 0.12],
638
+ [0.2, 0.28],
639
+ [0.12, 0.39],
640
+ [0, 0.42],
641
+ ];
642
+
643
+ // A part hung on another, coloured.
644
+ function on(parent, id, kind, color, fields) {
645
+ return mat({ id, parent, kind, ...fields }, color);
646
+ }
647
+
648
+ function ball(parent, id, color, radius, position, { scale, rotation, segments = 6, mirror } = {}) {
649
+ const part = { id, parent, kind: 'sphere', radius, position: position.map(round), segments };
650
+ if (scale) {
651
+ part.scale = scale;
652
+ }
653
+ if (rotation) {
654
+ part.rotation = rotation;
655
+ }
656
+ if (mirror) {
657
+ part.mirror = 'x';
658
+ }
659
+ return mat(part, color);
660
+ }
661
+
662
+ function cone(
663
+ parent,
664
+ id,
665
+ color,
666
+ radius,
667
+ height,
668
+ position,
669
+ rotation,
670
+ { segments = 5, scale, mirror } = {},
671
+ ) {
672
+ const part = {
673
+ id,
674
+ parent,
675
+ kind: 'cone',
676
+ radius,
677
+ height,
678
+ position: position.map(round),
679
+ rotation,
680
+ segments,
681
+ };
682
+ if (scale) {
683
+ part.scale = scale;
684
+ }
685
+ if (mirror) {
686
+ part.mirror = 'x';
687
+ }
688
+ return mat(part, color);
689
+ }
690
+
691
+ function roundHead(spec, y, color, segments = 10) {
692
+ return mat(
693
+ { id: 'head', parent: 'torso', kind: 'sphere', position: [0, y, 0], ...spec, segments },
694
+ color,
695
+ );
696
+ }
697
+
698
+ // `onHead` for a ball that is not at the head's pivot: a face mask, a snout.
699
+ function onBall(center, spec) {
700
+ return (x, y, lift) => {
701
+ const at = onHead(spec, x - center[0], y - center[1], lift);
702
+ return { position: at.position.map((v, k) => round(v + center[k])), rotation: at.rotation };
703
+ };
704
+ }
705
+
706
+ // `onHead` for a head that is a lathe: the point of its surface in front of
707
+ // [x, y] (behind it with `back`), pushed `lift` along the normal.
708
+ function onLathe(profile) {
709
+ return (x, y, lift = 0, back = false) => {
710
+ let k = 0;
711
+ while (k < profile.length - 2 && profile[k + 1][1] < y) {
712
+ k += 1;
713
+ }
714
+ const [r0, y0] = profile[k];
715
+ const [r1, y1] = profile[k + 1];
716
+ const r = r0 + ((r1 - r0) * (y - y0)) / (y1 - y0);
717
+ const side = back ? -1 : 1;
718
+ const z = side * Math.sqrt(Math.max(0, r * r - x * x));
719
+ // Outward, and up where the profile narrows upward.
720
+ const slope = Math.atan2(r0 - r1, y1 - y0);
721
+ const normal = [(Math.cos(slope) * x) / r, Math.sin(slope), (Math.cos(slope) * z) / r];
722
+ return {
723
+ position: [
724
+ round(x + normal[0] * lift),
725
+ round(y + normal[1] * lift),
726
+ round(z + normal[2] * lift),
727
+ ],
728
+ rotation: [
729
+ round(-deg(Math.asin(normal[1])) * side),
730
+ round(deg(Math.atan2(normal[0], normal[2]))),
731
+ 0,
732
+ ],
733
+ };
734
+ };
735
+ }
736
+
737
+ // A smile: half a thin ring, lying on the face at `at`.
738
+ function smile(at, radius = 0.045, tube = 0.016) {
739
+ const part = mat(
740
+ { id: 'mouth', parent: 'head', kind: 'torus', radius, tube, arc: 180, ...at, segments: 6 },
741
+ INK,
742
+ );
743
+ part.rotation[2] = 180;
744
+ return part;
745
+ }
746
+
747
+ function cheeks(at, color, r = 0.046) {
748
+ return patch('cheek', at, { r, tall: 0.7, segments: 5 }, color);
749
+ }
750
+
751
+ //
752
+ // 4: Biscuit, a puppy.
753
+ //
754
+
755
+ function biscuit() {
756
+ const tan = '#c79a68';
757
+ const brown = '#6b3d20';
758
+ const cream = '#ffe6bf';
759
+ const head = { radius: 0.3, scale: [1.05, 0.95, 1] };
760
+ const at = (x, y, lift) => onHead(head, x, y, lift);
761
+ const muzzle = [0, -0.09, 0.2];
762
+ const parts = limbs({ shoe: brown });
763
+ parts.push(
764
+ torso(BODY, tan),
765
+ roundHead(head, 0.68, tan),
766
+ // The patch round one eye: a ball inside the head that breaks its surface.
767
+ // A patch round one eye; that eye stands on it.
768
+ patch('eyePatch', at(0.13, 0.05, -0.012), { r: 0.135, tall: 1.1, mirror: false }, brown),
769
+ patch('eyeL', at(0.115, 0.04, 0.03), { r: 0.07, tall: 1.15, segments: 8, mirror: false }, INK),
770
+ patch('glintL', at(0.136, 0.072, 0.052), { r: 0.036, segments: 4, mirror: false }, WHITE),
771
+ patch('eyeR', at(-0.115, 0.04, 0), { r: 0.07, tall: 1.15, segments: 8, mirror: false }, INK),
772
+ patch('glintR', at(-0.094, 0.072, 0.022), { r: 0.036, segments: 4, mirror: false }, WHITE),
773
+ ball('head', 'muzzle', cream, 0.135, muzzle, { scale: [1.25, 0.85, 0.9] }),
774
+ ball('head', 'nose', INK, 0.05, [0, -0.045, 0.325], { scale: [1.25, 0.85, 0.8] }),
775
+ ball('head', 'tongue', '#ff5f8f', 0.045, [0, -0.175, 0.285], {
776
+ scale: [0.9, 1.1, 0.5],
777
+ segments: 4,
778
+ }),
779
+ // Floppy ears hang down the sides, clear of the crown.
780
+ ball('head', 'ear', brown, 0.13, [0.305, -0.03, -0.02], {
781
+ scale: [0.5, 1.45, 0.85],
782
+ rotation: [0, 0, 10],
783
+ mirror: true,
784
+ }),
785
+ on('torso', 'collar', 'cylinder', '#e8463c', {
786
+ radius: 0.15,
787
+ height: 0.055,
788
+ position: [0, 0.385, 0],
789
+ segments: 8,
790
+ }),
791
+ cone('torso', 'tailA', tan, 0.06, 0.24, [0, 0.13, -0.27], [-48, 0, 0]),
792
+ );
793
+ const icon = [
794
+ disc(12, 13, 8, tan),
795
+ oval(4.3, 13.5, 2.4, 5.4, brown),
796
+ oval(19.7, 13.5, 2.4, 5.4, brown),
797
+ disc(14.8, 11.6, 3.1, brown, BARE),
798
+ dots(11.6),
799
+ oval(12, 15.6, 1.9, 1.3, INK),
800
+ ];
801
+ return { name: 'Biscuit', parts, icon };
802
+ }
803
+
804
+ //
805
+ // 5: Mochi, a cat.
806
+ //
807
+
808
+ function mochi() {
809
+ const fur = '#686c7d';
810
+ const white = '#fffaf2';
811
+ const pink = '#ff7fae';
812
+ const head = { radius: 0.3, scale: [1.08, 0.92, 1] };
813
+ const at = (x, y, lift) => onHead(head, x, y, lift);
814
+ const parts = limbs({ shoe: pink });
815
+ parts.push(
816
+ torso(BODY, fur),
817
+ roundHead(head, 0.68, fur),
818
+ // Ears stand at the sides of the crown, so a hat sits between them.
819
+ cone('head', 'ear', fur, 0.115, 0.21, [0.215, 0.27, -0.02], [0, 0, -24], {
820
+ segments: 4,
821
+ mirror: true,
822
+ }),
823
+ cone('head', 'earIn', pink, 0.07, 0.14, [0.212, 0.262, 0.028], [0, 0, -24], {
824
+ segments: 4,
825
+ mirror: true,
826
+ }),
827
+ ...eyes(at, { x: 0.12, y: 0.035, r: 0.075, wide: 0.9, tall: 1.2 }),
828
+ ball('head', 'muzzle', white, 0.115, [0, -0.095, 0.2], { scale: [1.3, 0.8, 0.9] }),
829
+ ball('head', 'nose', pink, 0.04, [0, -0.06, 0.3], { scale: [1.2, 0.8, 0.7], segments: 4 }),
830
+ on('head', 'whiskerA', 'cylinder', INK, {
831
+ radius: 0.011,
832
+ height: 0.17,
833
+ position: [0.25, -0.075, 0.2],
834
+ rotation: [0, 20, 80],
835
+ segments: 3,
836
+ mirror: 'x',
837
+ }),
838
+ on('head', 'whiskerB', 'cylinder', INK, {
839
+ radius: 0.011,
840
+ height: 0.17,
841
+ position: [0.25, -0.125, 0.2],
842
+ rotation: [0, 20, 100],
843
+ segments: 3,
844
+ mirror: 'x',
845
+ }),
846
+ // The tail curls up behind.
847
+ on('torso', 'tailA', 'torus', fur, {
848
+ radius: 0.12,
849
+ tube: 0.042,
850
+ arc: 230,
851
+ position: [0, 0.2, -0.3],
852
+ rotation: [0, 90, 205],
853
+ segments: 6,
854
+ }),
855
+ );
856
+ const icon = [
857
+ shape('M4.6 11 5.4 3l5.4 3.6zM19.4 11 18.6 3l-5.4 3.6z', fur),
858
+ disc(12, 14, 8, fur),
859
+ shape('M1.5 14.5h4M18.5 14.5h4', 'none'),
860
+ dots(13),
861
+ oval(12, 16.2, 1.3, 0.9, pink),
862
+ ];
863
+ return { name: 'Mochi', parts, icon };
864
+ }
865
+
866
+ //
867
+ // 6: Hop, a bunny.
868
+ //
869
+
870
+ function hop() {
871
+ const white = '#fbf6ee';
872
+ const pink = '#ff8fb3';
873
+ const head = { radius: 0.29, scale: [1.04, 0.97, 1] };
874
+ const at = (x, y, lift) => onHead(head, x, y, lift);
875
+ const parts = limbs({ shoe: pink });
876
+ parts.push(
877
+ torso(BODY, white),
878
+ roundHead(head, 0.68, white),
879
+ // Two tall ears rise from the back of the crown, behind where a hat sits.
880
+ ball('head', 'ear', white, 0.1, [0.12, 0.37, -0.23], {
881
+ scale: [0.6, 2, 0.42],
882
+ rotation: [-8, 0, -8],
883
+ mirror: true,
884
+ }),
885
+ ball('head', 'earIn', pink, 0.07, [0.12, 0.37, -0.2], {
886
+ scale: [0.5, 2.1, 0.3],
887
+ rotation: [-8, 0, -8],
888
+ segments: 5,
889
+ mirror: true,
890
+ }),
891
+ ...eyes(at, { x: 0.11, y: 0.035, r: 0.072, wide: 0.9, tall: 1.2 }),
892
+ ball('head', 'nose', pink, 0.04, at(0, -0.05, 0.002).position, {
893
+ scale: [1.2, 0.8, 0.6],
894
+ segments: 4,
895
+ }),
896
+ on('head', 'teeth', 'box', '#ffffff', {
897
+ size: [0.075, 0.06, 0.04],
898
+ position: at(0, -0.125, 0).position,
899
+ rotation: at(0, -0.125, 0).rotation,
900
+ }),
901
+ cheeks(at(0.2, -0.08, 0), pink),
902
+ ball('torso', 'tailA', white, 0.095, [0, 0.07, -0.23]),
903
+ );
904
+ const icon = [
905
+ oval(8.6, 6.4, 2.2, 5.4, white),
906
+ oval(15.4, 6.4, 2.2, 5.4, white),
907
+ shape('M8.6 3.5v5M15.4 3.5v5', 'none', ` stroke="${pink}" stroke-width="1.5"`),
908
+ disc(12, 15.5, 7, white),
909
+ dots(14.5),
910
+ oval(12, 17.4, 1.2, 0.9, pink),
911
+ ];
912
+ return { name: 'Hop', parts, icon };
913
+ }
914
+
915
+ //
916
+ // 7: Pip, a penguin.
917
+ //
918
+
919
+ function pip() {
920
+ const navy = '#27356e';
921
+ const white = '#ffffff';
922
+ const orange = '#ff9326';
923
+ const head = { radius: 0.28, scale: [1.05, 0.96, 1] };
924
+ const mask = { radius: 0.225, scale: [1.04, 0.95, 1] };
925
+ const maskAt = [0, -0.035, 0.125];
926
+ const at = onBall(maskAt, mask);
927
+ const parts = limbs({ shoe: orange, mitt: navy });
928
+ parts.push(
929
+ torso(
930
+ [
931
+ [0, -0.07],
932
+ [0.22, -0.03],
933
+ [0.28, 0.12],
934
+ [0.24, 0.29],
935
+ [0.14, 0.4],
936
+ [0, 0.43],
937
+ ],
938
+ navy,
939
+ ),
940
+ ball('torso', 'belly', white, 0.21, [0, 0.14, 0.15], { scale: [1, 1.12, 0.75] }),
941
+ roundHead(head, 0.68, navy),
942
+ ball('head', 'mask', white, mask.radius, maskAt, { scale: mask.scale, segments: 10 }),
943
+ ...eyes(at, { x: 0.1, y: 0.03, r: 0.062, tall: 1.15 }),
944
+ cone('head', 'beak', orange, 0.075, 0.14, [0, -0.075, 0.37], [90, 0, 0], {
945
+ scale: [1.25, 1, 0.7],
946
+ }),
947
+ cheeks(at(0.17, -0.07, 0), '#ff8fb3', 0.04),
948
+ cone('torso', 'tailA', navy, 0.07, 0.16, [0, 0.03, -0.27], [-70, 0, 0]),
949
+ );
950
+ const icon = [
951
+ disc(12, 12.5, 9, navy),
952
+ oval(12, 14, 6.4, 5.8, white),
953
+ dots(12.6),
954
+ shape('M10.3 15h3.4L12 17.8z', orange),
955
+ ];
956
+ return { name: 'Pip', parts, icon };
957
+ }
958
+
959
+ //
960
+ // 8: Ribbit, a frog.
961
+ //
962
+
963
+ function ribbit() {
964
+ const green = '#4fbf3f';
965
+ const cream = '#fff3b8';
966
+ const head = { radius: 0.3, scale: [1.28, 0.74, 1] };
967
+ const at = (x, y, lift) => onHead(head, x, y, lift);
968
+ const bump = [0.235, 0.15, 0.05];
969
+ const bumpR = 0.108;
970
+ const eyeAt = (x, y, lift) => ({
971
+ position: [round(bump[0] + x), round(bump[1] + y), round(bump[2] + bumpR + lift)],
972
+ rotation: [0, 0, 0],
973
+ });
974
+ const parts = limbs({ shoe: green, mitt: cream });
975
+ parts.push(
976
+ torso(BODY, green),
977
+ ball('torso', 'belly', cream, 0.17, [0, 0.13, 0.14], { scale: [1, 1.1, 0.75], segments: 8 }),
978
+ roundHead(head, 0.64, green),
979
+ // The eyes stand on two bumps at the sides of the crown.
980
+ ball('head', 'bump', green, bumpR, bump, { mirror: true }),
981
+ patch('eye', eyeAt(0, 0.005, -0.012), { r: 0.066, segments: 8 }, INK),
982
+ patch('glint', eyeAt(0.02, 0.03, 0.006), { r: 0.036, segments: 4 }, WHITE),
983
+ // A wide mouth: an arc of a ring standing in the face.
984
+ on('head', 'mouth', 'torus', INK, {
985
+ radius: 0.16,
986
+ tube: 0.016,
987
+ arc: 120,
988
+ position: [0, 0.1, 0.283],
989
+ rotation: [0, 0, 210],
990
+ segments: 8,
991
+ }),
992
+ cheeks(at(0.25, -0.03, 0), '#ff8fb3'),
993
+ );
994
+ const icon = [
995
+ disc(6.8, 8, 3.6, green),
996
+ disc(17.2, 8, 3.6, green),
997
+ oval(12, 14.5, 10, 7, green),
998
+ dots(8, 5.2, 1.6),
999
+ shape('M7 15.5q5 4 10 0', 'none'),
1000
+ ];
1001
+ return { name: 'Ribbit', parts, icon };
1002
+ }
1003
+
1004
+ //
1005
+ // 9: Ember, a little dragon.
1006
+ //
1007
+
1008
+ function ember() {
1009
+ const purple = '#7a3fd0';
1010
+ const lilac = '#c9adf8';
1011
+ const flame = '#ff9a2e';
1012
+ const horn = '#ffe9a8';
1013
+ const head = { radius: 0.29, scale: [1.02, 0.95, 1] };
1014
+ const at = (x, y, lift) => onHead(head, x, y, lift);
1015
+ // The muzzle: a paler bump low on the face, nostrils on top, a mouth below.
1016
+ const muzzle = { radius: 0.135, scale: [1.15, 0.8, 1.1] };
1017
+ const muzzleAt = [0, -0.105, 0.2];
1018
+ const onMuzzle = onBall(muzzleAt, muzzle);
1019
+ const parts = limbs({ shoe: purple });
1020
+ parts.push(
1021
+ torso(BODY, purple),
1022
+ ball('torso', 'belly', flame, 0.17, [0, 0.13, 0.14], { scale: [0.95, 1.1, 0.75] }),
1023
+ roundHead(head, 0.68, purple),
1024
+ ball('head', 'muzzle', lilac, muzzle.radius, muzzleAt, { scale: muzzle.scale }),
1025
+ patch('nostril', onMuzzle(0.048, -0.045, -0.004), { r: 0.036, wide: 0.55, segments: 4 }, INK),
1026
+ smile(onMuzzle(0, -0.125, 0.002), 0.05, 0.014),
1027
+ ...eyes(at, { x: 0.12, y: 0.085, r: 0.07, tall: 1.15 }),
1028
+ // Horns at the sides of the crown, leaning out and back.
1029
+ cone('head', 'horn', horn, 0.058, 0.19, [0.215, 0.27, -0.07], [-18, 0, -30], { mirror: true }),
1030
+ cone('head', 'spikeA', flame, 0.07, 0.16, [0, 0.13, -0.3], [-75, 0, 0]),
1031
+ cone('torso', 'spikeB', flame, 0.07, 0.15, [0, 0.3, -0.21], [-80, 0, 0]),
1032
+ cone('torso', 'tailA', purple, 0.1, 0.42, [0, 0.03, -0.33], [-105, 0, 0], { segments: 6 }),
1033
+ cone('torso', 'tailTip', flame, 0.085, 0.16, [0, -0.045, -0.6], [-105, 0, 0], {
1034
+ scale: [1, 1, 0.5],
1035
+ }),
1036
+ on('torso', 'wing', 'extrude', '#5a2aa8', {
1037
+ outline: [
1038
+ [0, 0],
1039
+ [0.2, 0.17],
1040
+ [0.21, 0.02],
1041
+ [0.13, 0.04],
1042
+ [0.11, -0.07],
1043
+ ],
1044
+ depth: 0.035,
1045
+ flat: false,
1046
+ position: [0.1, 0.22, -0.2],
1047
+ rotation: [0, -40, 0],
1048
+ mirror: 'x',
1049
+ }),
1050
+ );
1051
+ const icon = [
1052
+ shape('M5.2 9.5 3.6 2.6l5.6 3.6zM18.8 9.5l1.6-6.9-5.6 3.6z', horn),
1053
+ shape('M12 1.8l2.2 4h-4.4z', flame),
1054
+ disc(12, 13.5, 8, purple),
1055
+ dots(11.4),
1056
+ oval(12, 17, 4, 2.9, lilac),
1057
+ dots(16, 1.3, 0.6),
1058
+ shape('M10.6 18.2q1.4 1 2.8 0', 'none', ' stroke-width="1"'),
1059
+ ];
1060
+ return { name: 'Ember', parts, icon };
1061
+ }
1062
+
1063
+ //
1064
+ // 10: Bolt, a robot.
1065
+ //
1066
+
1067
+ function bolt() {
1068
+ const steel = '#b5c1cf';
1069
+ const dark = '#3a4558';
1070
+ const yellow = '#ffc531';
1071
+ const cyan = '#35e0ff';
1072
+ const front = 0.22;
1073
+ const parts = limbs({ shoe: dark, mitt: yellow });
1074
+ parts.push(
1075
+ mat(
1076
+ {
1077
+ id: 'torso',
1078
+ kind: 'box',
1079
+ position: [0, HIP, 0],
1080
+ offset: [0, 0.17, 0],
1081
+ size: [0.38, 0.42, 0.28],
1082
+ round: 0.05,
1083
+ roundSegments: 1,
1084
+ },
1085
+ steel,
1086
+ ),
1087
+ on('torso', 'panel', 'box', dark, { size: [0.22, 0.15, 0.03], position: [0, 0.2, 0.135] }),
1088
+ ball('torso', 'light', '#ff4d4d', 0.04, [-0.05, 0.215, 0.15], {
1089
+ scale: [1, 1, 0.5],
1090
+ segments: 4,
1091
+ }),
1092
+ on('torso', 'dial', 'box', yellow, {
1093
+ size: [0.07, 0.035, 0.03],
1094
+ position: [0.05, 0.215, 0.143],
1095
+ }),
1096
+ on('torso', 'neck', 'cylinder', dark, {
1097
+ radius: 0.075,
1098
+ height: 0.1,
1099
+ position: [0, 0.43, 0],
1100
+ segments: 6,
1101
+ }),
1102
+ mat(
1103
+ {
1104
+ id: 'head',
1105
+ parent: 'torso',
1106
+ kind: 'box',
1107
+ position: [0, 0.69, 0],
1108
+ size: [0.56, 0.44, 0.44],
1109
+ round: 0.07,
1110
+ roundSegments: 1,
1111
+ },
1112
+ steel,
1113
+ ),
1114
+ // One visor strip, with two lights in it for eyes.
1115
+ on('head', 'visor', 'box', INK, {
1116
+ size: [0.46, 0.15, 0.04],
1117
+ position: [0, 0.035, front - 0.004],
1118
+ }),
1119
+ ball('head', 'eye', cyan, 0.05, [0.11, 0.035, front + 0.012], {
1120
+ scale: [1, 1.1, 0.4],
1121
+ mirror: true,
1122
+ }),
1123
+ on('head', 'mouth', 'box', INK, {
1124
+ size: [0.18, 0.035, 0.03],
1125
+ position: [0, -0.12, front - 0.006],
1126
+ }),
1127
+ on('head', 'ear', 'cylinder', yellow, {
1128
+ radius: 0.085,
1129
+ height: 0.07,
1130
+ position: [0.3, 0, 0],
1131
+ rotation: [0, 0, 90],
1132
+ segments: 8,
1133
+ mirror: 'x',
1134
+ }),
1135
+ // The antenna stands on one ear, beside the head: the crown stays flat.
1136
+ on('head', 'mast', 'cylinder', INK, {
1137
+ radius: 0.016,
1138
+ height: 0.24,
1139
+ position: [0.33, 0.17, 0],
1140
+ segments: 4,
1141
+ }),
1142
+ ball('head', 'bulb', '#ff4d4d', 0.05, [0.33, 0.3, 0]),
1143
+ );
1144
+ const icon = [
1145
+ shape('M20.5 10V4', 'none'),
1146
+ disc(20.5, 3.4, 1.7, '#ff4d4d'),
1147
+ `<rect x="3.5" y="6.5" width="16" height="14" rx="2.6" fill="${steel}"/>`,
1148
+ `<rect x="5.6" y="9.4" width="11.8" height="5" rx="1.2" fill="${INK}"/>`,
1149
+ `<g fill="${cyan}" stroke="none"><circle cx="9" cy="11.9" r="1.4"/><circle cx="14" cy="11.9" r="1.4"/></g>`,
1150
+ shape('M9 17.6h5', 'none'),
1151
+ ];
1152
+ return { name: 'Bolt', parts, icon };
1153
+ }
1154
+
1155
+ //
1156
+ // 11: Gloop, an alien.
1157
+ //
1158
+
1159
+ function gloop() {
1160
+ const teal = '#14bfae';
1161
+ const deep = '#0b7f86';
1162
+ const berry = '#ff4fa3';
1163
+ // A drop: wide and round below, narrowing to a small rounded crown.
1164
+ const profile = [
1165
+ [0, -0.27],
1166
+ [0.17, -0.24],
1167
+ [0.29, -0.14],
1168
+ [0.33, 0],
1169
+ [0.29, 0.13],
1170
+ [0.2, 0.25],
1171
+ [0.11, 0.335],
1172
+ [0, 0.37],
1173
+ ];
1174
+ const at = onLathe(profile);
1175
+ const parts = limbs({ shoe: berry });
1176
+ parts.push(
1177
+ torso(BODY, deep),
1178
+ mat(
1179
+ { id: 'head', parent: 'torso', kind: 'lathe', position: [0, 0.66, 0], profile, segments: 10 },
1180
+ teal,
1181
+ ),
1182
+ // Three eyes: one over two.
1183
+ patch('eyeTop', at(0, 0.14, 0), { r: 0.07, tall: 1.1, segments: 8, mirror: false }, INK),
1184
+ patch('glintTop', at(0.022, 0.172, 0.022), { r: 0.036, segments: 4, mirror: false }, WHITE),
1185
+ patch('eye', at(0.14, -0.005, 0), { r: 0.066, tall: 1.1, segments: 8 }, INK),
1186
+ patch('glint', at(0.16, 0.025, 0.032), { r: 0.036, segments: 4 }, WHITE),
1187
+ smile(at(0, -0.13, 0.004)),
1188
+ // The stalk grows from the back of the crown and leans back.
1189
+ on('head', 'stalk', 'cylinder', deep, {
1190
+ radius: 0.02,
1191
+ height: 0.2,
1192
+ position: [0, 0.36, -0.2],
1193
+ rotation: [-32, 0, 0],
1194
+ segments: 4,
1195
+ }),
1196
+ ball('head', 'bobble', berry, 0.055, [0, 0.45, -0.255]),
1197
+ patch('spotA', at(0.12, 0.1, -0.004, true), { r: 0.07, segments: 4, mirror: false }, deep),
1198
+ patch('spotB', at(-0.11, -0.05, -0.004, true), { r: 0.05, segments: 4, mirror: false }, deep),
1199
+ patch('spotC', at(-0.05, 0.2, -0.004, true), { r: 0.04, segments: 4, mirror: false }, deep),
1200
+ );
1201
+ const icon = [
1202
+ shape('M13 6l3-3.4', 'none'),
1203
+ disc(16.6, 2.4, 1.6, berry),
1204
+ shape('M12 4.5c5 1.6 8 6.5 8 10.5a8 7 0 0 1-16 0c0-4 3-8.9 8-10.5z', teal),
1205
+ disc(12, 11, 1.8, INK, BARE),
1206
+ dots(15.6, 3.6),
1207
+ ];
1208
+ return { name: 'Gloop', parts, icon };
1209
+ }
1210
+
1211
+ //
1212
+ // 12: Cap, a mushroom.
1213
+ //
1214
+
1215
+ function cap() {
1216
+ const plum = '#a8479a';
1217
+ const cream = '#fff3d6';
1218
+ const stemColor = '#ffdfa6';
1219
+ const moss = '#7d9a3c';
1220
+ // The stem is the face: an egg standing tall under the cap, so the cap's
1221
+ // rim clears the eyes from a camera that looks down on it.
1222
+ const stem = { radius: 0.25, scale: [1, 1.14, 1] };
1223
+ const at = (x, y, lift) => onHead(stem, x, y, lift);
1224
+ const dome = [
1225
+ [0.18, 0.21],
1226
+ [0.32, 0.19],
1227
+ [0.36, 0.25],
1228
+ [0.325, 0.35],
1229
+ [0.24, 0.43],
1230
+ [0.12, 0.48],
1231
+ [0, 0.495],
1232
+ ];
1233
+ const onDome = onLathe(dome);
1234
+ // A few spots of different sizes, none of them placed like another.
1235
+ const spot = (id, x, y, r, back = false) =>
1236
+ patch(id, onDome(x, y, -0.004, back), { r, segments: 5, mirror: false }, cream);
1237
+ const parts = limbs({ shoe: '#7a4a2a', mitt: stemColor });
1238
+ parts.push(
1239
+ torso(BODY, moss),
1240
+ roundHead(stem, 0.6, stemColor, 8),
1241
+ mat({ id: 'cap', parent: 'head', kind: 'lathe', profile: dome, segments: 10 }, plum),
1242
+ spot('spotA', -0.09, 0.355, 0.085),
1243
+ spot('spotB', 0.19, 0.31, 0.048),
1244
+ spot('spotC', 0.05, 0.34, 0.09, true),
1245
+ spot('spotD', -0.21, 0.3, 0.05, true),
1246
+ ...eyes(at, { x: 0.1, y: -0.035, r: 0.072, tall: 1.15 }),
1247
+ smile(at(0, -0.15, 0.004), 0.045),
1248
+ cheeks(at(0.18, -0.115, 0), '#ff8f6b', 0.042),
1249
+ );
1250
+ const icon = [
1251
+ oval(12, 16.5, 5.4, 6, stemColor),
1252
+ shape('M2.6 10.6a9.4 8.4 0 0 1 18.8 0q-9.4 2.6-18.8 0z', plum),
1253
+ `<g fill="${cream}" stroke="none"><circle cx="9.4" cy="6.2" r="2.3"/><circle cx="15.6" cy="7.6" r="1.2"/><circle cx="5.4" cy="9.4" r=".9"/></g>`,
1254
+ dots(16, 2.2, 1.3),
1255
+ shape('M10.4 19.2q1.6 1.3 3.2 0', 'none', ' stroke-width="1"'),
1256
+ ];
1257
+ return { name: 'Cap', parts, icon };
1258
+ }
1259
+
1260
+ //
1261
+ // 13: Toast, a slice of toast.
1262
+ //
1263
+
1264
+ function toast() {
1265
+ const crust = '#a8612a';
1266
+ const crumb = '#fff2c4';
1267
+ const jam = '#b5305e';
1268
+ const slice = [
1269
+ [-0.2, -0.28],
1270
+ [0.2, -0.28],
1271
+ [0.26, -0.22],
1272
+ [0.25, 0.08],
1273
+ [0.3, 0.17],
1274
+ [0.28, 0.26],
1275
+ [0.17, 0.31],
1276
+ [-0.17, 0.31],
1277
+ [-0.28, 0.26],
1278
+ [-0.3, 0.17],
1279
+ [-0.25, 0.08],
1280
+ [-0.26, -0.22],
1281
+ ];
1282
+ const depth = 0.14;
1283
+ const bevel = 0.03;
1284
+ const face = depth / 2 + bevel + 0.012;
1285
+ const at = (x, y, lift) => ({
1286
+ position: [round(x), round(y), round(face + lift)],
1287
+ rotation: [0, 0, 0],
1288
+ });
1289
+ const parts = limbs({ shoe: crust });
1290
+ parts.push(
1291
+ torso(BODY, jam),
1292
+ mat(
1293
+ {
1294
+ id: 'head',
1295
+ parent: 'torso',
1296
+ kind: 'extrude',
1297
+ outline: slice,
1298
+ depth,
1299
+ bevel,
1300
+ flat: false,
1301
+ position: [0, 0.7, 0],
1302
+ },
1303
+ crust,
1304
+ ),
1305
+ // The crumb stands a little proud of the crust on both faces.
1306
+ on('head', 'crumb', 'extrude', crumb, {
1307
+ outline: slice.map(([x, y]) => [round(x * 0.86), round(y * 0.86)]),
1308
+ depth: face * 2,
1309
+ flat: false,
1310
+ }),
1311
+ ...eyes(at, { x: 0.1, y: -0.02, r: 0.07, tall: 1.15 }),
1312
+ smile(at(0, -0.12, 0.004)),
1313
+ cheeks(at(0.17, -0.1, 0), '#ff8f6b'),
1314
+ on('head', 'butter', 'box', '#fff27a', {
1315
+ size: [0.14, 0.13, 0.04],
1316
+ position: [0.1, 0.16, face + 0.012],
1317
+ rotation: [0, 0, 12],
1318
+ }),
1319
+ );
1320
+ const icon = [
1321
+ shape('M5 22V11.5Q2 9.5 4 6t8-3t8 3t-1 5.5V22z', crust),
1322
+ shape('M7.2 19.8V10.6Q5 9 6.6 7t5.4-1.8T17.4 7t-.6 3.6v9.2z', crumb, BARE),
1323
+ `<rect x="12.6" y="7.3" width="4" height="3.3" rx=".6" fill="#ffe24a" stroke-width=".8"/>`,
1324
+ dots(14.4, 2.3, 1.3),
1325
+ ];
1326
+ return { name: 'Toast', parts, icon };
1327
+ }
1328
+
1329
+ //
1330
+ // 14: Scoop, an ice cream.
1331
+ //
1332
+
1333
+ function scoop() {
1334
+ const berry = '#ff93a6';
1335
+ const fudge = '#6a3a1f';
1336
+ const waffle = '#e3a550';
1337
+ const head = { radius: 0.3, scale: [1, 0.97, 1] };
1338
+ const at = (x, y, lift) => onHead(head, x, y, lift);
1339
+ // The sauce: a cap over the top of the scoop, with a rounded drip every quarter
1340
+ // of the way round its edge, the same on both sides.
1341
+ const sauceR = 0.322;
1342
+ const sauceEdge = 34;
1343
+ const sauce = [sauceEdge, 58].map((e) => [
1344
+ round(sauceR * Math.cos(rad(e))),
1345
+ round(sauceR * 0.97 * Math.sin(rad(e))),
1346
+ ]);
1347
+ sauce.push([0, round(sauceR * 0.97)]);
1348
+ const edgeR = 0.3 * Math.cos(rad(sauceEdge));
1349
+ const edgeY = 0.3 * 0.97 * Math.sin(rad(sauceEdge));
1350
+ const drip = (turn, long) =>
1351
+ ball(
1352
+ 'head',
1353
+ `drip${turn}`,
1354
+ fudge,
1355
+ 0.095,
1356
+ [edgeR * Math.sin(rad(turn)), edgeY + 0.04 - long * 0.045, edgeR * Math.cos(rad(turn))],
1357
+ { scale: [0.95, long, 0.5], rotation: [30, turn, 0] },
1358
+ );
1359
+ const onSauce = onLathe(sauce);
1360
+ // A sprinkle lying on the sauce, `turn` degrees round and `tilt` in its plane.
1361
+ const sprinkle = (id, color, x, y, tilt) => {
1362
+ const lie = onSauce(x, y, 0.012);
1363
+ return on('head', id, 'box', color, {
1364
+ size: [0.085, 0.03, 0.03],
1365
+ position: lie.position,
1366
+ rotation: [lie.rotation[0], lie.rotation[1], tilt],
1367
+ });
1368
+ };
1369
+ const parts = limbs({ shoe: fudge });
1370
+ parts.push(
1371
+ // The body is the cone.
1372
+ torso(
1373
+ [
1374
+ [0, -0.08],
1375
+ [0.11, -0.06],
1376
+ [0.215, 0.36],
1377
+ [0.225, 0.41],
1378
+ [0, 0.41],
1379
+ ],
1380
+ waffle,
1381
+ ),
1382
+ roundHead(head, 0.71, berry, 9),
1383
+ // The scoop's foot, pressed out over the cone's rim.
1384
+ on('head', 'foot', 'cylinder', berry, {
1385
+ radius: 0.27,
1386
+ radiusTop: 0.24,
1387
+ height: 0.07,
1388
+ position: [0, -0.265, 0],
1389
+ segments: 8,
1390
+ }),
1391
+ mat({ id: 'sauce', parent: 'head', kind: 'lathe', profile: sauce, segments: 10 }, fudge),
1392
+ drip(45, 1.25),
1393
+ drip(135, 1.05),
1394
+ drip(225, 1.05),
1395
+ drip(315, 1.25),
1396
+ sprinkle('sprinkleA', '#fff27a', -0.09, 0.262, 35),
1397
+ sprinkle('sprinkleB', '#7ae0ff', 0.1, 0.25, -50),
1398
+ ...eyes(at, { x: 0.11, y: -0.03, r: 0.07, tall: 1.15 }),
1399
+ smile(at(0, -0.135, 0.004)),
1400
+ );
1401
+ const icon = [
1402
+ shape('M7 15.5h10l-5 7.5z', waffle),
1403
+ disc(12, 10.5, 7.5, berry),
1404
+ shape(
1405
+ 'M4.6 9.4a7.5 7.5 0 0 1 14.8 0q-.2 1.5-1.3 1.5t-1.2-1.4q-.1 2.6-1.3 2.6t-1.2-2.6q-.1 1.4-1.2 1.4t-1.2-1.4q-.1 2.6-1.3 2.6T8.3 9.5q-.1 1.4-1.2 1.4T4.6 9.4z',
1406
+ fudge,
1407
+ ),
1408
+ shape('M9 6.3l2.2-1.2', 'none', ' stroke="#fff27a" stroke-width="1.2"'),
1409
+ shape('M13.2 5.2l1.6 1.8', 'none', ' stroke="#7ae0ff" stroke-width="1.2"'),
1410
+ dots(13.6, 2.4, 1.2),
1411
+ ];
1412
+ return { name: 'Scoop', parts, icon };
1413
+ }
1414
+
1415
+ //
1416
+ // 15: Zest, an orange.
1417
+ //
1418
+
1419
+ function zest() {
1420
+ const orange = '#ff8a14';
1421
+ const leaf = '#4fc04a';
1422
+ const head = { radius: 0.31, scale: [1.06, 0.94, 1.04] };
1423
+ const at = (x, y, lift) => onHead(head, x, y, lift);
1424
+ const parts = limbs({ shoe: orange });
1425
+ parts.push(
1426
+ torso(BODY, '#2f9e55'),
1427
+ roundHead(head, 0.68, orange, 12),
1428
+ ...eyes(at, { x: 0.12, y: 0.03, r: 0.075, tall: 1.15 }),
1429
+ smile(at(0, -0.085, 0.004), 0.06, 0.017),
1430
+ cheeks(at(0.215, -0.07, 0), '#ff5a3c'),
1431
+ // A short stem at the back of the crown, and a leaf lying off to one side.
1432
+ on('head', 'stem', 'cylinder', '#6b3d20', {
1433
+ radius: 0.03,
1434
+ height: 0.09,
1435
+ position: [0, 0.3, -0.07],
1436
+ segments: 5,
1437
+ }),
1438
+ on('head', 'leaf', 'extrude', leaf, {
1439
+ outline: [
1440
+ [0, 0],
1441
+ [0.09, 0.1],
1442
+ [0.06, 0.21],
1443
+ [0, 0.27],
1444
+ [-0.06, 0.21],
1445
+ [-0.09, 0.1],
1446
+ ],
1447
+ depth: 0.035,
1448
+ flat: false,
1449
+ position: [0.02, 0.265, -0.08],
1450
+ rotation: [-65, 0, -75],
1451
+ }),
1452
+ );
1453
+ const icon = [
1454
+ disc(12, 14, 8.5, orange),
1455
+ shape('M12 5.8q3.5-6 8.5-3.2q-3 5.4-8.5 3.2z', leaf),
1456
+ dots(13.2),
1457
+ shape('M9.2 16.4q2.8 2.4 5.6 0', 'none'),
1458
+ ];
1459
+ return { name: 'Zest', parts, icon };
576
1460
  }
577
1461
 
578
1462
  //
@@ -617,5 +1501,38 @@ function write(index, { name, look = LOOK, parts }) {
617
1501
  fs.writeFileSync(path.join(OUT_DIR, `avatar-${index}.pxmodel`), lines.join('\n'));
618
1502
  }
619
1503
 
1504
+ // `code/client/avatarFaces.js`: per avatar index, its name and its face.
1505
+ function writeFaces(characters) {
1506
+ const lines = [
1507
+ '// Generated by scripts/gen-avatars.mjs; do not edit. Each avatar index: the',
1508
+ "// character's name, and its face for the picker (`chrome.js`), the inside of a",
1509
+ '// 24 x 24 SVG.',
1510
+ 'export const AVATAR_FACES = [',
1511
+ ...characters.map(({ name, icon }) => ` ['${name}', '${icon.join('')}'],`),
1512
+ '];',
1513
+ '',
1514
+ ];
1515
+ fs.writeFileSync(FACES_FILE, lines.join('\n'));
1516
+ }
1517
+
620
1518
  fs.mkdirSync(OUT_DIR, { recursive: true });
621
- [mascot, petal, beat, star].forEach((make, index) => write(index, make()));
1519
+ const characters = [
1520
+ mascot,
1521
+ petal,
1522
+ beat,
1523
+ star,
1524
+ biscuit,
1525
+ mochi,
1526
+ hop,
1527
+ pip,
1528
+ ribbit,
1529
+ ember,
1530
+ bolt,
1531
+ gloop,
1532
+ cap,
1533
+ toast,
1534
+ scoop,
1535
+ zest,
1536
+ ].map((make) => make());
1537
+ characters.forEach((character, index) => write(index, character));
1538
+ writeFaces(characters);