castle-web-cli 0.4.237 → 0.4.239

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 (239) hide show
  1. package/dist/bundle.d.ts +24 -0
  2. package/dist/bundle.js +447 -4
  3. package/dist/bundleLatin1.d.ts +6 -0
  4. package/dist/bundleLatin1.js +333 -0
  5. package/dist/castle-host/host.d.ts +10 -1
  6. package/dist/castle-host/host.js +133 -9
  7. package/dist/castleJson.d.ts +2 -0
  8. package/dist/castleJson.js +1 -0
  9. package/dist/deckExports.d.ts +35 -0
  10. package/dist/deckExports.js +365 -0
  11. package/dist/importCheckHook.d.ts +1 -0
  12. package/dist/importCheckHook.js +1 -1
  13. package/dist/index.js +21 -0
  14. package/dist/init.js +2 -1
  15. package/dist/multiplayerDoc.d.ts +1 -1
  16. package/dist/multiplayerDoc.js +9 -0
  17. package/dist/platformDoc.js +2 -1
  18. package/dist/playPagePolicy.d.ts +1 -0
  19. package/dist/playPagePolicy.js +8 -3
  20. package/dist/roomLogs.d.ts +39 -0
  21. package/dist/roomLogs.js +166 -0
  22. package/dist/save-deck.js +4 -0
  23. package/kits/base/CLAUDE.md +1 -0
  24. package/kits/base/castle.json +1 -1
  25. package/kits/base/sdk/README.md +113 -2
  26. package/kits/base/sdk/castle.d.ts +6 -2
  27. package/kits/base/sdk/castle.js +2 -0
  28. package/kits/base/sdk/commands.d.ts +56 -1
  29. package/kits/base/sdk/commands.js +29 -1
  30. package/kits/base/sdk/hub.d.ts +17 -0
  31. package/kits/base/sdk/hub.js +33 -9
  32. package/kits/base/sdk/localCache.d.ts +27 -0
  33. package/kits/base/sdk/localCache.js +115 -0
  34. package/kits/base/sdk/localCacheStore.d.ts +15 -0
  35. package/kits/base/sdk/localCacheStore.js +358 -0
  36. package/kits/base/sdk/multiplayer.js +30 -0
  37. package/kits/base/sdk/rooms.d.ts +11 -0
  38. package/kits/base/sdk/rooms.js +22 -0
  39. package/kits/base/sdk/store.d.ts +8 -2
  40. package/kits/base/sdk/store.js +5 -1
  41. package/kits/base/sdk/transport.d.ts +1 -0
  42. package/kits/base/sdk/transport.js +4 -5
  43. package/kits/hub-game/CLAUDE.md +22 -2
  44. package/kits/hub-game/castle.json +8 -5
  45. package/kits/hub-game/code/client/act.js +66 -91
  46. package/kits/hub-game/code/client/actCore.js +134 -0
  47. package/kits/hub-game/code/client/car.js +35 -0
  48. package/kits/hub-game/code/client/chrome.js +208 -381
  49. package/kits/hub-game/code/client/crowdNames.js +2 -2
  50. package/kits/hub-game/code/client/emoteWheel.js +109 -0
  51. package/kits/hub-game/code/client/hats.js +2 -0
  52. package/kits/hub-game/code/client/hookLayer.js +99 -48
  53. package/kits/hub-game/code/client/hostGo.js +77 -0
  54. package/kits/hub-game/code/client/hubControls.js +125 -0
  55. package/kits/hub-game/code/client/hubEntry.js +187 -0
  56. package/kits/hub-game/code/client/hudSurface.js +148 -0
  57. package/kits/hub-game/code/client/hudTree.js +96 -0
  58. package/kits/hub-game/code/client/idle.js +59 -13
  59. package/kits/hub-game/code/client/invites.js +13 -4
  60. package/kits/hub-game/code/client/menuIcons.js +8 -0
  61. package/kits/hub-game/code/client/menuRows.js +8 -2
  62. package/kits/hub-game/code/client/noTrips.js +38 -0
  63. package/kits/hub-game/code/client/qualityEntry.js +6 -1
  64. package/kits/hub-game/code/client/rehello.js +3 -1
  65. package/kits/hub-game/code/client/riders.js +26 -0
  66. package/kits/hub-game/code/client/role.js +79 -0
  67. package/kits/hub-game/code/client/safeLayout.js +32 -3
  68. package/kits/hub-game/code/client/sound.js +10 -3
  69. package/kits/hub-game/code/client/soundscape.js +2 -2
  70. package/kits/hub-game/code/client/soundscapeAmbience.js +38 -8
  71. package/kits/hub-game/code/client/soundscapeBaked.js +24 -5
  72. package/kits/hub-game/code/client/soundscapeCues.js +2 -1
  73. package/kits/hub-game/code/client/state.js +19 -0
  74. package/kits/hub-game/code/client/stuck.js +2 -1
  75. package/kits/hub-game/code/client/talkSurface.js +178 -0
  76. package/kits/hub-game/code/client/talkTree.js +238 -0
  77. package/kits/hub-game/code/client/tiers.js +8 -5
  78. package/kits/hub-game/code/client/uiDom.js +600 -0
  79. package/kits/hub-game/code/client/uiTree.js +359 -0
  80. package/kits/hub-game/code/client/vehicle.js +156 -0
  81. package/kits/hub-game/code/client/wear.js +27 -5
  82. package/kits/hub-game/code/client/worldLabels.js +13 -3
  83. package/kits/hub-game/code/client/yours.js +10 -3
  84. package/kits/hub-game/code/server/actors.js +4 -3
  85. package/kits/hub-game/code/server/analytics.js +61 -18
  86. package/kits/hub-game/code/server/decor.js +56 -16
  87. package/kits/hub-game/code/server/doorAnalytics.js +2 -5
  88. package/kits/hub-game/code/server/hub.js +261 -46
  89. package/kits/hub-game/code/server/idle.js +118 -5
  90. package/kits/hub-game/code/server/loadAbandon.js +2 -5
  91. package/kits/hub-game/code/server/manifest.js +46 -4
  92. package/kits/hub-game/code/server/npcs.js +4 -2
  93. package/kits/hub-game/code/server/players.js +3 -0
  94. package/kits/hub-game/code/server/role.js +142 -0
  95. package/kits/hub-game/code/server/standing.js +6 -4
  96. package/kits/hub-game/code/server/trackQueue.js +29 -0
  97. package/kits/hub-game/code/server/vehicle.js +126 -0
  98. package/kits/hub-game/code/shared/car.js +52 -0
  99. package/kits/hub-game/code/shared/deckFlags.js +34 -0
  100. package/kits/hub-game/code/shared/deviceClass.js +39 -0
  101. package/kits/hub-game/code/shared/expression.js +9 -0
  102. package/kits/hub-game/code/systems/hub.js +281 -86
  103. package/kits/hub-game/docs/analytics.md +15 -3
  104. package/kits/hub-game/docs/contract.md +352 -14
  105. package/kits/hub-game/docs/vehicle-preset.md +132 -0
  106. package/kits/hub-game/models/hats/baker-cap.pxmodel +89 -0
  107. package/kits/hub-game/models/hats/chef-toque.pxmodel +60 -0
  108. package/kits/hub-game/models/hats/delivery-cap.pxmodel +105 -0
  109. package/kits/hub-game/models/hats/fire-helmet.pxmodel +87 -0
  110. package/kits/hub-game/models/hats/hard-hat.pxmodel +71 -0
  111. package/kits/hub-game/models/hats/nurse-cap.pxmodel +61 -0
  112. package/kits/hub-game/models/hats/police-cap.pxmodel +105 -0
  113. package/kits/hub-game/models/hats/teacher-beret.pxmodel +52 -0
  114. package/kits/hub-game/models/role/square/top-apron.pxmodel +109 -0
  115. package/kits/hub-game/models/role/square/top-cardigan.pxmodel +141 -0
  116. package/kits/hub-game/models/role/square/top-coat.pxmodel +157 -0
  117. package/kits/hub-game/models/role/square/top-scrubs.pxmodel +93 -0
  118. package/kits/hub-game/models/role/square/top-tabard.pxmodel +109 -0
  119. package/kits/hub-game/models/role/square/top-vest.pxmodel +109 -0
  120. package/kits/hub-game/models/role/tool-bag.pxmodel +75 -0
  121. package/kits/hub-game/models/role/tool-bell.pxmodel +71 -0
  122. package/kits/hub-game/models/role/tool-hose.pxmodel +60 -0
  123. package/kits/hub-game/models/role/tool-parcel.pxmodel +61 -0
  124. package/kits/hub-game/models/role/tool-torch.pxmodel +55 -0
  125. package/kits/hub-game/models/role/tool-tray.pxmodel +75 -0
  126. package/kits/hub-game/models/role/top-apron.pxmodel +70 -0
  127. package/kits/hub-game/models/role/top-cardigan.pxmodel +102 -0
  128. package/kits/hub-game/models/role/top-coat.pxmodel +79 -0
  129. package/kits/hub-game/models/role/top-scrubs.pxmodel +54 -0
  130. package/kits/hub-game/models/role/top-tabard.pxmodel +70 -0
  131. package/kits/hub-game/models/role/top-vest.pxmodel +70 -0
  132. package/kits/hub-game/package-lock.json +1 -1
  133. package/kits/hub-game/package.json +1 -1
  134. package/kits/hub-game/scripts/check.mjs +7 -4
  135. package/kits/hub-game/scripts/fixtures/car-vectors.json +279 -0
  136. package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +2 -1
  137. package/kits/hub-game/scripts/fixtures/hud-surface.json +670 -0
  138. package/kits/hub-game/scripts/fixtures/talk-surface.json +3930 -0
  139. package/kits/hub-game/scripts/gen-hats.mjs +46 -2
  140. package/kits/hub-game/scripts/gen-role.mjs +80 -0
  141. package/kits/hub-game/scripts/test-act-core.mjs +167 -0
  142. package/kits/hub-game/scripts/test-actions-client.mjs +34 -0
  143. package/kits/hub-game/scripts/test-actors.mjs +48 -0
  144. package/kits/hub-game/scripts/test-analytics.mjs +100 -6
  145. package/kits/hub-game/scripts/test-apply-deck.mjs +122 -0
  146. package/kits/hub-game/scripts/test-back-visibility.mjs +3 -1
  147. package/kits/hub-game/scripts/test-ballot.mjs +2 -0
  148. package/kits/hub-game/scripts/test-car.mjs +43 -0
  149. package/kits/hub-game/scripts/test-decor-client.mjs +2 -1
  150. package/kits/hub-game/scripts/test-decor.mjs +77 -0
  151. package/kits/hub-game/scripts/test-device-class.mjs +83 -0
  152. package/kits/hub-game/scripts/test-door-analytics.mjs +1 -1
  153. package/kits/hub-game/scripts/test-emote-wheel.mjs +374 -0
  154. package/kits/hub-game/scripts/test-hats.mjs +5 -4
  155. package/kits/hub-game/scripts/test-host-go.mjs +265 -0
  156. package/kits/hub-game/scripts/test-hub-controls.mjs +108 -0
  157. package/kits/hub-game/scripts/test-hub-entry.mjs +531 -0
  158. package/kits/hub-game/scripts/test-hub-ops.mjs +103 -0
  159. package/kits/hub-game/scripts/test-hub-trip.mjs +20 -1
  160. package/kits/hub-game/scripts/test-hud-clear.mjs +12 -2
  161. package/kits/hub-game/scripts/test-hud-rate.mjs +6 -2
  162. package/kits/hub-game/scripts/test-hud-surface.mjs +272 -0
  163. package/kits/hub-game/scripts/test-idle.mjs +347 -1
  164. package/kits/hub-game/scripts/test-interest-cells.mjs +8 -1
  165. package/kits/hub-game/scripts/test-invites-client.mjs +42 -1
  166. package/kits/hub-game/scripts/test-load-abandon.mjs +2 -2
  167. package/kits/hub-game/scripts/test-manifest.mjs +30 -0
  168. package/kits/hub-game/scripts/test-menu-client.mjs +1 -1
  169. package/kits/hub-game/scripts/test-no-trips.mjs +42 -0
  170. package/kits/hub-game/scripts/test-placement-cache.mjs +1 -1
  171. package/kits/hub-game/scripts/test-quality.mjs +13 -0
  172. package/kits/hub-game/scripts/test-rehello.mjs +258 -3
  173. package/kits/hub-game/scripts/test-resume-pose-server.mjs +203 -0
  174. package/kits/hub-game/scripts/test-resync.mjs +196 -0
  175. package/kits/hub-game/scripts/test-role-client.mjs +427 -0
  176. package/kits/hub-game/scripts/test-role.mjs +350 -0
  177. package/kits/hub-game/scripts/test-safe-layout.mjs +50 -1
  178. package/kits/hub-game/scripts/test-soundscape.mjs +124 -7
  179. package/kits/hub-game/scripts/test-standing.mjs +15 -1
  180. package/kits/hub-game/scripts/test-talk-surface.mjs +296 -0
  181. package/kits/hub-game/scripts/test-tiers.mjs +13 -0
  182. package/kits/hub-game/scripts/test-track-queue.mjs +64 -0
  183. package/kits/hub-game/scripts/test-ui-dom-dom.mjs +96 -0
  184. package/kits/hub-game/scripts/test-ui-tree.mjs +711 -0
  185. package/kits/hub-game/scripts/test-vehicle-client.mjs +168 -0
  186. package/kits/hub-game/scripts/test-vehicle.mjs +135 -0
  187. package/kits/hub-game/scripts/test-world-labels.mjs +40 -0
  188. package/kits/hub-game/scripts/test-yours.mjs +33 -0
  189. package/kits/hub-game/tools/hubScene/export.mjs +613 -0
  190. package/kits/hub-game/tools/hubScene/hubdata.mjs +921 -0
  191. package/kits/hub-game/tools/hubScene/merge-root.mjs +39 -0
  192. package/kits/hub-game/tools/hubScene/nodeworld.mjs +227 -0
  193. package/kits/hub-game/tools/hubScene/test/export-fixture.mjs +810 -0
  194. package/kits/hub-game/tools/hubScene/test/fixture.json +637 -0
  195. package/kits/hub-game/tools/hubScene/test/paint-export.mjs +40 -0
  196. package/kits/hub-game/tools/hubScene/test/upload.test.mjs +655 -0
  197. package/kits/hub-game/tools/hubScene/upload.mjs +636 -0
  198. package/kits/hub-game/tools/hubScene/validate-manifest.mjs +301 -0
  199. package/kits/multiplayer-3d/castle.json +4 -4
  200. package/kits/multiplayer-3d/code/client/resumeGate.js +30 -2
  201. package/kits/multiplayer-3d/code/client/steer.js +3 -1
  202. package/kits/multiplayer-3d/code/systems/multiplayer.js +30 -2
  203. package/kits/multiplayer-3d/package-lock.json +1 -1
  204. package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +74 -2
  205. package/kits/physics-3d/CLAUDE.md +1 -1
  206. package/kits/physics-3d/behaviors/Player.jsx +37 -27
  207. package/kits/physics-3d/castle.json +2 -2
  208. package/kits/physics-3d/docs/engine-geometry-memory.md +23 -0
  209. package/kits/physics-3d/engine3d/memoryprofile.js +17 -0
  210. package/kits/physics-3d/engine3d/playerRun.js +6 -1
  211. package/kits/physics-3d/engine3d/pxmodel.js +6 -1
  212. package/kits/physics-3d/engine3d/world3d.js +6 -3
  213. package/kits/physics-3d/package.json +1 -1
  214. package/kits/physics-3d/play/behaviors/Player.js +40 -28
  215. package/kits/physics-3d/scripts/test-memory-profile.mjs +237 -0
  216. package/kits/physics-3d/systems/physics3d.js +5 -2
  217. package/kits/real-time/castle.json +2 -2
  218. package/kits/real-time/code/client/messages.js +5 -0
  219. package/kits/real-time/code/server/session.js +28 -1
  220. package/kits/real-time/package-lock.json +1 -1
  221. package/package.json +5 -4
  222. package/vendor/three/LICENSE +21 -0
  223. package/vendor/three/build/three.core.js +58773 -0
  224. package/vendor/three/build/three.module.js +18251 -0
  225. package/vendor/three/examples/jsm/controls/OrbitControls.js +1860 -0
  226. package/vendor/three/examples/jsm/controls/TransformControls.js +1918 -0
  227. package/vendor/three/examples/jsm/exporters/GLTFExporter.js +3595 -0
  228. package/vendor/three/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
  229. package/vendor/three/examples/jsm/math/MeshSurfaceSampler.js +315 -0
  230. package/vendor/three/examples/jsm/postprocessing/EffectComposer.js +363 -0
  231. package/vendor/three/examples/jsm/postprocessing/MaskPass.js +195 -0
  232. package/vendor/three/examples/jsm/postprocessing/OutputPass.js +139 -0
  233. package/vendor/three/examples/jsm/postprocessing/Pass.js +191 -0
  234. package/vendor/three/examples/jsm/postprocessing/RenderPass.js +183 -0
  235. package/vendor/three/examples/jsm/postprocessing/ShaderPass.js +135 -0
  236. package/vendor/three/examples/jsm/shaders/CopyShader.js +52 -0
  237. package/vendor/three/examples/jsm/shaders/OutputShader.js +103 -0
  238. package/vendor/three/examples/jsm/utils/BufferGeometryUtils.js +1435 -0
  239. package/vendor/three/package.json +134 -0
@@ -0,0 +1,132 @@
1
+ # The `vehicle` preset: driving a car (contract v1.160)
2
+
3
+ Life RP build-plan line 3. The contract has reserved `vehicle` since v1 (§6,
4
+ "refused until built"). This builds it for one kind of vehicle, a car on a
5
+ road, with the boats as the precedent for the parts that already exist:
6
+
7
+ - The boats sail by **the server** moving kinematic twins (`hub.move` with
8
+ `overMs`). That is right for a scripted trip and wrong for a car a player
9
+ steers: a server-moved car answers the stick a round trip late.
10
+ - So a car is **the driver's own player body**, client-predicted and
11
+ server-clamped exactly as walking is, with a car's dynamics instead of a
12
+ walk's, and the car's model drawn under the driver's avatar node the way
13
+ `wear.js` draws a hat. No actor is made per car and nothing new rides the
14
+ pose stream: a moving car costs what a walking player costs.
15
+ - A hub game ships no client code, so all of it is the kit's; the place only
16
+ says who drives what (server API below).
17
+
18
+ ## Server API
19
+
20
+ | call | what |
21
+ | --- | --- |
22
+ | `hub.drive(playerId, car)` | put a player who has arrived, is not held and not on a trip into the vehicle preset. `car` is below. Returns `true`, or `false` (logged once) when refused. A second call while driving replaces the car (a respray). |
23
+ | `hub.drive(playerId, null, at?)` | get out: the walk preset back, standing at `at` (`{ x, z, y?, facing? }`), default 1.6 m to the car's left. Every rider gets out too, beside their seat. |
24
+ | `hub.ride(playerId, driverId, seat)` | a passenger in seat `seat` (1..seats-1) of a driver's car. The rider is held (§8) and the kit keeps their server pose on the seat each tick; refused for a taken seat, a rider who is held, driving or riding, or more than 6 m from the car. |
25
+ | `hub.ride(playerId, null)` | get out, beside the seat. |
26
+ | `hub.vehicle(playerId)` | `{ driver: true, car }`, `{ driver: false, of, seat }` or `null`. |
27
+
28
+ `car`:
29
+
30
+ | field | default | bounds | meaning |
31
+ | --- | --- | --- | --- |
32
+ | `look` | required | a scene actor with a `Model` | the body: its model is cloned under the driver's avatar node, at the actor's authored scale; a hidden template (as the boats' are) |
33
+ | `color` | none | `#rrggbb` | tints the look's `paint` material colour, when it has one |
34
+ | `seats` | `[[0, 0, 0]]` | 1-4 points, metres, car-local (+Z forward) | seat 0 is the driver's; the car is drawn so seat 0 is over the driver's body |
35
+ | `length`, `width` | 4, 1.8 | 2-10, 1-3 | for the bumper probes and stuck |
36
+ | `speed` | 12 | 2-16 m/s | top speed forward |
37
+ | `reverse` | 4 | 1-6 m/s | |
38
+ | `accel`, `brake` | 6, 14 | 1-20 m/s² | |
39
+ | `turn` | 1.6 | 0.3-3 rad/s | yaw rate at speed; it falls to 0 at rest (no turning on the spot) |
40
+ | `camDistance`, `camHeight` | Player's × 1.4 | | the follow camera while driving |
41
+ | `horn` | none | a file the place's `idle.sounds` lists | offers a Horn button; one honk a second |
42
+
43
+ ## What players see and do
44
+
45
+ - **Driver.** The same stick and keys as walking (tank-style: up/W forward,
46
+ down/S brake then reverse, sideways steers), through a pure step function
47
+ `stepCar(state, input, car, dt) -> state` (`code/client/car.js`, unit
48
+ tested): speed eases toward `speed * forward` at `accel` (at `brake` when
49
+ the input opposes the motion; a rolling coast of 2 m/s² with no input),
50
+ yaw rate is `turn * steer * clamp(|v| / 4, 0, 1) * sign(v)`, taken off the heading (a right steer lowers it and turns right, as walking does), and the follow
51
+ camera turns with the heading as it does walking. No jump. The body is
52
+ driven with the walk's velocity-matching impulse, so the server clamp and
53
+ the hover over the ground are unchanged.
54
+ - **Bumpers.** The body is still the walk's capsule, so the car's nose and
55
+ tail would pass into walls. Each frame two rays at body height, from the
56
+ capsule along ±heading, reach `length / 2`; a hit within that ahead (or
57
+ behind, reversing) stops the car (speed 0) and keeps it there while the
58
+ input pushes into the hit. Corners are not probed: a scraped corner
59
+ passes into a wall by at most `width / 2`. Other players are not solid
60
+ to a car (they are not to a walker either).
61
+ - **Riders** see themselves in their seat, drawn from the driver's DRAWN pose
62
+ (so a rider never lags its car), and their camera follows the car. Their
63
+ input is ignored but for the place's own Get out chip (actions, v1.74).
64
+ - **Everyone** draws the car on the driver's avatar, the driver seated in
65
+ seat 0 (the sit pose, §6), riders seated in theirs. The look follows the
66
+ avatar's node, so per-viewer hiding, cell interest, the far-avatar cap and
67
+ Low's rules all apply to cars as they do to avatars, and a car costs one
68
+ cloned merged model per viewer who draws it.
69
+ - **Stuck** (v1.33) counts drive input as walk input, and in a car the chip
70
+ reads "Stuck? Tap to reset the car". The place's `unstick` hook picks the
71
+ spot (the deck's nearest road point, facing along the road); the driver is
72
+ put there still driving and the riders come along.
73
+
74
+ ## Dynamics model (agreed with the native engine)
75
+
76
+ Client-predicted, as walking is: the driver's own device steps the car and
77
+ reports its body's pose; the server only clamps the movement to `car.speed`
78
+ (or `reverse`, whichever is larger). The web client and the native engine run
79
+ the same pure function, `stepCar(state, input, car, dt)` exported from
80
+ `code/client/car.js`, on a car parsed by `parseCar` (`code/shared/car.js`).
81
+ `state` is `{ speed, heading }` (m/s signed, radians: 0 runs along +Z and a positive heading points toward +X, so a right steer lowers it); `input` is `{ forward, steer, front?, back? }`, where `front` and
82
+ `back` are the bumper rays' hit distances (absent for no hit). The native
83
+ engine casts those rays with its own physics. `scripts/fixtures/car-vectors.json`
84
+ holds input/output vectors that `scripts/test-car.mjs` checks the web function
85
+ against; the native engine checks its host against the same file.
86
+
87
+ ## Wire
88
+
89
+ - `hubCars` in the snapshot and, when it changes, the delta (a latch: the
90
+ whole map each time, `{}` once the last car is gone; absent means no
91
+ change): `playerId -> { look, color?, seats, length, width, speed, reverse,
92
+ accel, brake, turn, cam: { distance?, height? }, horn?, riders: { [seat]:
93
+ playerId } }`. A rider's own seat is read from it.
94
+ - `{ k: "hub-horn" }` (client to server, driver only, one a second, only for a
95
+ car with `horn`); the server broadcasts `{ k: "hub-sound", player, file,
96
+ volume: 1, radius: 20 }`, the existing sound event with a player source in
97
+ place of `actor`.
98
+
99
+ ## Server rules
100
+
101
+ - The driver's movement clamp follows `car.speed` (the way `hub.tune`'s does);
102
+ getting out puts the walk's back. A driver cannot be tuned while driving
103
+ (`hub.tune` is kept and applies on getting out).
104
+ - `hub.hold` of a driver stops the car (speed 0) and keeps them driving;
105
+ `release` lets them drive on. A seat (`HubSeat`) cannot be taken while
106
+ driving or riding.
107
+ - Leaving, a trip, a game's end, `hub.end` or the driver's drop past the
108
+ retained-reconnect window gets everyone out. A retained reconnect (v1.89)
109
+ keeps the car and its riders: the rejoining client is sent `hubCars`.
110
+ - A rider's server pose is the driver's server pose plus the seat offset,
111
+ rotated by the driver's heading, written each tick; its client sends no
112
+ pose while riding (and one sent is dropped).
113
+ - At most 24 cars in a place and 4 seats a car.
114
+
115
+ ## Not in v1.160
116
+
117
+ Lights, damage, a car pushing loose objects harder than a walker does,
118
+ passengers changing seats, a car going through a door, and a car crossing
119
+ places. The deck's parked cars are its own spawned copies (§10): it
120
+ despawns one when its driver gets in and spawns one where they get out.
121
+
122
+ ## Tests
123
+
124
+ - `scripts/test-car.mjs`: `stepCar` accel, brake, reverse, coast, no turn at
125
+ rest, top-speed bounds, bumper stop and back-off.
126
+ - `scripts/test-vehicle.mjs` (server): drive/ride validation and refusals,
127
+ seat pinning math, clamp follows speed, get-out positions, leave/trip/end
128
+ cleanup, retained reconnect keeps the car, `hubCars` deltas.
129
+ - `scripts/test-vehicle-client.mjs`: drawing a car on a driver's node and a
130
+ rider at its seat from the drawn pose; input ignored while riding; stuck
131
+ wording.
132
+ - A place without `hub.drive` is sent and draws exactly what it was.
@@ -0,0 +1,89 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "baker-cap",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "crown",
14
+ "kind": "cylinder",
15
+ "radius": 0.21,
16
+ "height": 0.12,
17
+ "position": [
18
+ 0,
19
+ 0.06,
20
+ 0
21
+ ],
22
+ "color": "#e8c96a",
23
+ "segments": 16,
24
+ "flat": true
25
+ },
26
+ {
27
+ "id": "band",
28
+ "kind": "cylinder",
29
+ "radius": 0.215,
30
+ "height": 0.025,
31
+ "position": [
32
+ 0,
33
+ 0.012,
34
+ 0
35
+ ],
36
+ "color": "#2b2b33",
37
+ "segments": 16,
38
+ "flat": true
39
+ },
40
+ {
41
+ "id": "visor",
42
+ "kind": "extrude",
43
+ "outline": [
44
+ [
45
+ -0.19,
46
+ 0
47
+ ],
48
+ [
49
+ -0.1748,
50
+ 0.165
51
+ ],
52
+ [
53
+ -0.10450000000000001,
54
+ 0.27
55
+ ],
56
+ [
57
+ 0,
58
+ 0.3
59
+ ],
60
+ [
61
+ 0.10450000000000001,
62
+ 0.27
63
+ ],
64
+ [
65
+ 0.1748,
66
+ 0.165
67
+ ],
68
+ [
69
+ 0.19,
70
+ 0
71
+ ]
72
+ ],
73
+ "depth": 0.02,
74
+ "bevel": 0.006,
75
+ "position": [
76
+ 0,
77
+ 0.015,
78
+ 0
79
+ ],
80
+ "rotation": [
81
+ 82,
82
+ 0,
83
+ 0
84
+ ],
85
+ "color": "#2b2b33",
86
+ "flat": true
87
+ }
88
+ ]
89
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "chef-toque",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "band",
14
+ "kind": "cylinder",
15
+ "radius": 0.2,
16
+ "height": 0.12,
17
+ "position": [
18
+ 0,
19
+ 0.06,
20
+ 0
21
+ ],
22
+ "color": "#2b2b33",
23
+ "segments": 16,
24
+ "flat": true
25
+ },
26
+ {
27
+ "id": "toque",
28
+ "kind": "lathe",
29
+ "profile": [
30
+ [
31
+ 0.2,
32
+ 0.025
33
+ ],
34
+ [
35
+ 0.2,
36
+ 0.16
37
+ ],
38
+ [
39
+ 0.25,
40
+ 0.2
41
+ ],
42
+ [
43
+ 0.25,
44
+ 0.33
45
+ ],
46
+ [
47
+ 0.18,
48
+ 0.37
49
+ ],
50
+ [
51
+ 0,
52
+ 0.37
53
+ ]
54
+ ],
55
+ "color": "#f4f6fa",
56
+ "segments": 16,
57
+ "flat": true
58
+ }
59
+ ]
60
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "delivery-cap",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "crown",
14
+ "kind": "cylinder",
15
+ "radius": 0.21,
16
+ "height": 0.12,
17
+ "position": [
18
+ 0,
19
+ 0.06,
20
+ 0
21
+ ],
22
+ "color": "#f0a12b",
23
+ "segments": 16,
24
+ "flat": true
25
+ },
26
+ {
27
+ "id": "band",
28
+ "kind": "cylinder",
29
+ "radius": 0.215,
30
+ "height": 0.025,
31
+ "position": [
32
+ 0,
33
+ 0.012,
34
+ 0
35
+ ],
36
+ "color": "#2b2b33",
37
+ "segments": 16,
38
+ "flat": true
39
+ },
40
+ {
41
+ "id": "visor",
42
+ "kind": "extrude",
43
+ "outline": [
44
+ [
45
+ -0.19,
46
+ 0
47
+ ],
48
+ [
49
+ -0.1748,
50
+ 0.165
51
+ ],
52
+ [
53
+ -0.10450000000000001,
54
+ 0.27
55
+ ],
56
+ [
57
+ 0,
58
+ 0.3
59
+ ],
60
+ [
61
+ 0.10450000000000001,
62
+ 0.27
63
+ ],
64
+ [
65
+ 0.1748,
66
+ 0.165
67
+ ],
68
+ [
69
+ 0.19,
70
+ 0
71
+ ]
72
+ ],
73
+ "depth": 0.02,
74
+ "bevel": 0.006,
75
+ "position": [
76
+ 0,
77
+ 0.015,
78
+ 0
79
+ ],
80
+ "rotation": [
81
+ 82,
82
+ 0,
83
+ 0
84
+ ],
85
+ "color": "#2b2b33",
86
+ "flat": true
87
+ },
88
+ {
89
+ "id": "patch",
90
+ "kind": "box",
91
+ "size": [
92
+ 0.09,
93
+ 0.04,
94
+ 0.015
95
+ ],
96
+ "position": [
97
+ 0,
98
+ 0.075,
99
+ 0.212
100
+ ],
101
+ "color": "#f4f6fa",
102
+ "flat": true
103
+ }
104
+ ]
105
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "fire-helmet",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "brim",
14
+ "kind": "lathe",
15
+ "segments": 16,
16
+ "profile": [
17
+ [
18
+ 0.16,
19
+ -0.011
20
+ ],
21
+ [
22
+ 0.26499999999999996,
23
+ -0.011
24
+ ],
25
+ [
26
+ 0.3,
27
+ -0.0044
28
+ ],
29
+ [
30
+ 0.3,
31
+ 0.0088
32
+ ],
33
+ [
34
+ 0.26499999999999996,
35
+ 0.011
36
+ ],
37
+ [
38
+ 0.16,
39
+ 0.011
40
+ ]
41
+ ],
42
+ "color": "#e5484d",
43
+ "flat": true
44
+ },
45
+ {
46
+ "id": "crown",
47
+ "kind": "lathe",
48
+ "profile": [
49
+ [
50
+ 0.21,
51
+ 0
52
+ ],
53
+ [
54
+ 0.21,
55
+ 0.1
56
+ ],
57
+ [
58
+ 0.16,
59
+ 0.22
60
+ ],
61
+ [
62
+ 0,
63
+ 0.26
64
+ ]
65
+ ],
66
+ "color": "#e5484d",
67
+ "segments": 16,
68
+ "flat": true
69
+ },
70
+ {
71
+ "id": "badge",
72
+ "kind": "box",
73
+ "size": [
74
+ 0.07,
75
+ 0.09,
76
+ 0.02
77
+ ],
78
+ "position": [
79
+ 0,
80
+ 0.1,
81
+ 0.215
82
+ ],
83
+ "color": "#e3c35a",
84
+ "flat": true
85
+ }
86
+ ]
87
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "hard-hat",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "brim",
14
+ "kind": "lathe",
15
+ "segments": 16,
16
+ "profile": [
17
+ [
18
+ 0.16,
19
+ -0.011
20
+ ],
21
+ [
22
+ 0.23500000000000001,
23
+ -0.011
24
+ ],
25
+ [
26
+ 0.26,
27
+ -0.0044
28
+ ],
29
+ [
30
+ 0.26,
31
+ 0.0088
32
+ ],
33
+ [
34
+ 0.23500000000000001,
35
+ 0.011
36
+ ],
37
+ [
38
+ 0.16,
39
+ 0.011
40
+ ]
41
+ ],
42
+ "color": "#2b2b33",
43
+ "flat": true
44
+ },
45
+ {
46
+ "id": "crown",
47
+ "kind": "lathe",
48
+ "profile": [
49
+ [
50
+ 0.21,
51
+ 0
52
+ ],
53
+ [
54
+ 0.2,
55
+ 0.14
56
+ ],
57
+ [
58
+ 0.12,
59
+ 0.23
60
+ ],
61
+ [
62
+ 0,
63
+ 0.25
64
+ ]
65
+ ],
66
+ "color": "#f0c419",
67
+ "segments": 16,
68
+ "flat": true
69
+ }
70
+ ]
71
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "nurse-cap",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "cap",
14
+ "kind": "box",
15
+ "size": [
16
+ 0.4,
17
+ 0.13,
18
+ 0.3
19
+ ],
20
+ "position": [
21
+ 0,
22
+ 0.065,
23
+ 0
24
+ ],
25
+ "color": "#f4f6fa",
26
+ "flat": true
27
+ },
28
+ {
29
+ "id": "crossV",
30
+ "kind": "box",
31
+ "size": [
32
+ 0.025,
33
+ 0.08,
34
+ 0.015
35
+ ],
36
+ "position": [
37
+ 0,
38
+ 0.07,
39
+ 0.16
40
+ ],
41
+ "color": "#e5484d",
42
+ "flat": true
43
+ },
44
+ {
45
+ "id": "crossH",
46
+ "kind": "box",
47
+ "size": [
48
+ 0.08,
49
+ 0.025,
50
+ 0.015
51
+ ],
52
+ "position": [
53
+ 0,
54
+ 0.07,
55
+ 0.16
56
+ ],
57
+ "color": "#e5484d",
58
+ "flat": true
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "police-cap",
4
+ "triangles": 900,
5
+ "look": {
6
+ "outline": 0.02,
7
+ "outlineColor": "#241a2e",
8
+ "rim": 0.3,
9
+ "ao": 0.4
10
+ },
11
+ "parts": [
12
+ {
13
+ "id": "crown",
14
+ "kind": "cylinder",
15
+ "radius": 0.21,
16
+ "height": 0.12,
17
+ "position": [
18
+ 0,
19
+ 0.06,
20
+ 0
21
+ ],
22
+ "color": "#22335a",
23
+ "segments": 16,
24
+ "flat": true
25
+ },
26
+ {
27
+ "id": "band",
28
+ "kind": "cylinder",
29
+ "radius": 0.215,
30
+ "height": 0.025,
31
+ "position": [
32
+ 0,
33
+ 0.012,
34
+ 0
35
+ ],
36
+ "color": "#2b2b33",
37
+ "segments": 16,
38
+ "flat": true
39
+ },
40
+ {
41
+ "id": "visor",
42
+ "kind": "extrude",
43
+ "outline": [
44
+ [
45
+ -0.19,
46
+ 0
47
+ ],
48
+ [
49
+ -0.1748,
50
+ 0.165
51
+ ],
52
+ [
53
+ -0.10450000000000001,
54
+ 0.27
55
+ ],
56
+ [
57
+ 0,
58
+ 0.3
59
+ ],
60
+ [
61
+ 0.10450000000000001,
62
+ 0.27
63
+ ],
64
+ [
65
+ 0.1748,
66
+ 0.165
67
+ ],
68
+ [
69
+ 0.19,
70
+ 0
71
+ ]
72
+ ],
73
+ "depth": 0.02,
74
+ "bevel": 0.006,
75
+ "position": [
76
+ 0,
77
+ 0.015,
78
+ 0
79
+ ],
80
+ "rotation": [
81
+ 82,
82
+ 0,
83
+ 0
84
+ ],
85
+ "color": "#2b2b33",
86
+ "flat": true
87
+ },
88
+ {
89
+ "id": "badge",
90
+ "kind": "box",
91
+ "size": [
92
+ 0.06,
93
+ 0.06,
94
+ 0.018
95
+ ],
96
+ "position": [
97
+ 0,
98
+ 0.07,
99
+ 0.212
100
+ ],
101
+ "color": "#e3c35a",
102
+ "flat": true
103
+ }
104
+ ]
105
+ }