@pinkaphant/kolmo 0.4.6 → 0.5.0

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