castle-web-cli 0.4.237 → 0.4.238

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 (216) 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 +78 -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 +5 -0
  14. package/dist/init.js +2 -1
  15. package/dist/save-deck.js +4 -0
  16. package/kits/base/castle.json +1 -1
  17. package/kits/base/sdk/README.md +47 -0
  18. package/kits/base/sdk/castle.d.ts +3 -1
  19. package/kits/base/sdk/castle.js +1 -0
  20. package/kits/base/sdk/commands.d.ts +25 -1
  21. package/kits/base/sdk/commands.js +29 -1
  22. package/kits/base/sdk/hub.d.ts +17 -0
  23. package/kits/base/sdk/hub.js +33 -9
  24. package/kits/base/sdk/localCache.d.ts +27 -0
  25. package/kits/base/sdk/localCache.js +115 -0
  26. package/kits/base/sdk/localCacheStore.d.ts +15 -0
  27. package/kits/base/sdk/localCacheStore.js +358 -0
  28. package/kits/base/sdk/transport.d.ts +1 -0
  29. package/kits/base/sdk/transport.js +4 -5
  30. package/kits/hub-game/CLAUDE.md +22 -2
  31. package/kits/hub-game/castle.json +4 -1
  32. package/kits/hub-game/code/client/act.js +66 -91
  33. package/kits/hub-game/code/client/actCore.js +134 -0
  34. package/kits/hub-game/code/client/car.js +35 -0
  35. package/kits/hub-game/code/client/chrome.js +207 -381
  36. package/kits/hub-game/code/client/crowdNames.js +2 -2
  37. package/kits/hub-game/code/client/emoteWheel.js +109 -0
  38. package/kits/hub-game/code/client/hats.js +2 -0
  39. package/kits/hub-game/code/client/hookLayer.js +99 -48
  40. package/kits/hub-game/code/client/hostGo.js +77 -0
  41. package/kits/hub-game/code/client/hubControls.js +125 -0
  42. package/kits/hub-game/code/client/hubEntry.js +187 -0
  43. package/kits/hub-game/code/client/hudSurface.js +148 -0
  44. package/kits/hub-game/code/client/hudTree.js +96 -0
  45. package/kits/hub-game/code/client/idle.js +59 -13
  46. package/kits/hub-game/code/client/invites.js +13 -4
  47. package/kits/hub-game/code/client/menuIcons.js +8 -0
  48. package/kits/hub-game/code/client/noTrips.js +38 -0
  49. package/kits/hub-game/code/client/qualityEntry.js +6 -1
  50. package/kits/hub-game/code/client/rehello.js +3 -1
  51. package/kits/hub-game/code/client/riders.js +26 -0
  52. package/kits/hub-game/code/client/role.js +79 -0
  53. package/kits/hub-game/code/client/safeLayout.js +32 -3
  54. package/kits/hub-game/code/client/sound.js +10 -3
  55. package/kits/hub-game/code/client/soundscape.js +2 -2
  56. package/kits/hub-game/code/client/soundscapeAmbience.js +38 -8
  57. package/kits/hub-game/code/client/soundscapeBaked.js +24 -5
  58. package/kits/hub-game/code/client/soundscapeCues.js +2 -1
  59. package/kits/hub-game/code/client/state.js +19 -0
  60. package/kits/hub-game/code/client/stuck.js +2 -1
  61. package/kits/hub-game/code/client/talkSurface.js +178 -0
  62. package/kits/hub-game/code/client/talkTree.js +238 -0
  63. package/kits/hub-game/code/client/tiers.js +8 -5
  64. package/kits/hub-game/code/client/uiDom.js +600 -0
  65. package/kits/hub-game/code/client/uiTree.js +359 -0
  66. package/kits/hub-game/code/client/vehicle.js +154 -0
  67. package/kits/hub-game/code/client/wear.js +27 -5
  68. package/kits/hub-game/code/client/worldLabels.js +3 -2
  69. package/kits/hub-game/code/client/yours.js +10 -3
  70. package/kits/hub-game/code/server/actors.js +4 -3
  71. package/kits/hub-game/code/server/analytics.js +56 -6
  72. package/kits/hub-game/code/server/decor.js +56 -16
  73. package/kits/hub-game/code/server/hub.js +258 -46
  74. package/kits/hub-game/code/server/idle.js +118 -5
  75. package/kits/hub-game/code/server/manifest.js +46 -4
  76. package/kits/hub-game/code/server/npcs.js +4 -2
  77. package/kits/hub-game/code/server/players.js +3 -0
  78. package/kits/hub-game/code/server/role.js +142 -0
  79. package/kits/hub-game/code/server/standing.js +6 -4
  80. package/kits/hub-game/code/server/vehicle.js +126 -0
  81. package/kits/hub-game/code/shared/car.js +52 -0
  82. package/kits/hub-game/code/shared/deckFlags.js +34 -0
  83. package/kits/hub-game/code/shared/deviceClass.js +39 -0
  84. package/kits/hub-game/code/shared/expression.js +9 -0
  85. package/kits/hub-game/code/systems/hub.js +272 -84
  86. package/kits/hub-game/docs/analytics.md +11 -2
  87. package/kits/hub-game/docs/contract.md +352 -14
  88. package/kits/hub-game/docs/vehicle-preset.md +132 -0
  89. package/kits/hub-game/models/hats/baker-cap.pxmodel +89 -0
  90. package/kits/hub-game/models/hats/chef-toque.pxmodel +60 -0
  91. package/kits/hub-game/models/hats/delivery-cap.pxmodel +105 -0
  92. package/kits/hub-game/models/hats/fire-helmet.pxmodel +87 -0
  93. package/kits/hub-game/models/hats/hard-hat.pxmodel +71 -0
  94. package/kits/hub-game/models/hats/nurse-cap.pxmodel +61 -0
  95. package/kits/hub-game/models/hats/police-cap.pxmodel +105 -0
  96. package/kits/hub-game/models/hats/teacher-beret.pxmodel +52 -0
  97. package/kits/hub-game/models/role/square/top-apron.pxmodel +109 -0
  98. package/kits/hub-game/models/role/square/top-cardigan.pxmodel +141 -0
  99. package/kits/hub-game/models/role/square/top-coat.pxmodel +157 -0
  100. package/kits/hub-game/models/role/square/top-scrubs.pxmodel +93 -0
  101. package/kits/hub-game/models/role/square/top-tabard.pxmodel +109 -0
  102. package/kits/hub-game/models/role/square/top-vest.pxmodel +109 -0
  103. package/kits/hub-game/models/role/tool-bag.pxmodel +75 -0
  104. package/kits/hub-game/models/role/tool-bell.pxmodel +71 -0
  105. package/kits/hub-game/models/role/tool-hose.pxmodel +60 -0
  106. package/kits/hub-game/models/role/tool-parcel.pxmodel +61 -0
  107. package/kits/hub-game/models/role/tool-torch.pxmodel +55 -0
  108. package/kits/hub-game/models/role/tool-tray.pxmodel +75 -0
  109. package/kits/hub-game/models/role/top-apron.pxmodel +70 -0
  110. package/kits/hub-game/models/role/top-cardigan.pxmodel +102 -0
  111. package/kits/hub-game/models/role/top-coat.pxmodel +79 -0
  112. package/kits/hub-game/models/role/top-scrubs.pxmodel +54 -0
  113. package/kits/hub-game/models/role/top-tabard.pxmodel +70 -0
  114. package/kits/hub-game/models/role/top-vest.pxmodel +70 -0
  115. package/kits/hub-game/package-lock.json +1 -1
  116. package/kits/hub-game/package.json +1 -1
  117. package/kits/hub-game/scripts/check.mjs +7 -4
  118. package/kits/hub-game/scripts/fixtures/car-vectors.json +279 -0
  119. package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +2 -1
  120. package/kits/hub-game/scripts/fixtures/hud-surface.json +670 -0
  121. package/kits/hub-game/scripts/fixtures/talk-surface.json +3930 -0
  122. package/kits/hub-game/scripts/gen-hats.mjs +46 -2
  123. package/kits/hub-game/scripts/gen-role.mjs +80 -0
  124. package/kits/hub-game/scripts/test-act-core.mjs +167 -0
  125. package/kits/hub-game/scripts/test-actions-client.mjs +34 -0
  126. package/kits/hub-game/scripts/test-actors.mjs +48 -0
  127. package/kits/hub-game/scripts/test-analytics.mjs +99 -5
  128. package/kits/hub-game/scripts/test-apply-deck.mjs +122 -0
  129. package/kits/hub-game/scripts/test-back-visibility.mjs +3 -1
  130. package/kits/hub-game/scripts/test-ballot.mjs +2 -0
  131. package/kits/hub-game/scripts/test-car.mjs +43 -0
  132. package/kits/hub-game/scripts/test-decor-client.mjs +2 -1
  133. package/kits/hub-game/scripts/test-decor.mjs +77 -0
  134. package/kits/hub-game/scripts/test-device-class.mjs +83 -0
  135. package/kits/hub-game/scripts/test-emote-wheel.mjs +374 -0
  136. package/kits/hub-game/scripts/test-hats.mjs +5 -4
  137. package/kits/hub-game/scripts/test-host-go.mjs +265 -0
  138. package/kits/hub-game/scripts/test-hub-controls.mjs +108 -0
  139. package/kits/hub-game/scripts/test-hub-entry.mjs +531 -0
  140. package/kits/hub-game/scripts/test-hub-ops.mjs +75 -0
  141. package/kits/hub-game/scripts/test-hud-clear.mjs +12 -2
  142. package/kits/hub-game/scripts/test-hud-rate.mjs +6 -2
  143. package/kits/hub-game/scripts/test-hud-surface.mjs +272 -0
  144. package/kits/hub-game/scripts/test-idle.mjs +347 -1
  145. package/kits/hub-game/scripts/test-interest-cells.mjs +8 -1
  146. package/kits/hub-game/scripts/test-invites-client.mjs +42 -1
  147. package/kits/hub-game/scripts/test-manifest.mjs +30 -0
  148. package/kits/hub-game/scripts/test-no-trips.mjs +42 -0
  149. package/kits/hub-game/scripts/test-placement-cache.mjs +1 -1
  150. package/kits/hub-game/scripts/test-quality.mjs +13 -0
  151. package/kits/hub-game/scripts/test-rehello.mjs +258 -3
  152. package/kits/hub-game/scripts/test-resume-pose-server.mjs +203 -0
  153. package/kits/hub-game/scripts/test-resync.mjs +183 -0
  154. package/kits/hub-game/scripts/test-role-client.mjs +421 -0
  155. package/kits/hub-game/scripts/test-role.mjs +350 -0
  156. package/kits/hub-game/scripts/test-safe-layout.mjs +50 -1
  157. package/kits/hub-game/scripts/test-soundscape.mjs +124 -7
  158. package/kits/hub-game/scripts/test-standing.mjs +15 -1
  159. package/kits/hub-game/scripts/test-talk-surface.mjs +296 -0
  160. package/kits/hub-game/scripts/test-tiers.mjs +13 -0
  161. package/kits/hub-game/scripts/test-ui-dom-dom.mjs +96 -0
  162. package/kits/hub-game/scripts/test-ui-tree.mjs +711 -0
  163. package/kits/hub-game/scripts/test-vehicle-client.mjs +159 -0
  164. package/kits/hub-game/scripts/test-vehicle.mjs +135 -0
  165. package/kits/hub-game/scripts/test-yours.mjs +33 -0
  166. package/kits/hub-game/tools/hubScene/export.mjs +613 -0
  167. package/kits/hub-game/tools/hubScene/hubdata.mjs +921 -0
  168. package/kits/hub-game/tools/hubScene/merge-root.mjs +39 -0
  169. package/kits/hub-game/tools/hubScene/nodeworld.mjs +227 -0
  170. package/kits/hub-game/tools/hubScene/test/export-fixture.mjs +798 -0
  171. package/kits/hub-game/tools/hubScene/test/fixture.json +637 -0
  172. package/kits/hub-game/tools/hubScene/test/paint-export.mjs +40 -0
  173. package/kits/hub-game/tools/hubScene/test/upload.test.mjs +655 -0
  174. package/kits/hub-game/tools/hubScene/upload.mjs +636 -0
  175. package/kits/hub-game/tools/hubScene/validate-manifest.mjs +291 -0
  176. package/kits/multiplayer-3d/castle.json +4 -4
  177. package/kits/multiplayer-3d/code/client/resumeGate.js +30 -2
  178. package/kits/multiplayer-3d/code/client/steer.js +3 -1
  179. package/kits/multiplayer-3d/code/systems/multiplayer.js +30 -2
  180. package/kits/multiplayer-3d/package-lock.json +1 -1
  181. package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +74 -2
  182. package/kits/physics-3d/CLAUDE.md +1 -1
  183. package/kits/physics-3d/behaviors/Player.jsx +37 -27
  184. package/kits/physics-3d/castle.json +2 -2
  185. package/kits/physics-3d/docs/engine-geometry-memory.md +23 -0
  186. package/kits/physics-3d/engine3d/memoryprofile.js +17 -0
  187. package/kits/physics-3d/engine3d/playerRun.js +6 -1
  188. package/kits/physics-3d/engine3d/pxmodel.js +6 -1
  189. package/kits/physics-3d/engine3d/world3d.js +6 -3
  190. package/kits/physics-3d/package.json +1 -1
  191. package/kits/physics-3d/play/behaviors/Player.js +40 -28
  192. package/kits/physics-3d/scripts/test-memory-profile.mjs +237 -0
  193. package/kits/physics-3d/systems/physics3d.js +5 -2
  194. package/kits/real-time/castle.json +2 -2
  195. package/kits/real-time/code/client/messages.js +5 -0
  196. package/kits/real-time/code/server/session.js +28 -1
  197. package/kits/real-time/package-lock.json +1 -1
  198. package/package.json +5 -4
  199. package/vendor/three/LICENSE +21 -0
  200. package/vendor/three/build/three.core.js +58773 -0
  201. package/vendor/three/build/three.module.js +18251 -0
  202. package/vendor/three/examples/jsm/controls/OrbitControls.js +1860 -0
  203. package/vendor/three/examples/jsm/controls/TransformControls.js +1918 -0
  204. package/vendor/three/examples/jsm/exporters/GLTFExporter.js +3595 -0
  205. package/vendor/three/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
  206. package/vendor/three/examples/jsm/math/MeshSurfaceSampler.js +315 -0
  207. package/vendor/three/examples/jsm/postprocessing/EffectComposer.js +363 -0
  208. package/vendor/three/examples/jsm/postprocessing/MaskPass.js +195 -0
  209. package/vendor/three/examples/jsm/postprocessing/OutputPass.js +139 -0
  210. package/vendor/three/examples/jsm/postprocessing/Pass.js +191 -0
  211. package/vendor/three/examples/jsm/postprocessing/RenderPass.js +183 -0
  212. package/vendor/three/examples/jsm/postprocessing/ShaderPass.js +135 -0
  213. package/vendor/three/examples/jsm/shaders/CopyShader.js +52 -0
  214. package/vendor/three/examples/jsm/shaders/OutputShader.js +103 -0
  215. package/vendor/three/examples/jsm/utils/BufferGeometryUtils.js +1435 -0
  216. package/vendor/three/package.json +134 -0
@@ -0,0 +1,637 @@
1
+ {
2
+ "//": "Two deck folders the export test writes to a temp dir. Kept as one JSON file, not as .scene/.pxmodel files, because the kits glob every such file under a deck (physics-2d files.js) into each importing deck bundle. A string value is written as is (a code file).",
3
+ "files": {
4
+ "hub-mini/blueprints/hub-player.scene": {
5
+ "name": "Hub Player",
6
+ "actors": [
7
+ {
8
+ "components": {
9
+ "Transform": {
10
+ "y": 1
11
+ },
12
+ "Shape": {
13
+ "kind": "capsule",
14
+ "radius": 0.35,
15
+ "height": 1.4,
16
+ "color": "#cf8acb",
17
+ "roughness": 0.4
18
+ },
19
+ "Body": {
20
+ "type": "dynamic",
21
+ "lockRotations": true,
22
+ "friction": 0,
23
+ "gravityScale": 2
24
+ },
25
+ "Solid": {},
26
+ "Model": {
27
+ "file": "imports/castle.physics-3d/models/player.pxmodel",
28
+ "yOffset": -0.7
29
+ },
30
+ "Player": {}
31
+ }
32
+ }
33
+ ]
34
+ },
35
+ "hub-mini/castle.json": {
36
+ "title": "Mini Hub (export fixture)",
37
+ "editor": {
38
+ "defaultPlayFile": "scenes/main.scene"
39
+ },
40
+ "imports": {
41
+ "castle.hub-game": {
42
+ "source": "builtin",
43
+ "kit": "hub-game",
44
+ "version": "0.0.0"
45
+ }
46
+ },
47
+ "hub": {
48
+ "contract": 1,
49
+ "title": "Mini Hub",
50
+ "arrival": {
51
+ "face": 180,
52
+ "spread": 1.5
53
+ },
54
+ "tiers": true,
55
+ "lowActorDistance": true,
56
+ "act": true,
57
+ "safeInsets": true,
58
+ "labels": "near",
59
+ "invite": true,
60
+ "places": {
61
+ "main": {
62
+ "invite": false
63
+ }
64
+ }
65
+ },
66
+ "devDecks": {
67
+ "dash": "../hub-mini-door",
68
+ "dash2": "../dash2-preferred"
69
+ }
70
+ },
71
+ "hub-mini/models/bench.pxmodel": {
72
+ "format": "pxmodel",
73
+ "name": "Bench",
74
+ "look": {
75
+ "outline": 0.03,
76
+ "outlineColor": "#241a2e",
77
+ "rim": 0,
78
+ "ao": 0.12
79
+ },
80
+ "parts": [
81
+ {
82
+ "id": "seat",
83
+ "kind": "box",
84
+ "position": [
85
+ 0,
86
+ 0.4,
87
+ 0
88
+ ],
89
+ "color": "#b98a5e",
90
+ "roughness": 1,
91
+ "size": [
92
+ 2,
93
+ 0.15,
94
+ 0.6
95
+ ],
96
+ "round": 0.05,
97
+ "roundSegments": 1
98
+ }
99
+ ]
100
+ },
101
+ "hub-mini/scenes/main.scene": {
102
+ "name": "Mini Hub",
103
+ "ground": {
104
+ "color": "#6f8f5a"
105
+ },
106
+ "actors": [
107
+ {
108
+ "id": "floor",
109
+ "components": {
110
+ "Transform": {
111
+ "y": -0.25
112
+ },
113
+ "Shape": {
114
+ "kind": "box",
115
+ "width": 20,
116
+ "height": 0.5,
117
+ "depth": 20,
118
+ "color": "#8a8f6a"
119
+ },
120
+ "Solid": {},
121
+ "WalkSurface": {}
122
+ }
123
+ },
124
+ {
125
+ "id": "wall-n",
126
+ "components": {
127
+ "Transform": {
128
+ "y": 1,
129
+ "z": -10
130
+ },
131
+ "Shape": {
132
+ "kind": "box",
133
+ "width": 20,
134
+ "height": 2,
135
+ "depth": 0.5,
136
+ "color": "#4b4f58"
137
+ },
138
+ "Solid": {}
139
+ },
140
+ "static": true
141
+ },
142
+ {
143
+ "id": "bench-0",
144
+ "components": {
145
+ "Transform": {
146
+ "x": 3,
147
+ "z": 2,
148
+ "rotationY": 90
149
+ },
150
+ "Shape": {
151
+ "kind": "box",
152
+ "width": 2,
153
+ "height": 0.6,
154
+ "depth": 0.6
155
+ },
156
+ "Solid": {},
157
+ "Model": {
158
+ "file": "models/bench.pxmodel"
159
+ }
160
+ }
161
+ },
162
+ {
163
+ "id": "bench-1",
164
+ "components": {
165
+ "Transform": {
166
+ "x": -3,
167
+ "z": 2,
168
+ "rotationY": 270
169
+ },
170
+ "Shape": {
171
+ "kind": "box",
172
+ "width": 2,
173
+ "height": 0.6,
174
+ "depth": 0.6
175
+ },
176
+ "Solid": {},
177
+ "Model": {
178
+ "file": "models/bench.pxmodel"
179
+ }
180
+ }
181
+ },
182
+ {
183
+ "id": "door-dash",
184
+ "components": {
185
+ "Transform": {
186
+ "x": 0,
187
+ "y": 1.25,
188
+ "z": -9.5
189
+ },
190
+ "Shape": {
191
+ "kind": "box",
192
+ "width": 1.6,
193
+ "height": 2.5,
194
+ "depth": 0.3,
195
+ "color": "#7a4b2a"
196
+ },
197
+ "Solid": {},
198
+ "HubDoor": {
199
+ "id": "dash",
200
+ "to": "deck:dash",
201
+ "title": "Dash",
202
+ "minPlayers": 1,
203
+ "maxPlayers": 4,
204
+ "exitX": 0,
205
+ "exitZ": -7.5,
206
+ "exitFacing": 180
207
+ }
208
+ }
209
+ },
210
+ {
211
+ "id": "pad-dash",
212
+ "components": {
213
+ "Transform": {
214
+ "x": 0,
215
+ "y": 0.01,
216
+ "z": -8.4
217
+ },
218
+ "Shape": {
219
+ "kind": "cylinder",
220
+ "radius": 1.2,
221
+ "height": 0.02,
222
+ "color": "#ffd166"
223
+ },
224
+ "HubPad": {
225
+ "door": "dash",
226
+ "radius": 1.2
227
+ }
228
+ }
229
+ },
230
+ {
231
+ "id": "door-lost",
232
+ "components": {
233
+ "Transform": {
234
+ "x": 6,
235
+ "y": 1.25,
236
+ "z": -9.5
237
+ },
238
+ "Shape": {
239
+ "kind": "box",
240
+ "width": 1.6,
241
+ "height": 2.5,
242
+ "depth": 0.3
243
+ },
244
+ "Solid": {},
245
+ "HubDoor": {
246
+ "id": "lost",
247
+ "to": "deck:nowhere",
248
+ "title": "Nowhere"
249
+ }
250
+ }
251
+ },
252
+ {
253
+ "id": "door-arcade",
254
+ "components": {
255
+ "Transform": {
256
+ "x": 8,
257
+ "y": 1.25,
258
+ "z": -9.5
259
+ },
260
+ "Shape": {
261
+ "kind": "box",
262
+ "width": 1.6,
263
+ "height": 2.5,
264
+ "depth": 0.3
265
+ },
266
+ "Solid": {},
267
+ "HubDoor": {
268
+ "id": "arcade",
269
+ "kind": "cabinet",
270
+ "to": "deck:classic",
271
+ "title": "Arcade"
272
+ }
273
+ }
274
+ },
275
+ {
276
+ "id": "door-dash2",
277
+ "components": {
278
+ "Transform": {
279
+ "x": -6,
280
+ "y": 1.25,
281
+ "z": -9.5
282
+ },
283
+ "Shape": {
284
+ "kind": "box",
285
+ "width": 1.6,
286
+ "height": 2.5,
287
+ "depth": 0.3
288
+ },
289
+ "Solid": {},
290
+ "HubDoor": {
291
+ "id": "dash2",
292
+ "to": "deck:dash2",
293
+ "title": "Dash Two"
294
+ }
295
+ }
296
+ },
297
+ {
298
+ "id": "npc-greeter",
299
+ "components": {
300
+ "Transform": {
301
+ "x": -2,
302
+ "y": 0.7,
303
+ "z": -3
304
+ },
305
+ "Shape": {
306
+ "kind": "capsule",
307
+ "radius": 0.35,
308
+ "height": 1.4,
309
+ "color": "#cf8acb"
310
+ },
311
+ "Solid": {},
312
+ "HubNpc": {
313
+ "name": "Rowan",
314
+ "character": "greeter",
315
+ "role": "greeter"
316
+ }
317
+ }
318
+ },
319
+ {
320
+ "id": "sign-1",
321
+ "components": {
322
+ "Transform": {
323
+ "x": 2,
324
+ "y": 1,
325
+ "z": -3
326
+ },
327
+ "Shape": {
328
+ "kind": "box",
329
+ "width": 1,
330
+ "height": 2,
331
+ "depth": 0.2
332
+ },
333
+ "Solid": {},
334
+ "Lookable": {
335
+ "text": "Welcome to the mini hub"
336
+ }
337
+ },
338
+ "static": true
339
+ },
340
+ {
341
+ "id": "rock-a",
342
+ "static": true,
343
+ "components": {
344
+ "Transform": {
345
+ "x": 4,
346
+ "y": 0.3,
347
+ "z": -6
348
+ },
349
+ "Shape": {
350
+ "kind": "sphere",
351
+ "radius": 0.4,
352
+ "color": "#8d8d8d"
353
+ },
354
+ "Solid": {}
355
+ }
356
+ },
357
+ {
358
+ "id": "rock-far",
359
+ "static": true,
360
+ "components": {
361
+ "Transform": {
362
+ "x": 40,
363
+ "y": 0.3,
364
+ "z": -6
365
+ },
366
+ "Shape": {
367
+ "kind": "sphere",
368
+ "radius": 0.4,
369
+ "color": "#8d8d8d"
370
+ },
371
+ "Solid": {}
372
+ }
373
+ },
374
+ {
375
+ "id": "bush-0",
376
+ "static": true,
377
+ "components": {
378
+ "Transform": {
379
+ "x": -4,
380
+ "y": 0.3,
381
+ "z": -6
382
+ },
383
+ "Shape": {
384
+ "kind": "sphere",
385
+ "radius": 0.5,
386
+ "color": "#4f7a3a"
387
+ }
388
+ }
389
+ },
390
+ {
391
+ "id": "lamp-1",
392
+ "static": true,
393
+ "components": {
394
+ "Transform": {
395
+ "x": 5,
396
+ "y": 1,
397
+ "z": -5
398
+ },
399
+ "Shape": {
400
+ "kind": "cylinder",
401
+ "radius": 0.1,
402
+ "height": 2,
403
+ "color": "#333333"
404
+ },
405
+ "Solid": {}
406
+ }
407
+ },
408
+ {
409
+ "id": "statue",
410
+ "static": true,
411
+ "components": {
412
+ "Transform": {
413
+ "x": -5,
414
+ "y": 1,
415
+ "z": -5
416
+ },
417
+ "Shape": {
418
+ "kind": "box",
419
+ "width": 0.6,
420
+ "height": 2,
421
+ "depth": 0.6,
422
+ "color": "#bbbbbb"
423
+ },
424
+ "Solid": {}
425
+ }
426
+ },
427
+ {
428
+ "id": "statue-plaque",
429
+ "components": {
430
+ "Transform": {
431
+ "x": -5,
432
+ "y": 0.2,
433
+ "z": -4.5
434
+ },
435
+ "TownPlaque": {
436
+ "of": "statue"
437
+ }
438
+ }
439
+ },
440
+ {
441
+ "id": "look-spot",
442
+ "static": true,
443
+ "components": {
444
+ "Transform": {
445
+ "x": 1,
446
+ "y": 1,
447
+ "z": -2
448
+ },
449
+ "Lookable": {
450
+ "text": "A quiet corner"
451
+ }
452
+ }
453
+ },
454
+ {
455
+ "id": "glow-dim",
456
+ "static": true,
457
+ "components": {
458
+ "Transform": {
459
+ "x": 6,
460
+ "y": 0.3,
461
+ "z": -7
462
+ },
463
+ "Shape": {
464
+ "kind": "sphere",
465
+ "radius": 0.3,
466
+ "color": "#ffcc66",
467
+ "emissive": "#ffcc66",
468
+ "emissiveIntensity": 0.2
469
+ },
470
+ "Solid": {}
471
+ }
472
+ },
473
+ {
474
+ "id": "glow-bright",
475
+ "static": true,
476
+ "components": {
477
+ "Transform": {
478
+ "x": 7,
479
+ "y": 0.3,
480
+ "z": -7
481
+ },
482
+ "Shape": {
483
+ "kind": "sphere",
484
+ "radius": 0.3,
485
+ "color": "#ffcc66",
486
+ "emissive": "#ffcc66",
487
+ "emissiveIntensity": 4
488
+ },
489
+ "Solid": {}
490
+ }
491
+ },
492
+ {
493
+ "id": "rock-near",
494
+ "static": true,
495
+ "lowDrawDistance": 12,
496
+ "components": {
497
+ "Transform": {
498
+ "x": 3,
499
+ "y": 0.3,
500
+ "z": -6
501
+ },
502
+ "Shape": {
503
+ "kind": "sphere",
504
+ "radius": 0.4,
505
+ "color": "#8d8d8d"
506
+ },
507
+ "Solid": {}
508
+ }
509
+ },
510
+ {
511
+ "id": "bench-copy",
512
+ "components": {
513
+ "Transform": {
514
+ "x": 0,
515
+ "z": 2
516
+ },
517
+ "Shape": {
518
+ "kind": "box",
519
+ "width": 2,
520
+ "height": 0.6,
521
+ "depth": 0.6
522
+ },
523
+ "Solid": {},
524
+ "Model": {
525
+ "file": "models/bench-copy.pxmodel"
526
+ }
527
+ }
528
+ },
529
+ {
530
+ "id": "lever-1",
531
+ "components": {
532
+ "Transform": {
533
+ "x": -8,
534
+ "y": 0.5,
535
+ "z": 5,
536
+ "rotationY": 45
537
+ },
538
+ "Shape": {
539
+ "kind": "box",
540
+ "width": 0.3,
541
+ "height": 1,
542
+ "depth": 0.3,
543
+ "color": "#aa3333"
544
+ },
545
+ "HubAct": {
546
+ "verb": "Pull",
547
+ "reach": 1.5,
548
+ "hold": false,
549
+ "id": "lever"
550
+ }
551
+ }
552
+ },
553
+ {
554
+ "id": "seat-1",
555
+ "components": {
556
+ "Transform": {
557
+ "x": 8,
558
+ "y": 0.25,
559
+ "z": 5
560
+ },
561
+ "Shape": {
562
+ "kind": "box",
563
+ "width": 1,
564
+ "height": 0.5,
565
+ "depth": 1,
566
+ "color": "#3366aa"
567
+ },
568
+ "HubSeat": {}
569
+ }
570
+ },
571
+ {
572
+ "id": "player",
573
+ "blueprint": "blueprints/hub-player.scene",
574
+ "components": {
575
+ "Transform": {
576
+ "x": 0,
577
+ "y": 0.7,
578
+ "z": 4,
579
+ "rotationY": 180
580
+ }
581
+ }
582
+ }
583
+ ],
584
+ "engine": {
585
+ "skipUnchangedActors": true,
586
+ "staticActors": true,
587
+ "skipEmptyNodes": true,
588
+ "hubPadRing": true,
589
+ "hubSpawnRing": true,
590
+ "camera": {
591
+ "follow": "rigid",
592
+ "control": "orbit",
593
+ "minPitch": 0
594
+ }
595
+ }
596
+ },
597
+ "hub-mini-door/castle.json": {
598
+ "title": "Mini door target (export fixture)",
599
+ "deckId": "fixtureDash1"
600
+ },
601
+ "hub-dash2/castle.json": {
602
+ "title": "Fallback door target (export fixture)",
603
+ "deckId": "fixtureDash2"
604
+ },
605
+ "hub-mini/code/server/lamps.js": "// The fixture's server code: lamp-1 is tinted by id, so it is never merged.\nexport const onDusk = (hub) => hub.tint('lamp-1', '#ffd58a');\n",
606
+ "hub-mini/models/bench-copy.pxmodel": {
607
+ "format": "pxmodel",
608
+ "name": "Bench",
609
+ "look": {
610
+ "outline": 0.03,
611
+ "outlineColor": "#241a2e",
612
+ "rim": 0,
613
+ "ao": 0.12
614
+ },
615
+ "parts": [
616
+ {
617
+ "id": "seat",
618
+ "kind": "box",
619
+ "position": [
620
+ 0,
621
+ 0.4,
622
+ 0
623
+ ],
624
+ "color": "#b98a5e",
625
+ "roughness": 1,
626
+ "size": [
627
+ 2,
628
+ 0.15,
629
+ 0.6
630
+ ],
631
+ "round": 0.05,
632
+ "roundSegments": 1
633
+ }
634
+ ]
635
+ }
636
+ }
637
+ }
@@ -0,0 +1,40 @@
1
+ // A car look's paint parts in the hubScene export (hubdata.mjs namePaint): a paint part the merge
2
+ // kept apart (`keep`) has its material named 'paint', which native tints in the car's colour; a
3
+ // paint part merged into a batch, and every other part, keeps an unnamed material.
4
+ // node kits/hub-game/tools/hubScene/test/paint-export.mjs
5
+ import assert from 'node:assert/strict';
6
+ import '../../../../physics-3d/scripts/test-static-passes.mjs';
7
+
8
+ const { buildModelNode, parseModel } = await import('../../../../physics-3d/engine3d/pxmodel.js');
9
+ const { namePaint } = await import('../hubdata.mjs');
10
+
11
+ const box = (id, extra) => ({ id, kind: 'box', size: [1, 0.5, 2], color: '#e8615a', ...extra });
12
+ const model = parseModel(JSON.stringify({
13
+ format: 'pxmodel', name: 'Car',
14
+ parts: [
15
+ box('paint', { keep: true }),
16
+ box('p2', { name: 'paint', keep: true, position: [0, 0.6, 0] }),
17
+ box('p3', { name: 'paint', position: [0, 0, 1.2] }),
18
+ box('p4', { color: '#7fb2d9', position: [0, 0.5, 1] }),
19
+ box('p5', { color: '#222222', position: [0.8, -0.3, 0.8] }),
20
+ ],
21
+ }));
22
+ const node = buildModelNode(model, {}, {}, 'car.pxmodel', ['car.pxmodel'], { optimize: true });
23
+ namePaint(node);
24
+
25
+ const meshes = [];
26
+ node.traverse((o) => o.isMesh && !o.userData.lookOutline && meshes.push(o));
27
+ const named = meshes.filter((m) => [m.material].flat().some((mat) => mat.name === 'paint'));
28
+ assert.deepEqual(named.map((m) => m.userData.partMesh).sort(), ['p2', 'paint'], 'the two kept paint parts are named paint');
29
+ for (const m of named) {
30
+ assert.equal(m.userData.merged, undefined);
31
+ assert.equal(m.material.vertexColors, false, 'a kept part is coloured by its material, which native replaces');
32
+ }
33
+ const merged = meshes.filter((m) => m.userData.merged !== undefined);
34
+ assert.ok(merged.length >= 1, 'the rest is merged');
35
+ for (const m of merged) assert.notEqual(m.material.name, 'paint', 'a batch holding a paint part (p3) is not paint');
36
+
37
+ // The model's own materials are untouched: another build of it is as it was.
38
+ const again = buildModelNode(model, {}, {}, 'car.pxmodel', ['car.pxmodel'], { optimize: true });
39
+ again.traverse((o) => o.isMesh && assert.notEqual([o.material].flat()[0].name, 'paint'));
40
+ console.log('paint-export: ok');