@pinkaphant/kolmo 0.4.7 → 0.5.1

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 (520) hide show
  1. package/README.md +25 -94
  2. package/dist/engine/actor.d.ts +13 -0
  3. package/dist/engine/gltfLoader.d.ts +18 -0
  4. package/dist/engine/index.d.ts +8 -17
  5. package/dist/engine/index.js +667 -27
  6. package/dist/engine/index.js.map +1 -1
  7. package/dist/engine/{kolmoInput.d.ts → input.d.ts} +8 -6
  8. package/dist/engine/surface.d.ts +17 -0
  9. package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +24 -48
  10. package/dist/engine/vehicle.d.ts +20 -0
  11. package/dist/engine/world.d.ts +76 -0
  12. package/dist/index.d.ts +14 -18
  13. package/dist/index.js +16 -116
  14. package/dist/physics/index.d.ts +3 -3
  15. package/dist/physics/index.js +1 -131
  16. package/dist/physics/nBodyGravity.d.ts +14 -7
  17. package/dist/physics-ZDFXaCli.js +475 -0
  18. package/dist/physics-ZDFXaCli.js.map +1 -0
  19. package/dist/surface-DUol_5ml.js +610 -0
  20. package/dist/surface-DUol_5ml.js.map +1 -0
  21. package/dist/toolgun/Toolgun.d.ts +33 -0
  22. package/dist/toolgun/index.d.ts +2 -0
  23. package/dist/toolgun/index.js +1 -0
  24. package/dist/toolgun/store.d.ts +198 -0
  25. package/dist/toolgun-BfcCIAQx.js +1582 -0
  26. package/dist/toolgun-BfcCIAQx.js.map +1 -0
  27. package/dist/vite/index.d.ts +0 -4
  28. package/dist/vite/index.js +1 -9
  29. package/dist/vite/index.js.map +1 -1
  30. package/package.json +32 -89
  31. package/AGENTS.md +0 -29
  32. package/CLAUDE.md +0 -8
  33. package/bin/kolmo.mjs +0 -561
  34. package/dist/engine/causewayBridge.d.ts +0 -14
  35. package/dist/engine/causewayBridge.js +0 -166
  36. package/dist/engine/causewayBridge.js.map +0 -1
  37. package/dist/engine/islandSettlementMesh.d.ts +0 -26
  38. package/dist/engine/islandSettlementMesh.js +0 -166
  39. package/dist/engine/islandSettlementMesh.js.map +0 -1
  40. package/dist/engine/kolmoActions.d.ts +0 -23
  41. package/dist/engine/kolmoActions.js +0 -179
  42. package/dist/engine/kolmoActions.js.map +0 -1
  43. package/dist/engine/kolmoActor.d.ts +0 -21
  44. package/dist/engine/kolmoActor.js +0 -273
  45. package/dist/engine/kolmoActor.js.map +0 -1
  46. package/dist/engine/kolmoActorHelpers.d.ts +0 -24
  47. package/dist/engine/kolmoActorHelpers.js +0 -64
  48. package/dist/engine/kolmoActorHelpers.js.map +0 -1
  49. package/dist/engine/kolmoBotControl.d.ts +0 -44
  50. package/dist/engine/kolmoBotControl.js +0 -194
  51. package/dist/engine/kolmoBotControl.js.map +0 -1
  52. package/dist/engine/kolmoBotJournal.d.ts +0 -23
  53. package/dist/engine/kolmoBotJournal.js +0 -138
  54. package/dist/engine/kolmoBotJournal.js.map +0 -1
  55. package/dist/engine/kolmoFloatingOrigin.d.ts +0 -17
  56. package/dist/engine/kolmoFloatingOrigin.js +0 -91
  57. package/dist/engine/kolmoFloatingOrigin.js.map +0 -1
  58. package/dist/engine/kolmoGame.d.ts +0 -27
  59. package/dist/engine/kolmoGame.js +0 -83
  60. package/dist/engine/kolmoGame.js.map +0 -1
  61. package/dist/engine/kolmoGltfLoader.d.ts +0 -16
  62. package/dist/engine/kolmoGltfLoader.js +0 -46
  63. package/dist/engine/kolmoGltfLoader.js.map +0 -1
  64. package/dist/engine/kolmoHud.d.ts +0 -23
  65. package/dist/engine/kolmoHud.js +0 -219
  66. package/dist/engine/kolmoHud.js.map +0 -1
  67. package/dist/engine/kolmoInput.js +0 -165
  68. package/dist/engine/kolmoInput.js.map +0 -1
  69. package/dist/engine/kolmoIsland.d.ts +0 -14
  70. package/dist/engine/kolmoIsland.js +0 -243
  71. package/dist/engine/kolmoIsland.js.map +0 -1
  72. package/dist/engine/kolmoLongDrive.d.ts +0 -12
  73. package/dist/engine/kolmoLongDrive.js +0 -178
  74. package/dist/engine/kolmoLongDrive.js.map +0 -1
  75. package/dist/engine/kolmoPilotMesh.d.ts +0 -6
  76. package/dist/engine/kolmoPilotMesh.js +0 -377
  77. package/dist/engine/kolmoPilotMesh.js.map +0 -1
  78. package/dist/engine/kolmoProcedural.d.ts +0 -13
  79. package/dist/engine/kolmoProcedural.js +0 -101
  80. package/dist/engine/kolmoProcedural.js.map +0 -1
  81. package/dist/engine/kolmoRigs.d.ts +0 -13
  82. package/dist/engine/kolmoRigs.js +0 -100
  83. package/dist/engine/kolmoRigs.js.map +0 -1
  84. package/dist/engine/kolmoStore.d.ts +0 -3
  85. package/dist/engine/kolmoStore.js +0 -4
  86. package/dist/engine/kolmoStore.js.map +0 -1
  87. package/dist/engine/kolmoSurface.d.ts +0 -18
  88. package/dist/engine/kolmoSurface.js +0 -198
  89. package/dist/engine/kolmoSurface.js.map +0 -1
  90. package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
  91. package/dist/engine/kolmoTouchOverlay.js +0 -326
  92. package/dist/engine/kolmoTouchOverlay.js.map +0 -1
  93. package/dist/engine/kolmoTouchState.d.ts +0 -50
  94. package/dist/engine/kolmoTouchState.js +0 -210
  95. package/dist/engine/kolmoTouchState.js.map +0 -1
  96. package/dist/engine/kolmoTraits.js +0 -140
  97. package/dist/engine/kolmoTraits.js.map +0 -1
  98. package/dist/engine/kolmoVehicle.d.ts +0 -4
  99. package/dist/engine/kolmoVehicle.js +0 -80
  100. package/dist/engine/kolmoVehicle.js.map +0 -1
  101. package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -11
  102. package/dist/engine/kolmoVehicleAutoCompile.js +0 -94
  103. package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
  104. package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
  105. package/dist/engine/kolmoVehicleConfig.js +0 -84
  106. package/dist/engine/kolmoVehicleConfig.js.map +0 -1
  107. package/dist/engine/kolmoVehicleDriver.d.ts +0 -39
  108. package/dist/engine/kolmoVehicleDriver.js +0 -147
  109. package/dist/engine/kolmoVehicleDriver.js.map +0 -1
  110. package/dist/engine/kolmoVehicleInner.d.ts +0 -7
  111. package/dist/engine/kolmoVehicleInner.js +0 -307
  112. package/dist/engine/kolmoVehicleInner.js.map +0 -1
  113. package/dist/engine/kolmoWardrobeRig.d.ts +0 -22
  114. package/dist/engine/kolmoWardrobeRig.js +0 -146
  115. package/dist/engine/kolmoWardrobeRig.js.map +0 -1
  116. package/dist/engine/kolmoWorld.d.ts +0 -45
  117. package/dist/engine/kolmoWorld.js +0 -164
  118. package/dist/engine/kolmoWorld.js.map +0 -1
  119. package/dist/engine/longDriveKit.d.ts +0 -19
  120. package/dist/engine/longDriveKit.js +0 -145
  121. package/dist/engine/longDriveKit.js.map +0 -1
  122. package/dist/engine/longDriveRoadside.d.ts +0 -16
  123. package/dist/engine/longDriveRoadside.js +0 -171
  124. package/dist/engine/longDriveRoadside.js.map +0 -1
  125. package/dist/engine/macroCellBuilder.d.ts +0 -44
  126. package/dist/engine/macroCellBuilder.js +0 -228
  127. package/dist/engine/macroCellBuilder.js.map +0 -1
  128. package/dist/engine/mainlandMacroCell.d.ts +0 -15
  129. package/dist/engine/mainlandMacroCell.js +0 -168
  130. package/dist/engine/mainlandMacroCell.js.map +0 -1
  131. package/dist/engine/shiftedFixedBody.d.ts +0 -13
  132. package/dist/engine/shiftedFixedBody.js +0 -75
  133. package/dist/engine/shiftedFixedBody.js.map +0 -1
  134. package/dist/importer/ChopShopPanel.d.ts +0 -52
  135. package/dist/importer/ChopShopPanel.js +0 -409
  136. package/dist/importer/ChopShopPanel.js.map +0 -1
  137. package/dist/importer/DomainWorkshopPanel.d.ts +0 -25
  138. package/dist/importer/DomainWorkshopPanel.js +0 -385
  139. package/dist/importer/DomainWorkshopPanel.js.map +0 -1
  140. package/dist/importer/GateHudBar.d.ts +0 -39
  141. package/dist/importer/GateHudBar.js +0 -401
  142. package/dist/importer/GateHudBar.js.map +0 -1
  143. package/dist/importer/GlbImportGate.d.ts +0 -8
  144. package/dist/importer/GlbImportGate.js +0 -300
  145. package/dist/importer/GlbImportGate.js.map +0 -1
  146. package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
  147. package/dist/importer/ImperativeVehicleRig.js +0 -274
  148. package/dist/importer/ImperativeVehicleRig.js.map +0 -1
  149. package/dist/importer/LiveDrivePads.d.ts +0 -20
  150. package/dist/importer/LiveDrivePads.js +0 -195
  151. package/dist/importer/LiveDrivePads.js.map +0 -1
  152. package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
  153. package/dist/importer/PaperShellDebrisRig.js +0 -143
  154. package/dist/importer/PaperShellDebrisRig.js.map +0 -1
  155. package/dist/importer/R2VaultDrawer.d.ts +0 -12
  156. package/dist/importer/R2VaultDrawer.js +0 -90
  157. package/dist/importer/R2VaultDrawer.js.map +0 -1
  158. package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
  159. package/dist/importer/Step1CalibrationPlinth.js +0 -204
  160. package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
  161. package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
  162. package/dist/importer/Step1ExplodedIslands.js +0 -144
  163. package/dist/importer/Step1ExplodedIslands.js.map +0 -1
  164. package/dist/importer/Step2UniversalPad.d.ts +0 -18
  165. package/dist/importer/Step2UniversalPad.js +0 -123
  166. package/dist/importer/Step2UniversalPad.js.map +0 -1
  167. package/dist/importer/VfxEmitterPool.d.ts +0 -8
  168. package/dist/importer/VfxEmitterPool.js +0 -64
  169. package/dist/importer/VfxEmitterPool.js.map +0 -1
  170. package/dist/importer/WardrobeWorkshopPanel.d.ts +0 -15
  171. package/dist/importer/WardrobeWorkshopPanel.js +0 -529
  172. package/dist/importer/WardrobeWorkshopPanel.js.map +0 -1
  173. package/dist/importer/WheelRingHandles3D.d.ts +0 -11
  174. package/dist/importer/WheelRingHandles3D.js +0 -319
  175. package/dist/importer/WheelRingHandles3D.js.map +0 -1
  176. package/dist/importer/archLinerGeom.d.ts +0 -2
  177. package/dist/importer/archLinerGeom.js +0 -51
  178. package/dist/importer/archLinerGeom.js.map +0 -1
  179. package/dist/importer/chopHingeHelpers.d.ts +0 -15
  180. package/dist/importer/chopHingeHelpers.js +0 -193
  181. package/dist/importer/chopHingeHelpers.js.map +0 -1
  182. package/dist/importer/chopShopActions.d.ts +0 -58
  183. package/dist/importer/chopShopActions.js +0 -165
  184. package/dist/importer/chopShopActions.js.map +0 -1
  185. package/dist/importer/chopShopHandlers.d.ts +0 -26
  186. package/dist/importer/chopShopHandlers.js +0 -283
  187. package/dist/importer/chopShopHandlers.js.map +0 -1
  188. package/dist/importer/chopShopIoActions.d.ts +0 -20
  189. package/dist/importer/chopShopIoActions.js +0 -192
  190. package/dist/importer/chopShopIoActions.js.map +0 -1
  191. package/dist/importer/chopShopMcpAction.d.ts +0 -18
  192. package/dist/importer/chopShopMcpAction.js +0 -58
  193. package/dist/importer/chopShopMcpAction.js.map +0 -1
  194. package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
  195. package/dist/importer/cylinderBooleanSlice.js +0 -110
  196. package/dist/importer/cylinderBooleanSlice.js.map +0 -1
  197. package/dist/importer/cylinderSliceMath.d.ts +0 -14
  198. package/dist/importer/cylinderSliceMath.js +0 -251
  199. package/dist/importer/cylinderSliceMath.js.map +0 -1
  200. package/dist/importer/fusedWheelDetect.d.ts +0 -4
  201. package/dist/importer/fusedWheelDetect.js +0 -297
  202. package/dist/importer/fusedWheelDetect.js.map +0 -1
  203. package/dist/importer/fusedWheelFit.d.ts +0 -19
  204. package/dist/importer/fusedWheelFit.js +0 -219
  205. package/dist/importer/fusedWheelFit.js.map +0 -1
  206. package/dist/importer/gateStore.d.ts +0 -73
  207. package/dist/importer/gateStore.js +0 -102
  208. package/dist/importer/gateStore.js.map +0 -1
  209. package/dist/importer/glbNormalizer.d.ts +0 -22
  210. package/dist/importer/glbNormalizer.js +0 -177
  211. package/dist/importer/glbNormalizer.js.map +0 -1
  212. package/dist/importer/importerWebMcp.d.ts +0 -51
  213. package/dist/importer/importerWebMcp.js +0 -50
  214. package/dist/importer/importerWebMcp.js.map +0 -1
  215. package/dist/importer/importerWebMcpTools.d.ts +0 -2
  216. package/dist/importer/importerWebMcpTools.js +0 -368
  217. package/dist/importer/importerWebMcpTools.js.map +0 -1
  218. package/dist/importer/index.d.ts +0 -29
  219. package/dist/importer/index.js +0 -42
  220. package/dist/importer/index.js.map +0 -1
  221. package/dist/importer/khrCarGeometryMass.d.ts +0 -20
  222. package/dist/importer/khrCarGeometryMass.js +0 -131
  223. package/dist/importer/khrCarGeometryMass.js.map +0 -1
  224. package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
  225. package/dist/importer/khrCarPlanHelpers.js +0 -300
  226. package/dist/importer/khrCarPlanHelpers.js.map +0 -1
  227. package/dist/importer/khrCarPlanner.d.ts +0 -8
  228. package/dist/importer/khrCarPlanner.js +0 -289
  229. package/dist/importer/khrCarPlanner.js.map +0 -1
  230. package/dist/importer/khrCompiler.d.ts +0 -5
  231. package/dist/importer/khrCompiler.js +0 -87
  232. package/dist/importer/khrCompiler.js.map +0 -1
  233. package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
  234. package/dist/importer/khrCraftPropCompiler.js +0 -263
  235. package/dist/importer/khrCraftPropCompiler.js.map +0 -1
  236. package/dist/importer/khrNodeNameGuard.d.ts +0 -20
  237. package/dist/importer/khrNodeNameGuard.js +0 -139
  238. package/dist/importer/khrNodeNameGuard.js.map +0 -1
  239. package/dist/importer/launcherBake.d.ts +0 -15
  240. package/dist/importer/launcherBake.js +0 -117
  241. package/dist/importer/launcherBake.js.map +0 -1
  242. package/dist/importer/launcherCadGeometry.d.ts +0 -22
  243. package/dist/importer/launcherCadGeometry.js +0 -185
  244. package/dist/importer/launcherCadGeometry.js.map +0 -1
  245. package/dist/importer/meshIslands.d.ts +0 -17
  246. package/dist/importer/meshIslands.js +0 -102
  247. package/dist/importer/meshIslands.js.map +0 -1
  248. package/dist/importer/meshSliceBuffers.d.ts +0 -15
  249. package/dist/importer/meshSliceBuffers.js +0 -159
  250. package/dist/importer/meshSliceBuffers.js.map +0 -1
  251. package/dist/importer/polygonEarClipYZ.d.ts +0 -3
  252. package/dist/importer/polygonEarClipYZ.js +0 -67
  253. package/dist/importer/polygonEarClipYZ.js.map +0 -1
  254. package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
  255. package/dist/importer/proceduralC12AndCraft.js +0 -302
  256. package/dist/importer/proceduralC12AndCraft.js.map +0 -1
  257. package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
  258. package/dist/importer/proceduralDomainBuilders.js +0 -346
  259. package/dist/importer/proceduralDomainBuilders.js.map +0 -1
  260. package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
  261. package/dist/importer/proceduralPersonAndProp.js +0 -303
  262. package/dist/importer/proceduralPersonAndProp.js.map +0 -1
  263. package/dist/importer/sceneSiNormalize.d.ts +0 -19
  264. package/dist/importer/sceneSiNormalize.js +0 -145
  265. package/dist/importer/sceneSiNormalize.js.map +0 -1
  266. package/dist/importer/starterScene.d.ts +0 -5
  267. package/dist/importer/starterScene.js +0 -139
  268. package/dist/importer/starterScene.js.map +0 -1
  269. package/dist/importer/surfaceCutter.d.ts +0 -16
  270. package/dist/importer/surfaceCutter.js +0 -83
  271. package/dist/importer/surfaceCutter.js.map +0 -1
  272. package/dist/importer/surfaceGeodesic.d.ts +0 -7
  273. package/dist/importer/surfaceGeodesic.js +0 -130
  274. package/dist/importer/surfaceGeodesic.js.map +0 -1
  275. package/dist/importer/surfaceLoopRefine.d.ts +0 -6
  276. package/dist/importer/surfaceLoopRefine.js +0 -171
  277. package/dist/importer/surfaceLoopRefine.js.map +0 -1
  278. package/dist/importer/surfacePeel.d.ts +0 -11
  279. package/dist/importer/surfacePeel.js +0 -119
  280. package/dist/importer/surfacePeel.js.map +0 -1
  281. package/dist/importer/surfaceTopology.d.ts +0 -36
  282. package/dist/importer/surfaceTopology.js +0 -143
  283. package/dist/importer/surfaceTopology.js.map +0 -1
  284. package/dist/importer/universalGateBake.d.ts +0 -45
  285. package/dist/importer/universalGateBake.js +0 -203
  286. package/dist/importer/universalGateBake.js.map +0 -1
  287. package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
  288. package/dist/importer/usdPhysicsSpecs.js +0 -245
  289. package/dist/importer/usdPhysicsSpecs.js.map +0 -1
  290. package/dist/importer/usdTextParse.d.ts +0 -12
  291. package/dist/importer/usdTextParse.js +0 -118
  292. package/dist/importer/usdTextParse.js.map +0 -1
  293. package/dist/importer/usdToGlb.d.ts +0 -12
  294. package/dist/importer/usdToGlb.js +0 -94
  295. package/dist/importer/usdToGlb.js.map +0 -1
  296. package/dist/importer/useChopShopController.d.ts +0 -110
  297. package/dist/importer/useChopShopController.js +0 -219
  298. package/dist/importer/useChopShopController.js.map +0 -1
  299. package/dist/importer/useChopShopState.d.ts +0 -103
  300. package/dist/importer/useChopShopState.js +0 -350
  301. package/dist/importer/useChopShopState.js.map +0 -1
  302. package/dist/importer/useWasdKeyRef.d.ts +0 -9
  303. package/dist/importer/useWasdKeyRef.js +0 -35
  304. package/dist/importer/useWasdKeyRef.js.map +0 -1
  305. package/dist/importer/vehiclePartSplit.d.ts +0 -33
  306. package/dist/importer/vehiclePartSplit.js +0 -183
  307. package/dist/importer/vehiclePartSplit.js.map +0 -1
  308. package/dist/importer/wardrobeAutoFit.d.ts +0 -16
  309. package/dist/importer/wardrobeAutoFit.js +0 -410
  310. package/dist/importer/wardrobeAutoFit.js.map +0 -1
  311. package/dist/importer/wardrobeCatalog.d.ts +0 -16
  312. package/dist/importer/wardrobeCatalog.js +0 -409
  313. package/dist/importer/wardrobeCatalog.js.map +0 -1
  314. package/dist/importer/wardrobeController.d.ts +0 -49
  315. package/dist/importer/wardrobeController.js +0 -181
  316. package/dist/importer/wardrobeController.js.map +0 -1
  317. package/dist/importer/wardrobeFitter.d.ts +0 -27
  318. package/dist/importer/wardrobeFitter.js +0 -269
  319. package/dist/importer/wardrobeFitter.js.map +0 -1
  320. package/dist/importer/wardrobeWebMcpTools.d.ts +0 -2
  321. package/dist/importer/wardrobeWebMcpTools.js +0 -198
  322. package/dist/importer/wardrobeWebMcpTools.js.map +0 -1
  323. package/dist/importer/wheelAxlePairing.d.ts +0 -21
  324. package/dist/importer/wheelAxlePairing.js +0 -157
  325. package/dist/importer/wheelAxlePairing.js.map +0 -1
  326. package/dist/importer/wheelCutterHelpers.d.ts +0 -45
  327. package/dist/importer/wheelCutterHelpers.js +0 -208
  328. package/dist/importer/wheelCutterHelpers.js.map +0 -1
  329. package/dist/importer/wheelRingHandleMath.d.ts +0 -20
  330. package/dist/importer/wheelRingHandleMath.js +0 -66
  331. package/dist/importer/wheelRingHandleMath.js.map +0 -1
  332. package/dist/index.js.map +0 -1
  333. package/dist/junk/DestructibleTarget.d.ts +0 -18
  334. package/dist/junk/DestructibleTarget.js +0 -223
  335. package/dist/junk/DestructibleTarget.js.map +0 -1
  336. package/dist/junk/KolmoJunk.d.ts +0 -14
  337. package/dist/junk/KolmoJunk.js +0 -76
  338. package/dist/junk/KolmoJunk.js.map +0 -1
  339. package/dist/junk/ShardPieces.d.ts +0 -13
  340. package/dist/junk/ShardPieces.js +0 -101
  341. package/dist/junk/ShardPieces.js.map +0 -1
  342. package/dist/junk/TargetDecals.d.ts +0 -9
  343. package/dist/junk/TargetDecals.js +0 -77
  344. package/dist/junk/TargetDecals.js.map +0 -1
  345. package/dist/junk/bvhShatter.d.ts +0 -3
  346. package/dist/junk/bvhShatter.js +0 -101
  347. package/dist/junk/bvhShatter.js.map +0 -1
  348. package/dist/junk/bvhTriCollector.d.ts +0 -16
  349. package/dist/junk/bvhTriCollector.js +0 -127
  350. package/dist/junk/bvhTriCollector.js.map +0 -1
  351. package/dist/junk/index.d.ts +0 -14
  352. package/dist/junk/index.js +0 -13
  353. package/dist/junk/index.js.map +0 -1
  354. package/dist/junk/junkGeometry.d.ts +0 -13
  355. package/dist/junk/junkGeometry.js +0 -87
  356. package/dist/junk/junkGeometry.js.map +0 -1
  357. package/dist/junk/junkImportSanitize.d.ts +0 -5
  358. package/dist/junk/junkImportSanitize.js +0 -74
  359. package/dist/junk/junkImportSanitize.js.map +0 -1
  360. package/dist/junk/junkImporter.d.ts +0 -14
  361. package/dist/junk/junkImporter.js +0 -124
  362. package/dist/junk/junkImporter.js.map +0 -1
  363. package/dist/junk/junkLabelCanvas.d.ts +0 -2
  364. package/dist/junk/junkLabelCanvas.js +0 -185
  365. package/dist/junk/junkLabelCanvas.js.map +0 -1
  366. package/dist/junk/junkLabels.d.ts +0 -9
  367. package/dist/junk/junkLabels.js +0 -49
  368. package/dist/junk/junkLabels.js.map +0 -1
  369. package/dist/junk/junkProceduralScenes.d.ts +0 -12
  370. package/dist/junk/junkProceduralScenes.js +0 -220
  371. package/dist/junk/junkProceduralScenes.js.map +0 -1
  372. package/dist/junk/junkSheetSplitter.d.ts +0 -38
  373. package/dist/junk/junkSheetSplitter.js +0 -104
  374. package/dist/junk/junkSheetSplitter.js.map +0 -1
  375. package/dist/junk/junkTypes.d.ts +0 -48
  376. package/dist/junk/junkTypes.js +0 -0
  377. package/dist/junk/junkTypes.js.map +0 -1
  378. package/dist/junk/targetHelpers.d.ts +0 -55
  379. package/dist/junk/targetHelpers.js +0 -157
  380. package/dist/junk/targetHelpers.js.map +0 -1
  381. package/dist/junk/targetHitLogic.d.ts +0 -30
  382. package/dist/junk/targetHitLogic.js +0 -163
  383. package/dist/junk/targetHitLogic.js.map +0 -1
  384. package/dist/junk/useTargetAssets.d.ts +0 -19
  385. package/dist/junk/useTargetAssets.js +0 -130
  386. package/dist/junk/useTargetAssets.js.map +0 -1
  387. package/dist/physics/index.js.map +0 -1
  388. package/dist/physics/nBodyGravity.js +0 -70
  389. package/dist/physics/nBodyGravity.js.map +0 -1
  390. package/dist/sand3d/KolmoSand3D.d.ts +0 -19
  391. package/dist/sand3d/KolmoSand3D.js +0 -92
  392. package/dist/sand3d/KolmoSand3D.js.map +0 -1
  393. package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
  394. package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
  395. package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
  396. package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
  397. package/dist/sand3d/gateBakeHelpers.js +0 -225
  398. package/dist/sand3d/gateBakeHelpers.js.map +0 -1
  399. package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
  400. package/dist/sand3d/gateDoorwayBake.js +0 -203
  401. package/dist/sand3d/gateDoorwayBake.js.map +0 -1
  402. package/dist/sand3d/index.d.ts +0 -3
  403. package/dist/sand3d/index.js +0 -4
  404. package/dist/sand3d/index.js.map +0 -1
  405. package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
  406. package/dist/sand3d/sand3dAssetLoader.js +0 -177
  407. package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
  408. package/dist/schema/kolmoSchema.d.ts +0 -9
  409. package/dist/schema/kolmoSchema.js +0 -110
  410. package/dist/schema/kolmoSchema.js.map +0 -1
  411. package/dist/schema/kolmoStamp.d.ts +0 -11
  412. package/dist/schema/kolmoStamp.js +0 -119
  413. package/dist/schema/kolmoStamp.js.map +0 -1
  414. package/dist/schema/kolmoTypes.d.ts +0 -63
  415. package/dist/schema/kolmoTypes.js +0 -66
  416. package/dist/schema/kolmoTypes.js.map +0 -1
  417. package/dist/shaders/celestialBackdrop.d.ts +0 -14
  418. package/dist/shaders/celestialBackdrop.js +0 -181
  419. package/dist/shaders/celestialBackdrop.js.map +0 -1
  420. package/dist/shaders/emitterShaders.d.ts +0 -9
  421. package/dist/shaders/emitterShaders.js +0 -114
  422. package/dist/shaders/emitterShaders.js.map +0 -1
  423. package/dist/shaders/index.d.ts +0 -5
  424. package/dist/shaders/index.js +0 -12
  425. package/dist/shaders/index.js.map +0 -1
  426. package/dist/shaders/plumeAndSparkle.d.ts +0 -12
  427. package/dist/shaders/plumeAndSparkle.js +0 -233
  428. package/dist/shaders/plumeAndSparkle.js.map +0 -1
  429. package/dist/shaders/ps2GlslShared.d.ts +0 -20
  430. package/dist/shaders/ps2GlslShared.js +0 -30
  431. package/dist/shaders/ps2GlslShared.js.map +0 -1
  432. package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
  433. package/dist/shaders/ps2MaterialsTSL.js +0 -146
  434. package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
  435. package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
  436. package/dist/shaders/ps2MaterialsWebGL.js +0 -57
  437. package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
  438. package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
  439. package/dist/shaders/ps2RoadWebGL.js +0 -138
  440. package/dist/shaders/ps2RoadWebGL.js.map +0 -1
  441. package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
  442. package/dist/shaders/ps2TerrainWebGL.js +0 -131
  443. package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
  444. package/dist/shaders/ps2Textures.d.ts +0 -22
  445. package/dist/shaders/ps2Textures.js +0 -299
  446. package/dist/shaders/ps2Textures.js.map +0 -1
  447. package/dist/shaders/retroPalettes.d.ts +0 -24
  448. package/dist/shaders/retroPalettes.js +0 -221
  449. package/dist/shaders/retroPalettes.js.map +0 -1
  450. package/dist/shaders/retroShader.d.ts +0 -13
  451. package/dist/shaders/retroShader.js +0 -110
  452. package/dist/shaders/retroShader.js.map +0 -1
  453. package/dist/shaders/retroUniforms.d.ts +0 -60
  454. package/dist/shaders/retroUniforms.js +0 -215
  455. package/dist/shaders/retroUniforms.js.map +0 -1
  456. package/dist/shaders/skyboxShaders.d.ts +0 -16
  457. package/dist/shaders/skyboxShaders.js +0 -266
  458. package/dist/shaders/skyboxShaders.js.map +0 -1
  459. package/dist/shaders/tsl.d.ts +0 -1
  460. package/dist/shaders/tsl.js +0 -1
  461. package/dist/shaders/tsl.js.map +0 -1
  462. package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
  463. package/dist/suika/KolmoSuikaOrb.js +0 -375
  464. package/dist/suika/KolmoSuikaOrb.js.map +0 -1
  465. package/dist/suika/index.d.ts +0 -4
  466. package/dist/suika/index.js +0 -5
  467. package/dist/suika/index.js.map +0 -1
  468. package/dist/suika/suikaArbiter.d.ts +0 -60
  469. package/dist/suika/suikaArbiter.js +0 -265
  470. package/dist/suika/suikaArbiter.js.map +0 -1
  471. package/dist/suika/suikaGeometry.d.ts +0 -10
  472. package/dist/suika/suikaGeometry.js +0 -251
  473. package/dist/suika/suikaGeometry.js.map +0 -1
  474. package/dist/suika/suikaTypes.d.ts +0 -74
  475. package/dist/suika/suikaTypes.js +0 -196
  476. package/dist/suika/suikaTypes.js.map +0 -1
  477. package/dist/world/frontage.d.ts +0 -26
  478. package/dist/world/frontage.js +0 -36
  479. package/dist/world/frontage.js.map +0 -1
  480. package/dist/world/index.d.ts +0 -9
  481. package/dist/world/index.js +0 -12
  482. package/dist/world/index.js.map +0 -1
  483. package/dist/world/infiniteWorld2D.d.ts +0 -19
  484. package/dist/world/infiniteWorld2D.js +0 -219
  485. package/dist/world/infiniteWorld2D.js.map +0 -1
  486. package/dist/world/island.d.ts +0 -29
  487. package/dist/world/island.js +0 -116
  488. package/dist/world/island.js.map +0 -1
  489. package/dist/world/islandPathing.d.ts +0 -6
  490. package/dist/world/islandPathing.js +0 -166
  491. package/dist/world/islandPathing.js.map +0 -1
  492. package/dist/world/macroCellSchema.d.ts +0 -72
  493. package/dist/world/macroCellSchema.js +0 -34
  494. package/dist/world/macroCellSchema.js.map +0 -1
  495. package/dist/world/macroKnightAStar.d.ts +0 -11
  496. package/dist/world/macroKnightAStar.js +0 -240
  497. package/dist/world/macroKnightAStar.js.map +0 -1
  498. package/dist/world/macroSettlementZones.d.ts +0 -9
  499. package/dist/world/macroSettlementZones.js +0 -108
  500. package/dist/world/macroSettlementZones.js.map +0 -1
  501. package/dist/world/random.d.ts +0 -23
  502. package/dist/world/random.js +0 -59
  503. package/dist/world/random.js.map +0 -1
  504. package/dist/world/road.d.ts +0 -37
  505. package/dist/world/road.js +0 -198
  506. package/dist/world/road.js.map +0 -1
  507. package/dist/world/roadRibbon.d.ts +0 -29
  508. package/dist/world/roadRibbon.js +0 -166
  509. package/dist/world/roadRibbon.js.map +0 -1
  510. package/dist/world/terrain.d.ts +0 -62
  511. package/dist/world/terrain.js +0 -133
  512. package/dist/world/terrain.js.map +0 -1
  513. package/dist/world/terrainGeometry.d.ts +0 -14
  514. package/dist/world/terrainGeometry.js +0 -76
  515. package/dist/world/terrainGeometry.js.map +0 -1
  516. package/dist/world/worldTypes.d.ts +0 -43
  517. package/dist/world/worldTypes.js +0 -197
  518. package/dist/world/worldTypes.js.map +0 -1
  519. package/docs/api-reference.md +0 -728
  520. package/skills/kolmo-engine/SKILL.md +0 -109
package/bin/kolmo.mjs DELETED
@@ -1,561 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "node:fs";
3
- import path from "node:path";
4
-
5
- const kolmoPkg = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"));
6
-
7
- const args = process.argv.slice(2);
8
- const cmd = args[0];
9
- if (cmd !== "create" && cmd !== "init") {
10
- console.log("Usage: npx @pinkaphant/kolmo create <project-dir> [--template game|longline|dust|garage]");
11
- process.exit(cmd === "--help" || cmd === "-h" ? 0 : 1);
12
- }
13
-
14
- const dirArg = args[1] && !args[1].startsWith("-") ? args[1] : "my-kolmo-game";
15
- const tplIdx = args.indexOf("--template");
16
- const rawTpl = tplIdx !== -1 ? args[tplIdx + 1] : "game";
17
- const template = rawTpl === "dust" || rawTpl === "garage" || rawTpl === "longline" ? rawTpl : "game";
18
- const targetDir = path.resolve(process.cwd(), dirArg);
19
-
20
- const ALLOWED_BOOTSTRAP_FILES = new Set([".git", ".gitattributes", ".gitignore", "license", "license.md", "readme.md", ".ds_store"]);
21
- const existingBlocking = fs.existsSync(targetDir)
22
- ? fs.readdirSync(targetDir).filter((name) => !ALLOWED_BOOTSTRAP_FILES.has(name.toLowerCase()))
23
- : [];
24
- if (existingBlocking.length > 0) {
25
- console.error(`Error: Target directory "${targetDir}" already contains files. Choose a fresh directory path.`);
26
- process.exit(1);
27
- }
28
-
29
- fs.mkdirSync(path.join(targetDir, "src"), { recursive: true });
30
- const pkgName = path.basename(targetDir).toLowerCase().replace(/[^a-z0-9-_]/g, "-");
31
-
32
- fs.writeFileSync(path.join(targetDir, "package.json"), JSON.stringify({
33
- name: pkgName,
34
- version: "0.1.0",
35
- private: true,
36
- type: "module",
37
- scripts: {
38
- dev: "vite",
39
- typecheck: "tsc --noEmit",
40
- test: "node --import tsx --test \"src/**/*.test.ts*\"",
41
- build: "vite build",
42
- deploy: "npm run build && wrangler deploy",
43
- },
44
- dependencies: {
45
- "@dimforge/rapier3d-compat": "0.19.2",
46
- "@pinkaphant/ecctrl": kolmoPkg.peerDependencies["@pinkaphant/ecctrl"],
47
- "@pinkaphant/kolmo": `^${kolmoPkg.version}`,
48
- "@react-three/drei": "^10.7.7",
49
- "@react-three/fiber": "^9.6.1",
50
- "@react-three/rapier": "^2.2.0",
51
- "koota": "^0.6.5",
52
- "react": "^19.2.7",
53
- "react-dom": "^19.2.7",
54
- "three": "^0.184.0",
55
- "zustand": "^5.0.14",
56
- },
57
- overrides: {
58
- "@dimforge/rapier3d-compat": "0.19.2",
59
- "@pinkaphant/ecctrl": kolmoPkg.peerDependencies["@pinkaphant/ecctrl"],
60
- },
61
- devDependencies: {
62
- "@types/node": "^22.20.5",
63
- "@types/react": "^19.2.16",
64
- "@types/react-dom": "^19.2.3",
65
- "@types/three": "^0.184.0",
66
- "@vitejs/plugin-react": "^6.1.1",
67
- "tsx": "^4.23.15",
68
- "typescript": "^6.0.3",
69
- "vite": "^8.3.8",
70
- "wrangler": "^4.164.0",
71
- },
72
- }, null, 2));
73
-
74
- fs.writeFileSync(path.join(targetDir, "vite.config.ts"), `import react from "@vitejs/plugin-react";
75
- import { defineConfig } from "vite";
76
-
77
- export default defineConfig({
78
- plugins: [react()],
79
- });\n`);
80
-
81
- fs.writeFileSync(path.join(targetDir, "tsconfig.json"), JSON.stringify({
82
- compilerOptions: {
83
- target: "ES2022",
84
- module: "ESNext",
85
- moduleResolution: "Bundler",
86
- allowImportingTsExtensions: true,
87
- types: ["node"],
88
- jsx: "react-jsx",
89
- strict: true,
90
- skipLibCheck: true,
91
- noEmit: true,
92
- },
93
- include: ["src"],
94
- }, null, 2));
95
-
96
- fs.writeFileSync(path.join(targetDir, "wrangler.jsonc"), JSON.stringify({
97
- name: pkgName,
98
- compatibility_date: "2026-11-01",
99
- assets: { directory: "./dist", not_found_handling: "single-page-application" },
100
- }, null, 2));
101
-
102
- fs.writeFileSync(path.join(targetDir, "index.html"), `<!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"/><title>${pkgName}</title><style>html,body,#root{margin:0;width:100%;height:100dvh;overflow:hidden;background:#05070e;touch-action:none;user-select:none;-webkit-user-select:none}canvas{touch-action:none;display:block}</style></head><body><div id="root"></div><script type="module" src="/src/main.tsx"></script></body></html>\n`);
103
-
104
- const DUST_WORLD_SRC = `import { useEffect, useMemo, useRef, useState } from "react";
105
- import * as THREE from "three";
106
- import { useFrame, useThree } from "@react-three/fiber";
107
- import { CuboidCollider, RigidBody } from "@react-three/rapier";
108
- import { Junk, computeIslandSpawnPose, getCachedIslandPlan } from "@pinkaphant/kolmo";
109
-
110
- export interface BuiltWall { id: number; pos: [number, number, number]; yaw: number; tier: "wood" | "stone"; }
111
-
112
- const _fwd = new THREE.Vector3();
113
-
114
- export function DustGameplay({
115
- tool, yawStep, tier, onHarvest, walls, onPlaceWall,
116
- }: {
117
- tool: "harvest" | "build";
118
- yawStep: number;
119
- tier: "wood" | "stone";
120
- onHarvest: (kind: "wood" | "stone", amount: number) => void;
121
- walls: readonly BuiltWall[];
122
- onPlaceWall: (pos: [number, number, number], yaw: number) => void;
123
- }) {
124
- const camera = useThree((s) => s.camera);
125
- const plan = useMemo(() => getCachedIslandPlan(77, 960), []);
126
- const spawn = useMemo(() => computeIslandSpawnPose(77, 960), []);
127
- const ghostRef = useRef<THREE.Mesh | null>(null);
128
- const ghostPose = useRef<[number, number, number]>([spawn.actorPos[0], spawn.actorPos[1] + 1.5, spawn.actorPos[2] + 6]);
129
- const [depleted, setDepleted] = useState<Record<number, number>>({});
130
-
131
- const nodes = useMemo(() => {
132
- const list: { id: number; kind: "wood" | "stone"; pos: [number, number, number] }[] = [];
133
- for (let i = 0; i < 24; i++) {
134
- const ang = (i / 24) * Math.PI * 2, r = 10 + (i % 4) * 6;
135
- const x = spawn.actorPos[0] + Math.cos(ang) * r, z = spawn.actorPos[2] + Math.sin(ang) * r;
136
- const y = plan.terrain.height(x, z);
137
- list.push({ id: i + 1, kind: i % 3 === 0 ? "stone" : "wood", pos: [x, y, z] });
138
- }
139
- return list;
140
- }, [plan, spawn]);
141
-
142
- const yawRad = (yawStep * Math.PI) / 6;
143
-
144
- useFrame(() => {
145
- _fwd.set(0, 0, -1).applyQuaternion(camera.quaternion);
146
- const gx = Math.round((camera.position.x + _fwd.x * 5.5) / 3) * 3;
147
- const gz = Math.round((camera.position.z + _fwd.z * 5.5) / 3) * 3;
148
- const gy = plan.terrain.height(gx, gz) + 1.5;
149
- ghostPose.current[0] = gx;
150
- ghostPose.current[1] = gy;
151
- ghostPose.current[2] = gz;
152
- if (ghostRef.current) {
153
- ghostRef.current.position.set(gx, gy, gz);
154
- ghostRef.current.rotation.set(0, yawRad, 0);
155
- }
156
- });
157
-
158
- useEffect(() => {
159
- const act = () => {
160
- if (tool === "build") {
161
- onPlaceWall([...ghostPose.current], yawRad);
162
- return;
163
- }
164
- const now = Date.now();
165
- let best: (typeof nodes)[number] | null = null, bestD = 9.5;
166
- for (const n of nodes) {
167
- if ((depleted[n.id] ?? 0) > now) continue;
168
- const d = Math.hypot(n.pos[0] - camera.position.x, n.pos[1] + 1 - camera.position.y, n.pos[2] - camera.position.z);
169
- if (d < bestD) { bestD = d; best = n; }
170
- }
171
- if (best) {
172
- onHarvest(best.kind, best.kind === "wood" ? 25 : 20);
173
- setDepleted((prev) => ({ ...prev, [best!.id]: now + 8000 }));
174
- }
175
- };
176
- const onClick = (e: MouseEvent) => { if ((e.target as HTMLElement)?.tagName === "CANVAS") act(); };
177
- const onKey = (e: KeyboardEvent) => { if (e.code === "KeyE") act(); };
178
- window.addEventListener("pointerdown", onClick);
179
- window.addEventListener("keydown", onKey);
180
- return () => { window.removeEventListener("pointerdown", onClick); window.removeEventListener("keydown", onKey); };
181
- }, [tool, yawRad, nodes, depleted, camera, onHarvest, onPlaceWall]);
182
-
183
- const now = Date.now();
184
- return (
185
- <group>
186
- {nodes.map((n) => (depleted[n.id] ?? 0) > now ? null : (
187
- <RigidBody key={n.id} type="fixed" position={n.pos}>
188
- <CuboidCollider args={n.kind === "wood" ? [0.45, 1.8, 0.45] : [0.85, 0.65, 0.85]} position={[0, n.kind === "wood" ? 1.8 : 0.65, 0]} />
189
- {n.kind === "wood" ? (
190
- <group>
191
- <mesh position={[0, 1.1, 0]}><cylinderGeometry args={[0.22, 0.3, 2.2, 7]} /><meshStandardMaterial color="#5c3a21" flatShading /></mesh>
192
- <mesh position={[0, 2.9, 0]}><coneGeometry args={[1.35, 2.8, 7]} /><meshStandardMaterial color="#2d5a27" flatShading /></mesh>
193
- </group>
194
- ) : (
195
- <mesh position={[0, 0.65, 0]}><dodecahedronGeometry args={[0.95, 0]} /><meshStandardMaterial color="#64748b" flatShading /></mesh>
196
- )}
197
- </RigidBody>
198
- ))}
199
- <Junk id="dust_salvage_1" position={[spawn.actorPos[0] + 3, spawn.actorPos[1] + 1.2, spawn.actorPos[2] - 4]} />
200
- {tool === "build" && (
201
- <mesh ref={ghostRef}>
202
- <boxGeometry args={[3.0, 3.0, 0.28]} />
203
- <meshStandardMaterial color={tier === "wood" ? "#f59e0b" : "#38bdf8"} transparent opacity={0.42} depthWrite={false} />
204
- </mesh>
205
- )}
206
- {walls.map((w) => (
207
- <RigidBody key={w.id} type="fixed" position={w.pos} rotation={[0, w.yaw, 0]}>
208
- <CuboidCollider args={[1.5, 1.5, 0.14]} />
209
- <mesh castShadow receiveShadow>
210
- <boxGeometry args={[3.0, 3.0, 0.28]} />
211
- <meshStandardMaterial color={w.tier === "wood" ? "#8b5a2b" : "#475569"} flatShading />
212
- </mesh>
213
- </RigidBody>
214
- ))}
215
- </group>
216
- );
217
- }
218
- `;
219
-
220
- const DUST_APP_SRC = `import { useCallback, useEffect, useState } from "react";
221
- import { Actor, Game, Hud, Island, MobileTouchOverlay, RETRO_PS2_SHINOBI, Vehicle } from "@pinkaphant/kolmo";
222
- import { DustGameplay, type BuiltWall } from "./DustGameplay.tsx";
223
-
224
- export function App() {
225
- const [wood, setWood] = useState(45);
226
- const [stone, setStone] = useState(30);
227
- const [tool, setTool] = useState<"harvest" | "build">("harvest");
228
- const [tier, setTier] = useState<"wood" | "stone">("wood");
229
- const [yawStep, setYawStep] = useState(0);
230
- const [walls, setWalls] = useState<BuiltWall[]>([]);
231
-
232
- useEffect(() => {
233
- const onKey = (e: KeyboardEvent) => {
234
- if (e.code === "Digit1") setTool("harvest");
235
- else if (e.code === "Digit2") setTool("build");
236
- else if (e.code === "KeyQ") setYawStep((s) => (s + 11) % 12);
237
- else if (e.code === "KeyT") setTier((t) => (t === "wood" ? "stone" : "wood"));
238
- };
239
- window.addEventListener("keydown", onKey);
240
- return () => window.removeEventListener("keydown", onKey);
241
- }, []);
242
-
243
- const handleHarvest = useCallback((kind: "wood" | "stone", amt: number) => {
244
- if (kind === "wood") setWood((w) => w + amt);
245
- else setStone((s) => s + amt);
246
- }, []);
247
-
248
- const handlePlaceWall = useCallback((pos: [number, number, number], yaw: number) => {
249
- if (tier === "wood" && wood < 15) return;
250
- if (tier === "stone" && stone < 15) return;
251
- if (tier === "wood") setWood((w) => w - 15);
252
- else setStone((s) => s - 15);
253
- setWalls((prev) => [...prev, { id: prev.length + 1, pos, yaw, tier }]);
254
- }, [tier, wood, stone]);
255
-
256
- const tierLabel = tier === "wood" ? "Wood" : "Stone";
257
- return (
258
- <div style={{ position: "relative", width: "100vw", height: "100dvh", overflow: "hidden", touchAction: "none", userSelect: "none", WebkitUserSelect: "none" }}>
259
- <Game retro={RETRO_PS2_SHINOBI}>
260
- <Island seed={77} size={960} settlementTier="town" />
261
- <Vehicle />
262
- <Actor />
263
- <DustGameplay tool={tool} yawStep={yawStep} tier={tier} onHarvest={handleHarvest} walls={walls} onPlaceWall={handlePlaceWall} />
264
- <Hud />
265
- <MobileTouchOverlay />
266
- </Game>
267
- <div style={{ position: "fixed", top: "max(12px, env(safe-area-inset-top))", right: "max(12px, env(safe-area-inset-right))", zIndex: 40, padding: "8px 12px", background: "rgba(9,13,22,0.86)", border: "1px solid #f59e0b", borderRadius: 6, color: "#f8fafc", fontFamily: "ui-monospace, monospace", fontSize: 12 }}>
268
- <div style={{ fontWeight: 700, color: "#fbbf24", marginBottom: 4 }}>Kolmo Dust · C12 Survival</div>
269
- <div>Wood <b>{wood}</b> · Stone <b>{stone}</b> · Walls <b>{walls.length}</b></div>
270
- <div style={{ color: "#94a3b8", marginTop: 4 }}>[1] Harvest ({tool === "harvest" ? "active" : "idle"}) · [2] Build C12 ({tool === "build" ? tierLabel : "idle"}) · [Q] Rotate 30° · [T] Tier · [Click/E] Use</div>
271
- </div>
272
- </div>
273
- );
274
- }
275
- `;
276
-
277
- const LONGLINE_WORLD_SRC = `import { useEffect, useMemo, useRef, useState } from "react";
278
- import * as THREE from "three";
279
- import { useFrame, useThree } from "@react-three/fiber";
280
- import { CuboidCollider, RigidBody } from "@react-three/rapier";
281
- import {
282
- Junk,
283
- SuikaSystem,
284
- computeLongDriveMainlandSpawn,
285
- hashSeed,
286
- kolmoTelemetry,
287
- readFloatingOriginAnchorXZ,
288
- spawnSuikaOrb,
289
- useActiveKolmoWorld,
290
- } from "@pinkaphant/kolmo";
291
-
292
- export interface HighwayHudState { km: number; fuelL: number; targetKm: number; cash: number; stage: number; scrap: number; }
293
- export type BuildTier = "wood" | "stone" | "metal";
294
- export interface BuiltC12Wall { id: number; wx: number; y: number; wz: number; yaw: number; tier: BuildTier; }
295
- interface FuelCanItem { id: number; wx: number; wz: number; y: number; }
296
-
297
- const _mat4 = new THREE.Matrix4();
298
- const _quat = new THREE.Quaternion();
299
- const _pos = new THREE.Vector3();
300
- const _scale = new THREE.Vector3(1, 1, 1);
301
- const _up = new THREE.Vector3(0, 1, 0);
302
- const _fwd = new THREE.Vector3();
303
-
304
- function InstancedC12Walls({ walls, origin, tier, color }: {
305
- walls: readonly BuiltC12Wall[];
306
- origin: readonly [number, number];
307
- tier: BuildTier;
308
- color: string;
309
- }) {
310
- const ref = useRef<THREE.InstancedMesh>(null);
311
- const filtered = useMemo(() => walls.filter((w) => w.tier === tier), [walls, tier]);
312
- useEffect(() => {
313
- const mesh = ref.current;
314
- if (!mesh) return;
315
- filtered.forEach((w, i) => {
316
- _pos.set(w.wx - origin[0], w.y, w.wz - origin[1]);
317
- _quat.setFromAxisAngle(_up, w.yaw);
318
- _mat4.compose(_pos, _quat, _scale);
319
- mesh.setMatrixAt(i, _mat4);
320
- });
321
- mesh.count = filtered.length;
322
- mesh.instanceMatrix.needsUpdate = true;
323
- }, [filtered, origin]);
324
- if (filtered.length === 0) return null;
325
- return (
326
- <>
327
- <instancedMesh ref={ref} args={[undefined, undefined, Math.max(1, filtered.length)]} castShadow receiveShadow>
328
- <boxGeometry args={[3, 3, 0.28]} />
329
- <meshStandardMaterial color={color} flatShading />
330
- </instancedMesh>
331
- {filtered.map((w) => (
332
- <RigidBody key={w.id} type="fixed" position={[w.wx - origin[0], w.y, w.wz - origin[1]]} rotation={[0, w.yaw, 0]}>
333
- <CuboidCollider args={[1.5, 1.5, 0.14]} />
334
- </RigidBody>
335
- ))}
336
- </>
337
- );
338
- }
339
-
340
- export function LonglineGameplay({
341
- seed, origin, tool, yawStep, tier, walls, onPlaceWall, onSyncHud,
342
- }: {
343
- seed: string;
344
- origin: readonly [number, number];
345
- tool: "drive" | "build";
346
- yawStep: number;
347
- tier: BuildTier;
348
- walls: readonly BuiltC12Wall[];
349
- onPlaceWall: (wx: number, y: number, wz: number, yaw: number) => void;
350
- onSyncHud: (s: HighwayHudState) => void;
351
- }) {
352
- const world = useActiveKolmoWorld();
353
- const camera = useThree((s) => s.camera);
354
- const spawn = useMemo(() => computeLongDriveMainlandSpawn(hashSeed(seed), 1, 0), [seed]);
355
- const anchorBuf = useRef<[number, number]>([0, 0]);
356
- const prevWorld = useRef<[number, number] | null>(null);
357
- const ghostRef = useRef<THREE.Mesh>(null);
358
- const stats = useRef<HighwayHudState>({ km: 0, fuelL: 45, targetKm: 0.5, cash: 100, stage: 1, scrap: 60 });
359
- const lastUiPush = useRef(0);
360
-
361
- const initialCans = useMemo<FuelCanItem[]>(() =>
362
- [1, 2, 3, 4].map((i) => ({
363
- id: i,
364
- wx: spawn.vehiclePos[0] + Math.sin(spawn.vehicleRot[1]) * i * 85 + 2.4,
365
- wz: spawn.vehiclePos[2] + Math.cos(spawn.vehicleRot[1]) * i * 85,
366
- y: spawn.vehiclePos[1] + 0.35,
367
- })), [spawn]);
368
-
369
- const cansRef = useRef<FuelCanItem[]>(initialCans);
370
- const [cans, setCans] = useState<FuelCanItem[]>(initialCans);
371
- const nextCanId = useRef(5);
372
-
373
- useEffect(() => {
374
- const onDown = (e: MouseEvent) => {
375
- if (e.button !== 0 || (e.target as HTMLElement)?.tagName !== "CANVAS") return;
376
- const a = readFloatingOriginAnchorXZ(world, camera, anchorBuf.current);
377
- _fwd.set(0, 0, -1).applyQuaternion(camera.quaternion);
378
- if (tool === "build") {
379
- const wx = Math.round((origin[0] + a[0] + _fwd.x * 6) / 3) * 3;
380
- const wz = Math.round((origin[1] + a[1] + _fwd.z * 6) / 3) * 3;
381
- onPlaceWall(wx, camera.position.y + 0.4, wz, (yawStep * Math.PI) / 6);
382
- } else {
383
- spawnSuikaOrb({
384
- tier: 0,
385
- position: [a[0] + _fwd.x * 2.2, camera.position.y + 0.5, a[1] + _fwd.z * 2.2],
386
- velocity: [_fwd.x * 24, _fwd.y * 24 + 3, _fwd.z * 24],
387
- });
388
- }
389
- };
390
- window.addEventListener("mousedown", onDown);
391
- return () => window.removeEventListener("mousedown", onDown);
392
- }, [tool, yawStep, origin, world, camera, onPlaceWall]);
393
-
394
- useFrame((_, delta) => {
395
- const a = readFloatingOriginAnchorXZ(world, camera, anchorBuf.current);
396
- const wx = origin[0] + a[0], wz = origin[1] + a[1];
397
- if (ghostRef.current && tool === "build") {
398
- _fwd.set(0, 0, -1).applyQuaternion(camera.quaternion);
399
- const gx = Math.round((wx + _fwd.x * 6) / 3) * 3 - origin[0];
400
- const gz = Math.round((wz + _fwd.z * 6) / 3) * 3 - origin[1];
401
- ghostRef.current.position.set(gx, camera.position.y + 0.4, gz);
402
- ghostRef.current.rotation.set(0, (yawStep * Math.PI) / 6, 0);
403
- }
404
- const prevX = prevWorld.current?.[0] ?? wx;
405
- const prevZ = prevWorld.current?.[1] ?? wz - 1;
406
- if (prevWorld.current) {
407
- const stepM = Math.hypot(wx - prevX, wz - prevZ);
408
- if (stepM > 0.01 && stepM < 60) {
409
- stats.current.km += stepM / 1000;
410
- stats.current.fuelL = Math.max(0, stats.current.fuelL - stepM * (kolmoTelemetry.boost > 0 ? 0.018 : 0.009));
411
- }
412
- }
413
- prevWorld.current = [wx, wz];
414
-
415
- if (stats.current.km >= stats.current.targetKm) {
416
- stats.current.cash += 250 * stats.current.stage;
417
- stats.current.scrap += 40;
418
- stats.current.stage += 1;
419
- stats.current.targetKm = +(stats.current.targetKm + 0.75).toFixed(2);
420
- stats.current.fuelL = Math.min(60, stats.current.fuelL + 12);
421
- }
422
-
423
- let picked = false;
424
- for (let i = 0; i < cansRef.current.length; i++) {
425
- if (Math.hypot(cansRef.current[i].wx - wx, cansRef.current[i].wz - wz) < 5.2) {
426
- picked = true;
427
- break;
428
- }
429
- }
430
- if (picked) {
431
- const fwdX = wx - prevX, fwdZ = wz - prevZ;
432
- const len = Math.hypot(fwdX, fwdZ) || 1;
433
- const next = cansRef.current.filter((c) => {
434
- if (Math.hypot(c.wx - wx, c.wz - wz) < 5.2) {
435
- stats.current.fuelL = Math.min(60, stats.current.fuelL + 18);
436
- stats.current.cash += 50;
437
- stats.current.scrap += 15;
438
- return false;
439
- }
440
- return true;
441
- });
442
- next.push({ id: nextCanId.current++, wx: wx + (fwdX / len) * 220, wz: wz + (fwdZ / len) * 220, y: camera.position.y - 1.1 });
443
- cansRef.current = next;
444
- setCans(next);
445
- }
446
-
447
- lastUiPush.current += delta;
448
- if (lastUiPush.current >= 0.12) {
449
- lastUiPush.current = 0;
450
- onSyncHud({ ...stats.current });
451
- }
452
- });
453
-
454
- return (
455
- <group>
456
- <SuikaSystem />
457
- <Junk id="salvage_1" kind="tin-can" position={[spawn.vehiclePos[0] - origin[0] + 4, spawn.vehiclePos[1] + 0.5, spawn.vehiclePos[2] - origin[1] + 18]} />
458
- <Junk id="salvage_2" kind="glass-bottle" position={[spawn.vehiclePos[0] - origin[0] - 4, spawn.vehiclePos[1] + 0.5, spawn.vehiclePos[2] - origin[1] + 24]} />
459
- {tool === "build" && (
460
- <mesh ref={ghostRef}>
461
- <boxGeometry args={[3, 3, 0.28]} />
462
- <meshStandardMaterial color={tier === "wood" ? "#f59e0b" : tier === "stone" ? "#94a3b8" : "#38bdf8"} transparent opacity={0.42} depthWrite={false} />
463
- </mesh>
464
- )}
465
- <InstancedC12Walls walls={walls} origin={origin} tier="wood" color="#9a6324" />
466
- <InstancedC12Walls walls={walls} origin={origin} tier="stone" color="#64748b" />
467
- <InstancedC12Walls walls={walls} origin={origin} tier="metal" color="#334155" />
468
- {cans.map((c) => (
469
- <group key={c.id} position={[c.wx - origin[0], c.y, c.wz - origin[1]]}>
470
- <mesh castShadow>
471
- <boxGeometry args={[0.55, 0.75, 0.36]} />
472
- <meshStandardMaterial color="#ef4444" emissive="#7f1d1d" flatShading />
473
- </mesh>
474
- <mesh position={[0, 1.6, 0]}>
475
- <octahedronGeometry args={[0.35, 0]} />
476
- <meshStandardMaterial color="#fbbf24" emissive="#f59e0b" flatShading />
477
- </mesh>
478
- </group>
479
- ))}
480
- </group>
481
- );
482
- }
483
- `;
484
-
485
- const LONGLINE_APP_SRC = `import { useCallback, useEffect, useState } from "react";
486
- import { Actor, Game, Hud, LongDrive, MobileTouchOverlay, PAPER_SHELL_PRESETS, RETRO_DREAMCAST, Vehicle, generateSeed8, normalizeSeed8 } from "@pinkaphant/kolmo";
487
- import { LonglineGameplay, type BuildTier, type BuiltC12Wall, type HighwayHudState } from "./LonglineGameplay.tsx";
488
-
489
- export function App() {
490
- const [seed, setSeed] = useState<string>(() => generateSeed8());
491
- const [seedInput, setSeedInput] = useState<string>(seed);
492
- const [origin, setOrigin] = useState<[number, number]>([0, 0]);
493
- const [tool, setTool] = useState<"drive" | "build">("drive");
494
- const [tier, setTier] = useState<BuildTier>("wood");
495
- const [yawStep, setYawStep] = useState(0);
496
- const [walls, setWalls] = useState<BuiltC12Wall[]>([]);
497
- const [hud, setHud] = useState<HighwayHudState>({ km: 0, fuelL: 45, targetKm: 0.5, cash: 100, stage: 1, scrap: 60 });
498
-
499
- useEffect(() => {
500
- const onKey = (e: KeyboardEvent) => {
501
- if ((e.target as HTMLElement)?.tagName === "INPUT") return;
502
- if (e.code === "Digit1") setTool("drive");
503
- else if (e.code === "Digit2") setTool("build");
504
- else if (e.code === "KeyQ") setYawStep((s) => (s + 11) % 12);
505
- else if (e.code === "KeyT") setTier((t) => (t === "wood" ? "stone" : t === "stone" ? "metal" : "wood"));
506
- };
507
- window.addEventListener("keydown", onKey);
508
- return () => window.removeEventListener("keydown", onKey);
509
- }, []);
510
-
511
- const handlePlaceWall = useCallback((wx: number, y: number, wz: number, yaw: number) => {
512
- setWalls((prev) => [...prev, { id: prev.length + 1, wx, y, wz, yaw, tier }]);
513
- }, [tier]);
514
-
515
- const tierLabel = tier === "wood" ? "Wood" : tier === "stone" ? "Stone" : "Metal";
516
- return (
517
- <div style={{ position: "relative", width: "100vw", height: "100dvh", overflow: "hidden", touchAction: "none", userSelect: "none", WebkitUserSelect: "none" }}>
518
- <Game key={seed} retro={RETRO_DREAMCAST}>
519
- <LongDrive seed={seed} pureMainland onOriginRebase={(ox, oz) => setOrigin([ox, oz])} />
520
- <Vehicle preset={PAPER_SHELL_PRESETS.sedan_92} piloted />
521
- <Actor />
522
- <LonglineGameplay seed={seed} origin={origin} tool={tool} yawStep={yawStep} tier={tier} walls={walls} onPlaceWall={handlePlaceWall} onSyncHud={setHud} />
523
- <Hud />
524
- <MobileTouchOverlay />
525
- </Game>
526
- <div style={{ position: "fixed", top: "max(12px, env(safe-area-inset-top))", right: "max(12px, env(safe-area-inset-right))", zIndex: 40, padding: "8px 12px", background: "rgba(9,13,22,0.88)", border: "1px solid #38bdf8", borderRadius: 6, color: "#f8fafc", fontFamily: "ui-monospace, monospace", fontSize: 12 }}>
527
- <div style={{ display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }}>
528
- <b style={{ color: "#38bdf8" }}>Kolmo Longline · Stage {hud.stage} · Blind</b>
529
- <input
530
- value={seedInput}
531
- maxLength={8}
532
- onChange={(e) => setSeedInput(e.target.value.toUpperCase().replace(/0/g, "O").replace(/[^1-9A-Z]/g, ""))}
533
- style={{ width: 82, background: "#0f172a", color: "#38bdf8", border: "1px solid #334155", borderRadius: 4, padding: "2px 6px", fontFamily: "inherit", fontWeight: 700 }}
534
- />
535
- <button type="button" onClick={() => { const s = normalizeSeed8(seedInput); setSeedInput(s); setSeed(s); setWalls([]); }} style={{ cursor: "pointer", background: "#1e293b", color: "#e2e8f0", border: "1px solid #475569", borderRadius: 4, padding: "2px 6px" }}>Load</button>
536
- <button type="button" onClick={() => { const s = generateSeed8(); setSeedInput(s); setSeed(s); setWalls([]); }} style={{ cursor: "pointer", background: "#0369a1", color: "#fff", border: "1px solid #0284c7", borderRadius: 4, padding: "2px 6px" }}>New seed</button>
537
- </div>
538
- <div>Odometer <b>{hud.km.toFixed(2)}/{hud.targetKm.toFixed(2)} km</b> · Fuel <b style={{ color: hud.fuelL < 10 ? "#f87171" : "#34d399" }}>{hud.fuelL.toFixed(1)} L</b> · Scrap <b>{hud.scrap}</b> · C12 walls <b>{walls.length}</b></div>
539
- <div style={{ color: "#94a3b8", marginTop: 4 }}>[1] Drive/Orb ({tool === "drive" ? "active" : "idle"}) · [2] C12 build ({tool === "build" ? tierLabel : "idle"}) · [Q] 30° snap · [T] Tier · Click to place/launch</div>
540
- </div>
541
- </div>
542
- );
543
- }
544
- `;
545
-
546
- if (template === "dust") {
547
- fs.writeFileSync(path.join(targetDir, "src/DustGameplay.tsx"), DUST_WORLD_SRC);
548
- fs.writeFileSync(path.join(targetDir, "src/App.tsx"), DUST_APP_SRC);
549
- } else if (template === "longline") {
550
- fs.writeFileSync(path.join(targetDir, "src/LonglineGameplay.tsx"), LONGLINE_WORLD_SRC);
551
- fs.writeFileSync(path.join(targetDir, "src/App.tsx"), LONGLINE_APP_SRC);
552
- } else if (template === "garage") {
553
- fs.writeFileSync(path.join(targetDir, "src/App.tsx"), `import { GlbImportGate } from "@pinkaphant/kolmo/importer";\nexport function App() {\n return <GlbImportGate />;\n}\n`);
554
- } else {
555
- fs.writeFileSync(path.join(targetDir, "src/App.tsx"), `import { Actor, Game, Hud, Island, MobileTouchOverlay, Vehicle } from "@pinkaphant/kolmo";\nexport function App() {\n return (\n <Game>\n <Island />\n <Vehicle piloted />\n <Actor />\n <Hud />\n <MobileTouchOverlay />\n </Game>\n );\n}\n`);
556
- }
557
-
558
- fs.writeFileSync(path.join(targetDir, "src/main.tsx"), `import { createRoot } from "react-dom/client";\nimport { App } from "./App.tsx";\ncreateRoot(document.getElementById("root")!).render(<App />);\n`);
559
- fs.writeFileSync(path.join(targetDir, "src/App.test.ts"), `import assert from "node:assert/strict";\nimport { describe, it } from "node:test";\nimport { App } from "./App.tsx";\n\ndescribe("${pkgName} smoke test", () => {\n it("exports App component", () => {\n assert.equal(typeof App, "function");\n });\n});\n`);
560
-
561
- console.log(`Scaffolded ${template} project in ${targetDir}\nNext: cd ${dirArg} && npm install && npm run dev`);
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import * as THREE from "three";
3
- import { InfiniteLongDrivePlanner } from "../world/infiniteWorld2D.js";
4
- import { type IslandSpawnPose } from "./kolmoIsland.js";
5
- export declare function computeLongDriveBridgeheadSpawn(seed?: number, islandSize?: number): IslandSpawnPose;
6
- export declare function computeLongDriveMainlandSpawn(seed?: number, mx?: number, mz?: number): IslandSpawnPose;
7
- export declare function CausewayBridge({ seed, islandSize, planner, roadMat, offX, offZ, }: {
8
- seed: number;
9
- islandSize: number;
10
- planner: InfiniteLongDrivePlanner;
11
- roadMat: THREE.Material;
12
- offX: number;
13
- offZ: number;
14
- }): React.JSX.Element;