@pinkaphant/kolmo 0.3.0 → 0.4.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 (397) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -36
  3. package/bin/kolmo.mjs +11 -8
  4. package/dist/engine/causewayBridge.d.ts +14 -0
  5. package/dist/engine/causewayBridge.js +166 -0
  6. package/dist/engine/causewayBridge.js.map +1 -0
  7. package/dist/engine/index.d.ts +6 -4
  8. package/dist/engine/index.js +19 -12
  9. package/dist/engine/index.js.map +1 -0
  10. package/dist/engine/islandSettlementMesh.d.ts +26 -0
  11. package/dist/engine/islandSettlementMesh.js +166 -0
  12. package/dist/engine/islandSettlementMesh.js.map +1 -0
  13. package/dist/engine/kolmoActions.d.ts +23 -0
  14. package/dist/engine/kolmoActions.js +164 -0
  15. package/dist/engine/kolmoActions.js.map +1 -0
  16. package/dist/engine/kolmoActor.js +241 -206
  17. package/dist/engine/kolmoActor.js.map +1 -0
  18. package/dist/engine/kolmoFloatingOrigin.d.ts +17 -0
  19. package/dist/engine/kolmoFloatingOrigin.js +98 -0
  20. package/dist/engine/kolmoFloatingOrigin.js.map +1 -0
  21. package/dist/engine/kolmoGame.d.ts +27 -0
  22. package/dist/engine/kolmoGame.js +80 -0
  23. package/dist/engine/kolmoGame.js.map +1 -0
  24. package/dist/engine/kolmoHud.d.ts +23 -0
  25. package/dist/engine/kolmoHud.js +195 -0
  26. package/dist/engine/kolmoHud.js.map +1 -0
  27. package/dist/engine/kolmoInput.d.ts +1 -1
  28. package/dist/engine/kolmoInput.js +57 -30
  29. package/dist/engine/kolmoInput.js.map +1 -0
  30. package/dist/engine/kolmoIsland.d.ts +5 -10
  31. package/dist/engine/kolmoIsland.js +182 -250
  32. package/dist/engine/kolmoIsland.js.map +1 -0
  33. package/dist/engine/kolmoLongDrive.d.ts +3 -4
  34. package/dist/engine/kolmoLongDrive.js +139 -249
  35. package/dist/engine/kolmoLongDrive.js.map +1 -0
  36. package/dist/engine/kolmoPilotMesh.d.ts +2 -0
  37. package/dist/engine/kolmoPilotMesh.js +64 -0
  38. package/dist/engine/kolmoPilotMesh.js.map +1 -0
  39. package/dist/engine/kolmoProcedural.d.ts +13 -0
  40. package/dist/engine/kolmoProcedural.js +101 -0
  41. package/dist/engine/kolmoProcedural.js.map +1 -0
  42. package/dist/engine/kolmoRigs.d.ts +1 -1
  43. package/dist/engine/kolmoRigs.js +88 -47
  44. package/dist/engine/kolmoRigs.js.map +1 -0
  45. package/dist/engine/kolmoStore.d.ts +3 -101
  46. package/dist/engine/kolmoSurface.d.ts +2 -2
  47. package/dist/engine/kolmoSurface.js +150 -134
  48. package/dist/engine/kolmoSurface.js.map +1 -0
  49. package/dist/engine/kolmoTraits.d.ts +128 -0
  50. package/dist/engine/kolmoTraits.js +140 -0
  51. package/dist/engine/kolmoTraits.js.map +1 -0
  52. package/dist/engine/kolmoVehicle.d.ts +3 -33
  53. package/dist/engine/kolmoVehicle.js +66 -253
  54. package/dist/engine/kolmoVehicle.js.map +1 -0
  55. package/dist/engine/kolmoVehicleConfig.d.ts +54 -0
  56. package/dist/engine/kolmoVehicleConfig.js +80 -0
  57. package/dist/engine/kolmoVehicleConfig.js.map +1 -0
  58. package/dist/engine/kolmoVehicleDriver.d.ts +8 -13
  59. package/dist/engine/kolmoVehicleDriver.js +125 -42
  60. package/dist/engine/kolmoVehicleDriver.js.map +1 -0
  61. package/dist/engine/kolmoVehicleInner.d.ts +7 -0
  62. package/dist/engine/kolmoVehicleInner.js +261 -0
  63. package/dist/engine/kolmoVehicleInner.js.map +1 -0
  64. package/dist/engine/kolmoWorld.d.ts +6 -4
  65. package/dist/engine/kolmoWorld.js +134 -136
  66. package/dist/engine/kolmoWorld.js.map +1 -0
  67. package/dist/engine/longDriveKit.d.ts +5 -12
  68. package/dist/engine/longDriveKit.js +121 -233
  69. package/dist/engine/longDriveKit.js.map +1 -0
  70. package/dist/engine/longDriveRoadside.d.ts +16 -0
  71. package/dist/engine/longDriveRoadside.js +171 -0
  72. package/dist/engine/longDriveRoadside.js.map +1 -0
  73. package/dist/engine/macroCellBuilder.d.ts +34 -0
  74. package/dist/engine/macroCellBuilder.js +145 -0
  75. package/dist/engine/macroCellBuilder.js.map +1 -0
  76. package/dist/engine/mainlandMacroCell.d.ts +2 -2
  77. package/dist/engine/mainlandMacroCell.js +77 -165
  78. package/dist/engine/mainlandMacroCell.js.map +1 -0
  79. package/dist/engine/shiftedFixedBody.d.ts +1 -1
  80. package/dist/engine/shiftedFixedBody.js +55 -28
  81. package/dist/engine/shiftedFixedBody.js.map +1 -0
  82. package/dist/importer/ChopShopPanel.d.ts +10 -32
  83. package/dist/importer/ChopShopPanel.js +320 -470
  84. package/dist/importer/ChopShopPanel.js.map +1 -0
  85. package/dist/importer/DomainWorkshopPanel.d.ts +2 -1
  86. package/dist/importer/DomainWorkshopPanel.js +172 -242
  87. package/dist/importer/DomainWorkshopPanel.js.map +1 -0
  88. package/dist/importer/GateHudBar.d.ts +8 -3
  89. package/dist/importer/GateHudBar.js +289 -284
  90. package/dist/importer/GateHudBar.js.map +1 -0
  91. package/dist/importer/GlbImportGate.d.ts +2 -1
  92. package/dist/importer/GlbImportGate.js +254 -262
  93. package/dist/importer/GlbImportGate.js.map +1 -0
  94. package/dist/importer/ImperativeVehicleRig.d.ts +2 -2
  95. package/dist/importer/ImperativeVehicleRig.js +223 -284
  96. package/dist/importer/ImperativeVehicleRig.js.map +1 -0
  97. package/dist/importer/LiveDrivePads.d.ts +20 -0
  98. package/dist/importer/LiveDrivePads.js +169 -0
  99. package/dist/importer/LiveDrivePads.js.map +1 -0
  100. package/dist/importer/PaperShellDebrisRig.d.ts +25 -0
  101. package/dist/importer/PaperShellDebrisRig.js +143 -0
  102. package/dist/importer/PaperShellDebrisRig.js.map +1 -0
  103. package/dist/importer/R2VaultDrawer.d.ts +12 -0
  104. package/dist/importer/R2VaultDrawer.js +90 -0
  105. package/dist/importer/R2VaultDrawer.js.map +1 -0
  106. package/dist/importer/Step1CalibrationPlinth.d.ts +23 -15
  107. package/dist/importer/Step1CalibrationPlinth.js +180 -313
  108. package/dist/importer/Step1CalibrationPlinth.js.map +1 -0
  109. package/dist/importer/Step1ExplodedIslands.d.ts +31 -0
  110. package/dist/importer/Step1ExplodedIslands.js +144 -0
  111. package/dist/importer/Step1ExplodedIslands.js.map +1 -0
  112. package/dist/importer/Step2UniversalPad.d.ts +7 -14
  113. package/dist/importer/Step2UniversalPad.js +54 -197
  114. package/dist/importer/Step2UniversalPad.js.map +1 -0
  115. package/dist/importer/VfxEmitterPool.js +59 -86
  116. package/dist/importer/VfxEmitterPool.js.map +1 -0
  117. package/dist/importer/WheelRingHandles3D.d.ts +11 -0
  118. package/dist/importer/WheelRingHandles3D.js +318 -0
  119. package/dist/importer/WheelRingHandles3D.js.map +1 -0
  120. package/dist/importer/archLinerGeom.d.ts +2 -0
  121. package/dist/importer/archLinerGeom.js +51 -0
  122. package/dist/importer/archLinerGeom.js.map +1 -0
  123. package/dist/importer/{vehiclePanelAnim.d.ts → chopHingeHelpers.d.ts} +0 -10
  124. package/dist/importer/chopHingeHelpers.js +193 -0
  125. package/dist/importer/chopHingeHelpers.js.map +1 -0
  126. package/dist/importer/chopShopActions.d.ts +20 -32
  127. package/dist/importer/chopShopActions.js +142 -238
  128. package/dist/importer/chopShopActions.js.map +1 -0
  129. package/dist/importer/chopShopHandlers.d.ts +26 -0
  130. package/dist/importer/chopShopHandlers.js +276 -0
  131. package/dist/importer/chopShopHandlers.js.map +1 -0
  132. package/dist/importer/chopShopIoActions.d.ts +18 -0
  133. package/dist/importer/chopShopIoActions.js +161 -0
  134. package/dist/importer/chopShopIoActions.js.map +1 -0
  135. package/dist/importer/chopShopMcpAction.d.ts +18 -0
  136. package/dist/importer/chopShopMcpAction.js +58 -0
  137. package/dist/importer/chopShopMcpAction.js.map +1 -0
  138. package/dist/importer/cylinderBooleanSlice.d.ts +14 -0
  139. package/dist/importer/cylinderBooleanSlice.js +110 -0
  140. package/dist/importer/cylinderBooleanSlice.js.map +1 -0
  141. package/dist/importer/cylinderSliceMath.d.ts +14 -0
  142. package/dist/importer/cylinderSliceMath.js +251 -0
  143. package/dist/importer/cylinderSliceMath.js.map +1 -0
  144. package/dist/importer/fusedWheelDetect.d.ts +4 -0
  145. package/dist/importer/fusedWheelDetect.js +176 -0
  146. package/dist/importer/fusedWheelDetect.js.map +1 -0
  147. package/dist/importer/fusedWheelFit.d.ts +13 -0
  148. package/dist/importer/fusedWheelFit.js +138 -0
  149. package/dist/importer/fusedWheelFit.js.map +1 -0
  150. package/dist/importer/gateStore.d.ts +3 -6
  151. package/dist/importer/gateStore.js +36 -30
  152. package/dist/importer/gateStore.js.map +1 -0
  153. package/dist/importer/glbNormalizer.d.ts +1 -10
  154. package/dist/importer/glbNormalizer.js +120 -146
  155. package/dist/importer/glbNormalizer.js.map +1 -0
  156. package/dist/importer/importerWebMcp.d.ts +4 -3
  157. package/dist/importer/importerWebMcp.js +41 -339
  158. package/dist/importer/importerWebMcp.js.map +1 -0
  159. package/dist/importer/importerWebMcpTools.d.ts +2 -0
  160. package/dist/importer/importerWebMcpTools.js +340 -0
  161. package/dist/importer/importerWebMcpTools.js.map +1 -0
  162. package/dist/importer/index.d.ts +6 -4
  163. package/dist/importer/index.js +32 -25
  164. package/dist/importer/index.js.map +1 -0
  165. package/dist/importer/khrCarPlanHelpers.d.ts +39 -0
  166. package/dist/importer/khrCarPlanHelpers.js +310 -0
  167. package/dist/importer/khrCarPlanHelpers.js.map +1 -0
  168. package/dist/importer/khrCarPlanner.d.ts +8 -0
  169. package/dist/importer/khrCarPlanner.js +315 -0
  170. package/dist/importer/khrCarPlanner.js.map +1 -0
  171. package/dist/importer/khrCompiler.d.ts +4 -41
  172. package/dist/importer/khrCompiler.js +79 -673
  173. package/dist/importer/khrCompiler.js.map +1 -0
  174. package/dist/importer/khrCraftPropCompiler.d.ts +45 -0
  175. package/dist/importer/khrCraftPropCompiler.js +263 -0
  176. package/dist/importer/khrCraftPropCompiler.js.map +1 -0
  177. package/dist/importer/khrNodeNameGuard.d.ts +20 -0
  178. package/dist/importer/khrNodeNameGuard.js +139 -0
  179. package/dist/importer/khrNodeNameGuard.js.map +1 -0
  180. package/dist/importer/launcherBake.js +99 -39
  181. package/dist/importer/launcherBake.js.map +1 -0
  182. package/dist/importer/meshIslands.d.ts +4 -50
  183. package/dist/importer/meshIslands.js +84 -288
  184. package/dist/importer/meshIslands.js.map +1 -0
  185. package/dist/importer/meshSliceBuffers.d.ts +15 -0
  186. package/dist/importer/meshSliceBuffers.js +159 -0
  187. package/dist/importer/meshSliceBuffers.js.map +1 -0
  188. package/dist/importer/polygonEarClipYZ.d.ts +3 -0
  189. package/dist/importer/polygonEarClipYZ.js +67 -0
  190. package/dist/importer/polygonEarClipYZ.js.map +1 -0
  191. package/dist/importer/sceneSiNormalize.d.ts +19 -0
  192. package/dist/importer/sceneSiNormalize.js +145 -0
  193. package/dist/importer/sceneSiNormalize.js.map +1 -0
  194. package/dist/importer/starterScene.d.ts +3 -0
  195. package/dist/importer/starterScene.js +76 -0
  196. package/dist/importer/starterScene.js.map +1 -0
  197. package/dist/importer/surfaceCutter.d.ts +5 -25
  198. package/dist/importer/surfaceCutter.js +70 -334
  199. package/dist/importer/surfaceCutter.js.map +1 -0
  200. package/dist/importer/surfaceGeodesic.d.ts +7 -0
  201. package/dist/importer/surfaceGeodesic.js +130 -0
  202. package/dist/importer/surfaceGeodesic.js.map +1 -0
  203. package/dist/importer/surfaceLoopRefine.d.ts +6 -0
  204. package/dist/importer/surfaceLoopRefine.js +171 -0
  205. package/dist/importer/surfaceLoopRefine.js.map +1 -0
  206. package/dist/importer/surfacePeel.d.ts +11 -0
  207. package/dist/importer/surfacePeel.js +119 -0
  208. package/dist/importer/surfacePeel.js.map +1 -0
  209. package/dist/importer/surfaceTopology.d.ts +4 -19
  210. package/dist/importer/surfaceTopology.js +92 -160
  211. package/dist/importer/surfaceTopology.js.map +1 -0
  212. package/dist/importer/universalGateBake.d.ts +7 -9
  213. package/dist/importer/universalGateBake.js +117 -109
  214. package/dist/importer/universalGateBake.js.map +1 -0
  215. package/dist/importer/usdPhysicsSpecs.d.ts +3 -0
  216. package/dist/importer/usdPhysicsSpecs.js +245 -0
  217. package/dist/importer/usdPhysicsSpecs.js.map +1 -0
  218. package/dist/importer/usdTextParse.d.ts +12 -0
  219. package/dist/importer/usdTextParse.js +118 -0
  220. package/dist/importer/usdTextParse.js.map +1 -0
  221. package/dist/importer/usdToGlb.d.ts +3 -2
  222. package/dist/importer/usdToGlb.js +80 -292
  223. package/dist/importer/usdToGlb.js.map +1 -0
  224. package/dist/importer/useChopShopController.d.ts +51 -74
  225. package/dist/importer/useChopShopController.js +161 -453
  226. package/dist/importer/useChopShopController.js.map +1 -0
  227. package/dist/importer/useChopShopState.d.ts +103 -0
  228. package/dist/importer/useChopShopState.js +324 -0
  229. package/dist/importer/useChopShopState.js.map +1 -0
  230. package/dist/importer/useWasdKeyRef.d.ts +9 -0
  231. package/dist/importer/useWasdKeyRef.js +35 -0
  232. package/dist/importer/useWasdKeyRef.js.map +1 -0
  233. package/dist/importer/vehiclePartSplit.d.ts +33 -0
  234. package/dist/importer/vehiclePartSplit.js +183 -0
  235. package/dist/importer/vehiclePartSplit.js.map +1 -0
  236. package/dist/importer/wheelAxlePairing.d.ts +4 -3
  237. package/dist/importer/wheelAxlePairing.js +128 -122
  238. package/dist/importer/wheelAxlePairing.js.map +1 -0
  239. package/dist/importer/wheelCutterHelpers.d.ts +42 -0
  240. package/dist/importer/wheelCutterHelpers.js +178 -0
  241. package/dist/importer/wheelCutterHelpers.js.map +1 -0
  242. package/dist/importer/wheelRingHandleMath.d.ts +20 -0
  243. package/dist/importer/wheelRingHandleMath.js +66 -0
  244. package/dist/importer/wheelRingHandleMath.js.map +1 -0
  245. package/dist/index.d.ts +3 -2
  246. package/dist/index.js +90 -69
  247. package/dist/index.js.map +1 -0
  248. package/dist/junk/DestructibleTarget.d.ts +3 -3
  249. package/dist/junk/DestructibleTarget.js +177 -114
  250. package/dist/junk/DestructibleTarget.js.map +1 -0
  251. package/dist/junk/KolmoJunk.js +55 -44
  252. package/dist/junk/KolmoJunk.js.map +1 -0
  253. package/dist/junk/ShardPieces.d.ts +2 -1
  254. package/dist/junk/ShardPieces.js +80 -61
  255. package/dist/junk/ShardPieces.js.map +1 -0
  256. package/dist/junk/TargetDecals.d.ts +6 -15
  257. package/dist/junk/TargetDecals.js +66 -40
  258. package/dist/junk/TargetDecals.js.map +1 -0
  259. package/dist/junk/bvhShatter.d.ts +2 -6
  260. package/dist/junk/bvhShatter.js +89 -43
  261. package/dist/junk/bvhShatter.js.map +1 -0
  262. package/dist/junk/bvhTriCollector.d.ts +2 -6
  263. package/dist/junk/bvhTriCollector.js +111 -62
  264. package/dist/junk/bvhTriCollector.js.map +1 -0
  265. package/dist/junk/index.d.ts +2 -2
  266. package/dist/junk/index.js +11 -11
  267. package/dist/junk/index.js.map +1 -0
  268. package/dist/junk/junkGeometry.d.ts +5 -26
  269. package/dist/junk/junkGeometry.js +61 -43
  270. package/dist/junk/junkGeometry.js.map +1 -0
  271. package/dist/junk/junkImportSanitize.d.ts +4 -5
  272. package/dist/junk/junkImportSanitize.js +57 -37
  273. package/dist/junk/junkImportSanitize.js.map +1 -0
  274. package/dist/junk/junkImporter.d.ts +2 -13
  275. package/dist/junk/junkImporter.js +105 -76
  276. package/dist/junk/junkImporter.js.map +1 -0
  277. package/dist/junk/junkLabelCanvas.d.ts +1 -6
  278. package/dist/junk/junkLabelCanvas.js +147 -29
  279. package/dist/junk/junkLabelCanvas.js.map +1 -0
  280. package/dist/junk/junkLabels.d.ts +4 -26
  281. package/dist/junk/junkLabels.js +42 -28
  282. package/dist/junk/junkLabels.js.map +1 -0
  283. package/dist/junk/targetHelpers.d.ts +3 -4
  284. package/dist/junk/targetHelpers.js +121 -67
  285. package/dist/junk/targetHelpers.js.map +1 -0
  286. package/dist/junk/targetHitLogic.d.ts +8 -8
  287. package/dist/junk/targetHitLogic.js +131 -95
  288. package/dist/junk/targetHitLogic.js.map +1 -0
  289. package/dist/junk/useTargetAssets.d.ts +9 -14
  290. package/dist/junk/useTargetAssets.js +113 -85
  291. package/dist/junk/useTargetAssets.js.map +1 -0
  292. package/dist/physics/index.d.ts +1 -8
  293. package/dist/physics/index.js +80 -85
  294. package/dist/physics/index.js.map +1 -0
  295. package/dist/schema/kolmoSchema.d.ts +3 -64
  296. package/dist/schema/kolmoSchema.js +75 -149
  297. package/dist/schema/kolmoSchema.js.map +1 -0
  298. package/dist/schema/kolmoStamp.d.ts +11 -0
  299. package/dist/schema/kolmoStamp.js +119 -0
  300. package/dist/schema/kolmoStamp.js.map +1 -0
  301. package/dist/schema/kolmoTypes.d.ts +63 -0
  302. package/dist/schema/kolmoTypes.js +66 -0
  303. package/dist/schema/kolmoTypes.js.map +1 -0
  304. package/dist/shaders/celestialBackdrop.d.ts +2 -10
  305. package/dist/shaders/celestialBackdrop.js +128 -291
  306. package/dist/shaders/celestialBackdrop.js.map +1 -0
  307. package/dist/shaders/emitterShaders.d.ts +9 -0
  308. package/dist/shaders/emitterShaders.js +114 -0
  309. package/dist/shaders/emitterShaders.js.map +1 -0
  310. package/dist/shaders/index.d.ts +1 -1
  311. package/dist/shaders/index.js +12 -9
  312. package/dist/shaders/index.js.map +1 -0
  313. package/dist/shaders/plumeAndSparkle.d.ts +2 -4
  314. package/dist/shaders/plumeAndSparkle.js +152 -191
  315. package/dist/shaders/plumeAndSparkle.js.map +1 -0
  316. package/dist/shaders/ps2GlslShared.js +29 -2
  317. package/dist/shaders/ps2GlslShared.js.map +1 -0
  318. package/dist/shaders/ps2MaterialsTSL.js +132 -51
  319. package/dist/shaders/ps2MaterialsTSL.js.map +1 -0
  320. package/dist/shaders/ps2MaterialsWebGL.js +45 -28
  321. package/dist/shaders/ps2MaterialsWebGL.js.map +1 -0
  322. package/dist/shaders/ps2RoadWebGL.js +69 -32
  323. package/dist/shaders/ps2RoadWebGL.js.map +1 -0
  324. package/dist/shaders/ps2TerrainWebGL.js +107 -30
  325. package/dist/shaders/ps2TerrainWebGL.js.map +1 -0
  326. package/dist/shaders/ps2Textures.d.ts +1 -1
  327. package/dist/shaders/ps2Textures.js +116 -41
  328. package/dist/shaders/ps2Textures.js.map +1 -0
  329. package/dist/shaders/retroPalettes.d.ts +1 -1
  330. package/dist/shaders/retroPalettes.js +90 -57
  331. package/dist/shaders/retroPalettes.js.map +1 -0
  332. package/dist/shaders/retroShader.d.ts +2 -86
  333. package/dist/shaders/retroShader.js +65 -196
  334. package/dist/shaders/retroShader.js.map +1 -0
  335. package/dist/shaders/retroUniforms.d.ts +60 -0
  336. package/dist/shaders/retroUniforms.js +215 -0
  337. package/dist/shaders/retroUniforms.js.map +1 -0
  338. package/dist/shaders/skyboxShaders.d.ts +16 -0
  339. package/dist/shaders/skyboxShaders.js +266 -0
  340. package/dist/shaders/skyboxShaders.js.map +1 -0
  341. package/dist/shaders/tsl.d.ts +1 -1
  342. package/dist/shaders/tsl.js.map +1 -0
  343. package/dist/vite/index.d.ts +1 -1
  344. package/dist/vite/index.js +38 -32
  345. package/dist/vite/index.js.map +1 -0
  346. package/dist/world/frontage.js +25 -21
  347. package/dist/world/frontage.js.map +1 -0
  348. package/dist/world/index.d.ts +4 -4
  349. package/dist/world/index.js +12 -11
  350. package/dist/world/index.js.map +1 -0
  351. package/dist/world/infiniteWorld2D.d.ts +0 -5
  352. package/dist/world/infiniteWorld2D.js +175 -200
  353. package/dist/world/infiniteWorld2D.js.map +1 -0
  354. package/dist/world/island.js +81 -166
  355. package/dist/world/island.js.map +1 -0
  356. package/dist/world/islandPathing.d.ts +6 -0
  357. package/dist/world/islandPathing.js +166 -0
  358. package/dist/world/islandPathing.js.map +1 -0
  359. package/dist/world/macroCellSchema.js +15 -8
  360. package/dist/world/macroCellSchema.js.map +1 -0
  361. package/dist/world/macroKnightAStar.js +140 -71
  362. package/dist/world/macroKnightAStar.js.map +1 -0
  363. package/dist/world/macroSettlementZones.d.ts +9 -0
  364. package/dist/world/macroSettlementZones.js +108 -0
  365. package/dist/world/macroSettlementZones.js.map +1 -0
  366. package/dist/world/random.js +50 -24
  367. package/dist/world/random.js.map +1 -0
  368. package/dist/world/road.js +152 -90
  369. package/dist/world/road.js.map +1 -0
  370. package/dist/world/roadRibbon.d.ts +4 -19
  371. package/dist/world/roadRibbon.js +129 -124
  372. package/dist/world/roadRibbon.js.map +1 -0
  373. package/dist/world/terrain.d.ts +1 -1
  374. package/dist/world/terrain.js +111 -65
  375. package/dist/world/terrain.js.map +1 -0
  376. package/dist/world/terrainGeometry.d.ts +14 -0
  377. package/dist/world/terrainGeometry.js +76 -0
  378. package/dist/world/terrainGeometry.js.map +1 -0
  379. package/dist/world/worldTypes.d.ts +3 -3
  380. package/dist/world/worldTypes.js +133 -67
  381. package/dist/world/worldTypes.js.map +1 -0
  382. package/docs/api-reference.md +190 -0
  383. package/package.json +54 -34
  384. package/dist/engine/kolmoStore.js +0 -247
  385. package/dist/importer/CabinPreviewRig.d.ts +0 -13
  386. package/dist/importer/CabinPreviewRig.js +0 -138
  387. package/dist/importer/CabinStepSection.d.ts +0 -17
  388. package/dist/importer/CabinStepSection.js +0 -222
  389. package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -20
  390. package/dist/importer/ImporterPlinthUikitTags.js +0 -119
  391. package/dist/importer/cabinMeshBuilders.d.ts +0 -13
  392. package/dist/importer/cabinMeshBuilders.js +0 -104
  393. package/dist/importer/cabinMixamoRig.d.ts +0 -53
  394. package/dist/importer/cabinMixamoRig.js +0 -150
  395. package/dist/importer/chopShopUiComponents.d.ts +0 -22
  396. package/dist/importer/chopShopUiComponents.js +0 -91
  397. package/dist/importer/vehiclePanelAnim.js +0 -214
@@ -0,0 +1,34 @@
1
+ import * as THREE from "three";
2
+ import { InfiniteLongDrivePlanner } from "../world/infiniteWorld2D.js";
3
+ export declare function buildMacroCellData(mx: number, mz: number, planner: InfiniteLongDrivePlanner, terrainMat?: THREE.Material): {
4
+ plan2d: import("../index.js").MacroCellPlan2D;
5
+ ribbons: import("../index.js").BuiltRoadRibbon[];
6
+ terrainGeo: import("../index.js").BuiltCarvedTerrain;
7
+ shiftedTerrain: {
8
+ height: (lx: number, lz: number) => number;
9
+ visualHeight: (lx: number, lz: number, drop?: number) => number;
10
+ roadMask: (lx: number, lz: number) => import("../index.js").RoadSplatSample;
11
+ road: import("../index.js").Road;
12
+ wild(x: number, z: number): number;
13
+ nearest(x: number, z: number): import("../index.js").NearestOnRoad | null;
14
+ };
15
+ cellTex: import("../index.js").PS2TextureBundle | null;
16
+ cellTerrain: {
17
+ material: THREE.MeshLambertMaterial;
18
+ depthMaterial: THREE.MeshDepthMaterial;
19
+ uniforms: Record<string, THREE.IUniform>;
20
+ } | null;
21
+ poles: Float32Array<ArrayBuffer>;
22
+ rdStr: Float32Array<ArrayBuffer>;
23
+ rdCw: Float32Array<ArrayBuffer>;
24
+ rdInt: Float32Array<ArrayBuffer>;
25
+ cbStr: Float32Array<ArrayBuffer>;
26
+ cbRmp: Float32Array<ArrayBuffer>;
27
+ cbDrv: Float32Array<ArrayBuffer>;
28
+ wallRes: Float32Array<ArrayBuffer>;
29
+ wallCom: Float32Array<ArrayBuffer>;
30
+ wallInd: Float32Array<ArrayBuffer>;
31
+ roofAll: Float32Array<ArrayBuffer>;
32
+ sqHub: Float32Array<ArrayBufferLike>;
33
+ triHub: Float32Array<ArrayBufferLike>;
34
+ };
@@ -0,0 +1,145 @@
1
+ import { createPS2TerrainMaterialWebGL } from "../shaders/ps2TerrainWebGL.js";
2
+ import { createPS2WorldTextures } from "../shaders/ps2Textures.js";
3
+ import { C12TileKind, MACRO_SIZE_M } from "../world/macroCellSchema.js";
4
+ import { roadFromPoints } from "../world/road.js";
5
+ import { buildRoadRibbonGeometry } from "../world/roadRibbon.js";
6
+ import { makeTerrain } from "../world/terrain.js";
7
+ import { buildCarvedTerrainGeometry } from "../world/terrainGeometry.js";
8
+ import { bakeMacroCellSplat } from "./shiftedFixedBody.js";
9
+ import * as THREE from "three";
10
+ // src/engine/macroCellBuilder.ts
11
+ function buildMacroCellData(mx, mz, planner, terrainMat) {
12
+ const plan2d = planner.generateMacroCell2D(mx, mz);
13
+ const hubGroundY = Math.max(2.5, planner.sampleMainlandHeight(plan2d.hubX, plan2d.hubZ));
14
+ const baseFn = (wx, wz) => {
15
+ const raw = planner.sampleMainlandHeight(wx, wz);
16
+ if (plan2d.settlementRadiusM <= 0) return raw;
17
+ const d = Math.hypot(wx - plan2d.hubX, wz - plan2d.hubZ);
18
+ if (d <= plan2d.settlementRadiusM) return hubGroundY;
19
+ const u = (d - plan2d.settlementRadiusM) / 96;
20
+ return u >= 1 ? raw : hubGroundY + (raw - hubGroundY) * (u * u * (3 - 2 * u));
21
+ };
22
+ const roads = plan2d.highwayPolylines.filter((p) => p.length >= 2).map((poly) => {
23
+ const pts = poly.map(([x, z]) => [
24
+ x,
25
+ Math.max(2, baseFn(x, z)),
26
+ z
27
+ ]);
28
+ for (let pass = 0; pass < 4; pass++) for (let i = 1; i < pts.length - 1; i++) pts[i] = [
29
+ pts[i][0],
30
+ .5 * pts[i][1] + .25 * (pts[i - 1][1] + pts[i + 1][1]),
31
+ pts[i][2]
32
+ ];
33
+ return roadFromPoints(pts, 4.5, 4, false);
34
+ });
35
+ const ribbons = roads.map((r) => buildRoadRibbonGeometry(r));
36
+ const primaryRoad = roads[0] ?? roadFromPoints([[
37
+ plan2d.originWorldX - 20,
38
+ hubGroundY,
39
+ plan2d.originWorldZ
40
+ ], [
41
+ plan2d.originWorldX + 20,
42
+ hubGroundY,
43
+ plan2d.originWorldZ
44
+ ]], 4.5, 4, false);
45
+ const terr = makeTerrain(mx * 73856093 ^ mz * 19349663, primaryRoad, {
46
+ amplitude: 28,
47
+ noise: {
48
+ wavelength: 300,
49
+ octaves: 2,
50
+ gain: .5,
51
+ lacunarity: 2
52
+ },
53
+ maxSlope: .55,
54
+ minShoulder: 12,
55
+ verge: 18,
56
+ baseHeight: baseFn,
57
+ maxCutFill: 16,
58
+ extraRoads: roads.slice(1)
59
+ });
60
+ const shiftedTerrain = {
61
+ ...terr,
62
+ height: (lx, lz) => terr.height(plan2d.originWorldX + lx, plan2d.originWorldZ + lz),
63
+ visualHeight: (lx, lz, drop) => terr.visualHeight(plan2d.originWorldX + lx, plan2d.originWorldZ + lz, drop),
64
+ roadMask: (lx, lz) => terr.roadMask(plan2d.originWorldX + lx, plan2d.originWorldZ + lz)
65
+ };
66
+ const terrainGeo = buildCarvedTerrainGeometry(shiftedTerrain, MACRO_SIZE_M, 96);
67
+ const cellTex = terrainMat ? null : createPS2WorldTextures(bakeMacroCellSplat(mx, mz, plan2d, shiftedTerrain));
68
+ const cellTerrain = cellTex ? createPS2TerrainMaterialWebGL(cellTex) : null;
69
+ const dummy = new THREE.Object3D();
70
+ const poles = [], rdStr = [], rdCw = [], rdInt = [];
71
+ const cbStr = [], cbRmp = [], cbDrv = [];
72
+ const wallRes = [], wallCom = [], wallInd = [], roofAll = [];
73
+ for (const r of roads) for (let s = 36; s < r.length - 36; s += 48) {
74
+ const smp = r.at(s);
75
+ dummy.position.set(smp.pos[0] + smp.left[0] * 6.8, smp.pos[1], smp.pos[2] + smp.left[2] * 6.8);
76
+ dummy.rotation.set(0, Math.atan2(smp.tangent[0], smp.tangent[2]), 0);
77
+ dummy.scale.set(1, 1, 1);
78
+ dummy.updateMatrix();
79
+ poles.push(...dummy.matrix.elements);
80
+ }
81
+ if (plan2d.settlementRadiusM > 0) {
82
+ const tileReach = Math.min(84, Math.ceil(plan2d.settlementRadiusM / 3));
83
+ for (let tz = -tileReach; tz <= tileReach; tz++) for (let tx = -tileReach; tx <= tileReach; tx++) {
84
+ const wx = plan2d.hubX + tx * 3 + 1.5, wz = plan2d.hubZ + tz * 3 + 1.5;
85
+ const kind = planner.classifySettlementC12Tile(wx, wz, plan2d);
86
+ if (kind < C12TileKind.ROAD_LANE || kind > C12TileKind.C12_PLAZA_HUB) continue;
87
+ dummy.position.set(wx, hubGroundY + .02, wz);
88
+ dummy.rotation.set(0, 0, 0);
89
+ dummy.scale.set(1, 1, 1);
90
+ dummy.updateMatrix();
91
+ if (kind === C12TileKind.CROSSWALK) rdCw.push(...dummy.matrix.elements);
92
+ else if (kind === C12TileKind.INTERSECTION_BOX || kind === C12TileKind.C12_PLAZA_HUB) rdInt.push(...dummy.matrix.elements);
93
+ else if (kind === C12TileKind.CURB_RAMP_CORNER) cbRmp.push(...dummy.matrix.elements);
94
+ else if (kind === C12TileKind.CURB_DRIVEWAY) cbDrv.push(...dummy.matrix.elements);
95
+ else if (kind === C12TileKind.CURB_STRAIGHT || kind === C12TileKind.BOULEVARD_MEDIAN) cbStr.push(...dummy.matrix.elements);
96
+ else rdStr.push(...dummy.matrix.elements);
97
+ }
98
+ for (const p of plan2d.parcels.slice(0, 140)) {
99
+ const floors = p.zone === "COMMERCIAL" ? 4 : p.zone === "INDUSTRIAL" ? 2 : 1;
100
+ const targetWalls = p.zone === "COMMERCIAL" ? wallCom : p.zone === "INDUSTRIAL" ? wallInd : wallRes;
101
+ const cols = Math.max(2, Math.floor((p.width - 3) / 3)), rows = Math.max(2, Math.floor((p.depth - 3) / 3));
102
+ for (let f = 0; f < floors; f++) {
103
+ const wy = hubGroundY + f * 3 + 1.5;
104
+ for (let c = 0; c < cols; c++) for (const [zOff, yaw] of [[0, 0], [rows * 3, Math.PI]]) {
105
+ dummy.position.set(p.minX + 1.5 + c * 3 + 1.5, wy, p.minZ + 1.5 + zOff);
106
+ dummy.rotation.set(0, yaw, 0);
107
+ dummy.scale.set(1, 1, 1);
108
+ dummy.updateMatrix();
109
+ targetWalls.push(...dummy.matrix.elements);
110
+ }
111
+ }
112
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) {
113
+ dummy.position.set(p.minX + 3 + c * 3, hubGroundY + floors * 3 + .12, p.minZ + 3 + r * 3);
114
+ dummy.rotation.set(0, 0, 0);
115
+ dummy.scale.set(1, 1, 1);
116
+ dummy.updateMatrix();
117
+ roofAll.push(...dummy.matrix.elements);
118
+ }
119
+ }
120
+ }
121
+ return {
122
+ plan2d,
123
+ ribbons,
124
+ terrainGeo,
125
+ shiftedTerrain,
126
+ cellTex,
127
+ cellTerrain,
128
+ poles: new Float32Array(poles),
129
+ rdStr: new Float32Array(rdStr),
130
+ rdCw: new Float32Array(rdCw),
131
+ rdInt: new Float32Array(rdInt),
132
+ cbStr: new Float32Array(cbStr),
133
+ cbRmp: new Float32Array(cbRmp),
134
+ cbDrv: new Float32Array(cbDrv),
135
+ wallRes: new Float32Array(wallRes),
136
+ wallCom: new Float32Array(wallCom),
137
+ wallInd: new Float32Array(wallInd),
138
+ roofAll: new Float32Array(roofAll),
139
+ sqHub: plan2d.civicHubBatches.find((b) => b.kind === "FoundationSquare")?.matrices ?? /* @__PURE__ */ new Float32Array(),
140
+ triHub: plan2d.civicHubBatches.find((b) => b.kind === "FoundationTriangle")?.matrices ?? /* @__PURE__ */ new Float32Array()
141
+ };
142
+ }
143
+ export { buildMacroCellData };
144
+
145
+ //# sourceMappingURL=macroCellBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macroCellBuilder.js","names":[],"sources":["../../src/engine/macroCellBuilder.ts"],"sourcesContent":["import * as THREE from \"three\";\nimport { createPS2TerrainMaterialWebGL } from \"../shaders/ps2TerrainWebGL.js\";\nimport { createPS2WorldTextures } from \"../shaders/ps2Textures.js\";\nimport { C12TileKind, MACRO_SIZE_M } from \"../world/macroCellSchema.js\";\nimport { InfiniteLongDrivePlanner } from \"../world/infiniteWorld2D.js\";\nimport { roadFromPoints } from \"../world/road.js\";\nimport { buildCarvedTerrainGeometry, buildRoadRibbonGeometry } from \"../world/roadRibbon.js\";\nimport { makeTerrain } from \"../world/terrain.js\";\nimport { bakeMacroCellSplat } from \"./shiftedFixedBody.js\";\n\nexport function buildMacroCellData(\n mx: number,\n mz: number,\n planner: InfiniteLongDrivePlanner,\n terrainMat?: THREE.Material,\n) {\n const plan2d = planner.generateMacroCell2D(mx, mz);\n const hubGroundY = Math.max(2.5, planner.sampleMainlandHeight(plan2d.hubX, plan2d.hubZ));\n const baseFn = (wx: number, wz: number): number => {\n const raw = planner.sampleMainlandHeight(wx, wz);\n if (plan2d.settlementRadiusM <= 0) return raw;\n const d = Math.hypot(wx - plan2d.hubX, wz - plan2d.hubZ);\n if (d <= plan2d.settlementRadiusM) return hubGroundY;\n const u = (d - plan2d.settlementRadiusM) / 96;\n return u >= 1 ? raw : hubGroundY + (raw - hubGroundY) * (u * u * (3 - 2 * u));\n };\n\n const roads = plan2d.highwayPolylines.filter((p) => p.length >= 2).map((poly) => {\n const pts = poly.map(([x, z]): [number, number, number] => [x, Math.max(2, baseFn(x, z)), z]);\n for (let pass = 0; pass < 4; pass++) {\n for (let i = 1; i < pts.length - 1; i++)\n pts[i] = [pts[i][0], 0.5 * pts[i][1] + 0.25 * (pts[i - 1][1] + pts[i + 1][1]), pts[i][2]];\n }\n return roadFromPoints(pts, 4.5, 4, false);\n });\n\n const ribbons = roads.map((r) => buildRoadRibbonGeometry(r));\n const primaryRoad = roads[0] ?? roadFromPoints(\n [[plan2d.originWorldX - 20, hubGroundY, plan2d.originWorldZ], [plan2d.originWorldX + 20, hubGroundY, plan2d.originWorldZ]],\n 4.5, 4, false,\n );\n\n const terr = makeTerrain(mx * 73856093 ^ mz * 19349663, primaryRoad, {\n amplitude: 28, noise: { wavelength: 300, octaves: 2, gain: 0.5, lacunarity: 2 },\n maxSlope: 0.55, minShoulder: 12, verge: 18, baseHeight: baseFn, maxCutFill: 16, extraRoads: roads.slice(1),\n });\n const shiftedTerrain = {\n ...terr,\n height: (lx: number, lz: number) => terr.height(plan2d.originWorldX + lx, plan2d.originWorldZ + lz),\n visualHeight: (lx: number, lz: number, drop?: number) => terr.visualHeight(plan2d.originWorldX + lx, plan2d.originWorldZ + lz, drop),\n roadMask: (lx: number, lz: number) => terr.roadMask(plan2d.originWorldX + lx, plan2d.originWorldZ + lz),\n };\n const terrainGeo = buildCarvedTerrainGeometry(shiftedTerrain, MACRO_SIZE_M, 96);\n const cellTex = terrainMat ? null : createPS2WorldTextures(bakeMacroCellSplat(mx, mz, plan2d, shiftedTerrain));\n const cellTerrain = cellTex ? createPS2TerrainMaterialWebGL(cellTex) : null;\n\n const dummy = new THREE.Object3D();\n const poles: number[] = [], rdStr: number[] = [], rdCw: number[] = [], rdInt: number[] = [];\n const cbStr: number[] = [], cbRmp: number[] = [], cbDrv: number[] = [];\n const wallRes: number[] = [], wallCom: number[] = [], wallInd: number[] = [], roofAll: number[] = [];\n\n for (const r of roads) {\n for (let s = 36; s < r.length - 36; s += 48) {\n const smp = r.at(s);\n dummy.position.set(smp.pos[0] + smp.left[0] * 6.8, smp.pos[1], smp.pos[2] + smp.left[2] * 6.8);\n dummy.rotation.set(0, Math.atan2(smp.tangent[0], smp.tangent[2]), 0);\n dummy.scale.set(1, 1, 1);\n dummy.updateMatrix();\n poles.push(...dummy.matrix.elements);\n }\n }\n\n if (plan2d.settlementRadiusM > 0) {\n const tileReach = Math.min(84, Math.ceil(plan2d.settlementRadiusM / 3));\n for (let tz = -tileReach; tz <= tileReach; tz++) {\n for (let tx = -tileReach; tx <= tileReach; tx++) {\n const wx = plan2d.hubX + tx * 3 + 1.5, wz = plan2d.hubZ + tz * 3 + 1.5;\n const kind = planner.classifySettlementC12Tile(wx, wz, plan2d);\n if (kind < C12TileKind.ROAD_LANE || kind > C12TileKind.C12_PLAZA_HUB) continue;\n dummy.position.set(wx, hubGroundY + 0.02, wz);\n dummy.rotation.set(0, 0, 0);\n dummy.scale.set(1, 1, 1);\n dummy.updateMatrix();\n if (kind === C12TileKind.CROSSWALK) rdCw.push(...dummy.matrix.elements);\n else if (kind === C12TileKind.INTERSECTION_BOX || kind === C12TileKind.C12_PLAZA_HUB) rdInt.push(...dummy.matrix.elements);\n else if (kind === C12TileKind.CURB_RAMP_CORNER) cbRmp.push(...dummy.matrix.elements);\n else if (kind === C12TileKind.CURB_DRIVEWAY) cbDrv.push(...dummy.matrix.elements);\n else if (kind === C12TileKind.CURB_STRAIGHT || kind === C12TileKind.BOULEVARD_MEDIAN) cbStr.push(...dummy.matrix.elements);\n else rdStr.push(...dummy.matrix.elements);\n }\n }\n for (const p of plan2d.parcels.slice(0, 140)) {\n const floors = p.zone === \"COMMERCIAL\" ? 4 : p.zone === \"INDUSTRIAL\" ? 2 : 1;\n const targetWalls = p.zone === \"COMMERCIAL\" ? wallCom : p.zone === \"INDUSTRIAL\" ? wallInd : wallRes;\n const cols = Math.max(2, Math.floor((p.width - 3) / 3)), rows = Math.max(2, Math.floor((p.depth - 3) / 3));\n for (let f = 0; f < floors; f++) {\n const wy = hubGroundY + f * 3 + 1.5;\n for (let c = 0; c < cols; c++) {\n for (const [zOff, yaw] of [[0, 0], [rows * 3, Math.PI]]) {\n dummy.position.set(p.minX + 1.5 + c * 3 + 1.5, wy, p.minZ + 1.5 + zOff);\n dummy.rotation.set(0, yaw, 0); dummy.scale.set(1, 1, 1); dummy.updateMatrix();\n targetWalls.push(...dummy.matrix.elements);\n }\n }\n }\n for (let r = 0; r < rows; r++) {\n for (let c = 0; c < cols; c++) {\n dummy.position.set(p.minX + 3 + c * 3, hubGroundY + floors * 3 + 0.12, p.minZ + 3 + r * 3);\n dummy.rotation.set(0, 0, 0); dummy.scale.set(1, 1, 1); dummy.updateMatrix();\n roofAll.push(...dummy.matrix.elements);\n }\n }\n }\n }\n\n return {\n plan2d, ribbons, terrainGeo, shiftedTerrain, cellTex, cellTerrain,\n poles: new Float32Array(poles), rdStr: new Float32Array(rdStr), rdCw: new Float32Array(rdCw),\n rdInt: new Float32Array(rdInt), cbStr: new Float32Array(cbStr), cbRmp: new Float32Array(cbRmp),\n cbDrv: new Float32Array(cbDrv), wallRes: new Float32Array(wallRes), wallCom: new Float32Array(wallCom),\n wallInd: new Float32Array(wallInd), roofAll: new Float32Array(roofAll),\n sqHub: plan2d.civicHubBatches.find((b) => b.kind === \"FoundationSquare\")?.matrices ?? new Float32Array(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AAQ;GACzC;EAER;CACJ;CAEA,OAAO;EACH;EAAQ;EAAS;EAAY;EAAgB;EAAS;EACtD,OAAO,IAAI,aAAa,KAAK;EAAG,OAAO,IAAI,aAAa,KAAK;EAAG,MAAM,IAAI,aAAa,IAAI;EAC3F,OAAO,IAAI,aAAa,KAAK;EAAG,OAAO,IAAI,aAAa,KAAK;EAAG,OAAO,IAAI,aAAa,KAAK;EAC7F,OAAO,IAAI,aAAa,KAAK;EAAG,SAAS,IAAI,aAAa,OAAO;EAAG,SAAS,IAAI,aAAa,OAAO;EACrG,SAAS,IAAI,aAAa,OAAO;EAAG,SAAS,IAAI,aAAa,OAAO;EACrE,OAAO,OAAO,gBAAgB,MAAM,MAAM,EAAE,SAAS,kBAAkB,CAAC,EAAE,4BAAY,IAAI,aAAa;EACvG,QAAQ,OAAO,gBAAgB,MAAM,MAAM,EAAE,SAAS,oBAAoB,CAAC,EAAE,4BAAY,IAAI,aAAa;CAC9G;AACJ"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import * as THREE from "three";
3
- import { InfiniteLongDrivePlanner, type MacroCellPlan2D } from "../world/index.js";
2
+ import type * as THREE from "three";
3
+ import { InfiniteLongDrivePlanner, type MacroCellPlan2D } from "../world/infiniteWorld2D.js";
4
4
  import { ShiftedFixedBody, type ShiftedFixedBodyProps } from "./shiftedFixedBody.js";
5
5
  export { ShiftedFixedBody, type ShiftedFixedBodyProps };
6
6
  export declare function MainlandMacroCell({ mx, mz, planner, roadMat, terrainMat, offX, offZ, renderExtra, }: {
@@ -1,247 +1,159 @@
1
- import { createPS2TerrainMaterialWebGL as e } from "../shaders/ps2TerrainWebGL.js";
2
- import { createPS2WorldTextures as t } from "../shaders/ps2Textures.js";
3
- import { C12TileKind as n, MACRO_SIZE_M as r } from "../world/macroCellSchema.js";
4
- import { buildCarvedTerrainGeometry as i, buildRoadRibbonGeometry as a } from "../world/roadRibbon.js";
5
- import { makeTerrain as o } from "../world/terrain.js";
6
- import { roadFromPoints as s } from "../world/road.js";
7
- import { InstancedC12Piece as c, InstancedWorldGlb as l, RoadsideStopCompound as u } from "./longDriveKit.js";
8
- import { ShiftedFixedBody as d, bakeMacroCellSplat as f } from "./shiftedFixedBody.js";
9
- import { useEffect as p, useMemo as m } from "react";
10
- import * as h from "three";
11
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
- import { TrimeshCollider as v } from "@react-three/rapier";
1
+ import { InstancedC12Piece, InstancedWorldGlb } from "./longDriveKit.js";
2
+ import { RoadsideStopCompound } from "./longDriveRoadside.js";
3
+ import { buildMacroCellData } from "./macroCellBuilder.js";
4
+ import { ShiftedFixedBody } from "./shiftedFixedBody.js";
5
+ import { useEffect, useMemo } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { TrimeshCollider } from "@react-three/rapier";
13
8
  // src/engine/mainlandMacroCell.tsx
14
- function y({ mx: y, mz: b, planner: x, roadMat: S, terrainMat: C, offX: w, offZ: T, renderExtra: E }) {
15
- let D = m(() => {
16
- let c = x.generateMacroCell2D(y, b), l = Math.max(2.5, x.sampleMainlandHeight(c.hubX, c.hubZ)), u = (e, t) => {
17
- let n = x.sampleMainlandHeight(e, t);
18
- if (c.settlementRadiusM <= 0) return n;
19
- let r = Math.hypot(e - c.hubX, t - c.hubZ);
20
- if (r <= c.settlementRadiusM) return l;
21
- let i = (r - c.settlementRadiusM) / 96;
22
- return i >= 1 ? n : l + (n - l) * (i * i * (3 - 2 * i));
23
- }, d = c.highwayPolylines.filter((e) => e.length >= 2).map((e) => {
24
- let t = e.map(([e, t]) => [
25
- e,
26
- Math.max(2, u(e, t)),
27
- t
28
- ]);
29
- for (let e = 0; e < 4; e++) for (let e = 1; e < t.length - 1; e++) t[e] = [
30
- t[e][0],
31
- .5 * t[e][1] + .25 * (t[e - 1][1] + t[e + 1][1]),
32
- t[e][2]
33
- ];
34
- return s(t, 4.5, 4, !1);
35
- }), p = d.map((e) => a(e)), m = d[0] ?? s([[
36
- c.originWorldX - 20,
37
- l,
38
- c.originWorldZ
39
- ], [
40
- c.originWorldX + 20,
41
- l,
42
- c.originWorldZ
43
- ]], 4.5, 4, !1), g = o(y * 73856093 ^ b * 19349663, m, {
44
- amplitude: 28,
45
- noise: {
46
- wavelength: 300,
47
- octaves: 2,
48
- gain: .5,
49
- lacunarity: 2
50
- },
51
- maxSlope: .55,
52
- minShoulder: 12,
53
- verge: 18,
54
- baseHeight: u,
55
- maxCutFill: 16,
56
- extraRoads: d.slice(1)
57
- }), _ = {
58
- ...g,
59
- height: (e, t) => g.height(c.originWorldX + e, c.originWorldZ + t),
60
- visualHeight: (e, t, n) => g.visualHeight(c.originWorldX + e, c.originWorldZ + t, n),
61
- roadMask: (e, t) => g.roadMask(c.originWorldX + e, c.originWorldZ + t)
62
- }, v = i(_, r, 96), S = C ? null : t(f(y, b, c, _)), w = S ? e(S) : null, T = new h.Object3D(), E = [], D = [], O = [], k = [], A = [], j = [], M = [], N = [], P = [], F = [], I = [];
63
- for (let e of d) for (let t = 36; t < e.length - 36; t += 48) {
64
- let n = e.at(t);
65
- T.position.set(n.pos[0] + n.left[0] * 6.8, n.pos[1], n.pos[2] + n.left[2] * 6.8), T.rotation.set(0, Math.atan2(n.tangent[0], n.tangent[2]), 0), T.scale.set(1, 1, 1), T.updateMatrix(), E.push(...T.matrix.elements);
66
- }
67
- if (c.settlementRadiusM > 0) {
68
- let e = Math.min(84, Math.ceil(c.settlementRadiusM / 3));
69
- for (let t = -e; t <= e; t++) for (let r = -e; r <= e; r++) {
70
- let e = c.hubX + r * 3 + 1.5, i = c.hubZ + t * 3 + 1.5, a = x.classifySettlementC12Tile(e, i, c);
71
- a < n.ROAD_LANE || a > n.C12_PLAZA_HUB || (T.position.set(e, l + .02, i), T.rotation.set(0, 0, 0), T.scale.set(1, 1, 1), T.updateMatrix(), a === n.CROSSWALK ? O.push(...T.matrix.elements) : a === n.INTERSECTION_BOX || a === n.C12_PLAZA_HUB ? k.push(...T.matrix.elements) : a === n.CURB_RAMP_CORNER ? j.push(...T.matrix.elements) : a === n.CURB_DRIVEWAY ? M.push(...T.matrix.elements) : a === n.CURB_STRAIGHT || a === n.BOULEVARD_MEDIAN ? A.push(...T.matrix.elements) : D.push(...T.matrix.elements));
72
- }
73
- for (let e of c.parcels.slice(0, 140)) {
74
- let t = e.zone === "COMMERCIAL" ? 4 : e.zone === "INDUSTRIAL" ? 2 : 1, n = e.zone === "COMMERCIAL" ? P : e.zone === "INDUSTRIAL" ? F : N, r = Math.max(2, Math.floor((e.width - 3) / 3)), i = Math.max(2, Math.floor((e.depth - 3) / 3));
75
- for (let a = 0; a < t; a++) {
76
- let t = l + a * 3 + 1.5;
77
- for (let a = 0; a < r; a++) for (let [r, o] of [[0, 0], [i * 3, Math.PI]]) T.position.set(e.minX + 1.5 + a * 3 + 1.5, t, e.minZ + 1.5 + r), T.rotation.set(0, o, 0), T.scale.set(1, 1, 1), T.updateMatrix(), n.push(...T.matrix.elements);
78
- }
79
- for (let n = 0; n < i; n++) for (let i = 0; i < r; i++) T.position.set(e.minX + 3 + i * 3, l + t * 3 + .12, e.minZ + 3 + n * 3), T.rotation.set(0, 0, 0), T.scale.set(1, 1, 1), T.updateMatrix(), I.push(...T.matrix.elements);
80
- }
81
- }
82
- let L = c.civicHubBatches.find((e) => e.kind === "FoundationSquare")?.matrices ?? /* @__PURE__ */ new Float32Array(), R = c.civicHubBatches.find((e) => e.kind === "FoundationTriangle")?.matrices ?? /* @__PURE__ */ new Float32Array();
83
- return {
84
- plan2d: c,
85
- ribbons: p,
86
- terrainGeo: v,
87
- shiftedTerrain: _,
88
- cellTex: S,
89
- cellTerrain: w,
90
- poles: new Float32Array(E),
91
- rdStr: new Float32Array(D),
92
- rdCw: new Float32Array(O),
93
- rdInt: new Float32Array(k),
94
- cbStr: new Float32Array(A),
95
- cbRmp: new Float32Array(j),
96
- cbDrv: new Float32Array(M),
97
- wallRes: new Float32Array(N),
98
- wallCom: new Float32Array(P),
99
- wallInd: new Float32Array(F),
100
- roofAll: new Float32Array(I),
101
- sqHub: L,
102
- triHub: R
103
- };
104
- }, [
105
- y,
106
- b,
107
- x,
108
- C
9
+ function MainlandMacroCell({ mx, mz, planner, roadMat, terrainMat, offX, offZ, renderExtra }) {
10
+ const built = useMemo(() => buildMacroCellData(mx, mz, planner, terrainMat), [
11
+ mx,
12
+ mz,
13
+ planner,
14
+ terrainMat
109
15
  ]);
110
- p(() => () => {
111
- D.terrainGeo.geometry.dispose(), D.ribbons.forEach((e) => e.geometry.dispose()), D.cellTerrain?.material.dispose(), D.cellTerrain?.depthMaterial.dispose(), D.cellTex?.dispose();
112
- }, [D]);
113
- let O = C ?? D.cellTerrain.material;
114
- return /* @__PURE__ */ _("group", { children: [
115
- /* @__PURE__ */ _(d, {
116
- x: D.plan2d.originWorldX + w,
117
- z: D.plan2d.originWorldZ + T,
16
+ useEffect(() => () => {
17
+ built.terrainGeo.geometry.dispose();
18
+ built.ribbons.forEach((r) => r.geometry.dispose());
19
+ built.cellTerrain?.material.dispose();
20
+ built.cellTerrain?.depthMaterial.dispose();
21
+ built.cellTex?.dispose();
22
+ }, [built]);
23
+ const activeTerrainMat = terrainMat ?? built.cellTerrain.material;
24
+ return /* @__PURE__ */ jsxs("group", { children: [
25
+ /* @__PURE__ */ jsxs(ShiftedFixedBody, {
26
+ x: built.plan2d.originWorldX + offX,
27
+ z: built.plan2d.originWorldZ + offZ,
118
28
  friction: .9,
119
- children: [/* @__PURE__ */ g(v, { args: [D.terrainGeo.colliderVertices, D.terrainGeo.colliderIndices] }), /* @__PURE__ */ g("mesh", {
120
- geometry: D.terrainGeo.geometry,
121
- material: O,
122
- receiveShadow: !0
29
+ children: [/* @__PURE__ */ jsx(TrimeshCollider, { args: [built.terrainGeo.colliderVertices, built.terrainGeo.colliderIndices] }), /* @__PURE__ */ jsx("mesh", {
30
+ geometry: built.terrainGeo.geometry,
31
+ material: activeTerrainMat,
32
+ receiveShadow: true
123
33
  })]
124
34
  }),
125
- D.ribbons.map((e, t) => /* @__PURE__ */ _(d, {
126
- x: w,
127
- z: T,
35
+ built.ribbons.map((r, idx) => /* @__PURE__ */ jsxs(ShiftedFixedBody, {
36
+ x: offX,
37
+ z: offZ,
128
38
  friction: 1.05,
129
- children: [/* @__PURE__ */ g(v, { args: [e.colliderVertices, e.colliderIndices] }), /* @__PURE__ */ g("mesh", {
130
- geometry: e.geometry,
131
- material: S,
132
- receiveShadow: !0
39
+ children: [/* @__PURE__ */ jsx(TrimeshCollider, { args: [r.colliderVertices, r.colliderIndices] }), /* @__PURE__ */ jsx("mesh", {
40
+ geometry: r.geometry,
41
+ material: roadMat,
42
+ receiveShadow: true
133
43
  })]
134
- }, `hwy_${t}`)),
135
- /* @__PURE__ */ _("group", {
44
+ }, `hwy_${idx}`)),
45
+ /* @__PURE__ */ jsxs("group", {
136
46
  position: [
137
- w,
47
+ offX,
138
48
  0,
139
- T
49
+ offZ
140
50
  ],
141
51
  children: [
142
- /* @__PURE__ */ g(l, {
52
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
143
53
  kitKey: "light_pole",
144
54
  fitSpan: [
145
55
  .6,
146
56
  6.8,
147
57
  .6
148
58
  ],
149
- matrices: D.poles
59
+ matrices: built.poles
150
60
  }),
151
- /* @__PURE__ */ g(l, {
61
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
152
62
  kitKey: "road_straight",
153
63
  fitSpan: [
154
64
  3,
155
65
  .08,
156
66
  3
157
67
  ],
158
- matrices: D.rdStr
68
+ matrices: built.rdStr
159
69
  }),
160
- /* @__PURE__ */ g(l, {
70
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
161
71
  kitKey: "road_crosswalk",
162
72
  fitSpan: [
163
73
  3,
164
74
  .08,
165
75
  3
166
76
  ],
167
- matrices: D.rdCw
77
+ matrices: built.rdCw
168
78
  }),
169
- /* @__PURE__ */ g(l, {
79
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
170
80
  kitKey: "road_intersection",
171
81
  fitSpan: [
172
82
  3,
173
83
  .08,
174
84
  3
175
85
  ],
176
- matrices: D.rdInt
86
+ matrices: built.rdInt
177
87
  }),
178
- /* @__PURE__ */ g(l, {
88
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
179
89
  kitKey: "curb_straight",
180
90
  fitSpan: [
181
91
  3,
182
92
  .18,
183
93
  3
184
94
  ],
185
- matrices: D.cbStr
95
+ matrices: built.cbStr
186
96
  }),
187
- /* @__PURE__ */ g(l, {
97
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
188
98
  kitKey: "curb_ramp",
189
99
  fitSpan: [
190
100
  3,
191
101
  .18,
192
102
  3
193
103
  ],
194
- matrices: D.cbRmp
104
+ matrices: built.cbRmp
195
105
  }),
196
- /* @__PURE__ */ g(l, {
106
+ /* @__PURE__ */ jsx(InstancedWorldGlb, {
197
107
  kitKey: "curb_driveway",
198
108
  fitSpan: [
199
109
  3,
200
110
  .14,
201
111
  3
202
112
  ],
203
- matrices: D.cbDrv
113
+ matrices: built.cbDrv
204
114
  }),
205
- /* @__PURE__ */ g(c, {
206
- matrices: D.sqHub,
115
+ /* @__PURE__ */ jsx(InstancedC12Piece, {
116
+ matrices: built.sqHub,
207
117
  kind: "square",
208
118
  color: "#94a3b8"
209
119
  }),
210
- /* @__PURE__ */ g(c, {
211
- matrices: D.triHub,
120
+ /* @__PURE__ */ jsx(InstancedC12Piece, {
121
+ matrices: built.triHub,
212
122
  kind: "triangle",
213
123
  color: "#cbd5e1"
214
124
  }),
215
- /* @__PURE__ */ g(c, {
216
- matrices: D.wallRes,
125
+ /* @__PURE__ */ jsx(InstancedC12Piece, {
126
+ matrices: built.wallRes,
217
127
  kind: "wall",
218
128
  color: "#d6c7b2"
219
129
  }),
220
- /* @__PURE__ */ g(c, {
221
- matrices: D.wallCom,
130
+ /* @__PURE__ */ jsx(InstancedC12Piece, {
131
+ matrices: built.wallCom,
222
132
  kind: "wall",
223
133
  color: "#38bdf8"
224
134
  }),
225
- /* @__PURE__ */ g(c, {
226
- matrices: D.wallInd,
135
+ /* @__PURE__ */ jsx(InstancedC12Piece, {
136
+ matrices: built.wallInd,
227
137
  kind: "wall",
228
138
  color: "#b45309"
229
139
  }),
230
- /* @__PURE__ */ g(c, {
231
- matrices: D.roofAll,
140
+ /* @__PURE__ */ jsx(InstancedC12Piece, {
141
+ matrices: built.roofAll,
232
142
  kind: "roof",
233
143
  color: "#334155"
234
144
  })
235
145
  ]
236
146
  }),
237
- D.plan2d.roadsideStops.map((e, t) => /* @__PURE__ */ g(u, {
238
- stop: e,
239
- groundY: Math.max(2, D.shiftedTerrain.height(e.worldX - D.plan2d.originWorldX, e.worldZ - D.plan2d.originWorldZ)),
240
- offX: w,
241
- offZ: T,
242
- cellTag: `stop_${y}_${b}_${t}`
243
- }, `stop_${t}`)),
244
- E?.(y, b, D.plan2d, w, T)
147
+ built.plan2d.roadsideStops.map((stop, idx) => /* @__PURE__ */ jsx(RoadsideStopCompound, {
148
+ stop,
149
+ groundY: Math.max(2, built.shiftedTerrain.height(stop.worldX - built.plan2d.originWorldX, stop.worldZ - built.plan2d.originWorldZ)),
150
+ offX,
151
+ offZ,
152
+ cellTag: `stop_${mx}_${mz}_${idx}`
153
+ }, `stop_${idx}`)),
154
+ renderExtra?.(mx, mz, built.plan2d, offX, offZ)
245
155
  ] });
246
156
  }
247
- export { y as MainlandMacroCell, d as ShiftedFixedBody };
157
+ export { MainlandMacroCell, ShiftedFixedBody };
158
+
159
+ //# sourceMappingURL=mainlandMacroCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mainlandMacroCell.js","names":[],"sources":["../../src/engine/mainlandMacroCell.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport type * as THREE from \"three\";\nimport { TrimeshCollider } from \"@react-three/rapier\";\nimport { InfiniteLongDrivePlanner, type MacroCellPlan2D } from \"../world/infiniteWorld2D.js\";\nimport { InstancedC12Piece, InstancedWorldGlb, RoadsideStopCompound } from \"./longDriveKit.js\";\nimport { buildMacroCellData } from \"./macroCellBuilder.js\";\nimport { ShiftedFixedBody, type ShiftedFixedBodyProps } from \"./shiftedFixedBody.js\";\n\nexport { ShiftedFixedBody, type ShiftedFixedBodyProps };\n\nexport function MainlandMacroCell({\n mx,\n mz,\n planner,\n roadMat,\n terrainMat,\n offX,\n offZ,\n renderExtra,\n}: {\n readonly mx: number;\n readonly mz: number;\n readonly planner: InfiniteLongDrivePlanner;\n readonly roadMat: THREE.Material;\n readonly terrainMat?: THREE.Material;\n readonly offX: number;\n readonly offZ: number;\n readonly renderExtra?: (mx: number, mz: number, plan: MacroCellPlan2D, offX: number, offZ: number) => React.ReactNode;\n}): React.JSX.Element {\n const built = useMemo(() => buildMacroCellData(mx, mz, planner, terrainMat), [mx, mz, planner, terrainMat]);\n\n useEffect(() => () => {\n built.terrainGeo.geometry.dispose();\n built.ribbons.forEach((r) => r.geometry.dispose());\n built.cellTerrain?.material.dispose();\n built.cellTerrain?.depthMaterial.dispose();\n built.cellTex?.dispose();\n }, [built]);\n\n const activeTerrainMat = terrainMat ?? built.cellTerrain!.material;\n\n return (\n <group>\n <ShiftedFixedBody x={built.plan2d.originWorldX + offX} z={built.plan2d.originWorldZ + offZ} friction={0.9}>\n <TrimeshCollider args={[built.terrainGeo.colliderVertices, built.terrainGeo.colliderIndices]} />\n <mesh geometry={built.terrainGeo.geometry} material={activeTerrainMat} receiveShadow />\n </ShiftedFixedBody>\n {built.ribbons.map((r, idx) => (\n <ShiftedFixedBody key={`hwy_${idx}`} x={offX} z={offZ} friction={1.05}>\n <TrimeshCollider args={[r.colliderVertices, r.colliderIndices]} />\n <mesh geometry={r.geometry} material={roadMat} receiveShadow />\n </ShiftedFixedBody>\n ))}\n <group position={[offX, 0, offZ]}>\n <InstancedWorldGlb kitKey=\"light_pole\" fitSpan={[0.6, 6.8, 0.6]} matrices={built.poles} />\n <InstancedWorldGlb kitKey=\"road_straight\" fitSpan={[3, 0.08, 3]} matrices={built.rdStr} />\n <InstancedWorldGlb kitKey=\"road_crosswalk\" fitSpan={[3, 0.08, 3]} matrices={built.rdCw} />\n <InstancedWorldGlb kitKey=\"road_intersection\" fitSpan={[3, 0.08, 3]} matrices={built.rdInt} />\n <InstancedWorldGlb kitKey=\"curb_straight\" fitSpan={[3, 0.18, 3]} matrices={built.cbStr} />\n <InstancedWorldGlb kitKey=\"curb_ramp\" fitSpan={[3, 0.18, 3]} matrices={built.cbRmp} />\n <InstancedWorldGlb kitKey=\"curb_driveway\" fitSpan={[3, 0.14, 3]} matrices={built.cbDrv} />\n <InstancedC12Piece matrices={built.sqHub} kind=\"square\" color=\"#94a3b8\" />\n <InstancedC12Piece matrices={built.triHub} kind=\"triangle\" color=\"#cbd5e1\" />\n <InstancedC12Piece matrices={built.wallRes} kind=\"wall\" color=\"#d6c7b2\" />\n <InstancedC12Piece matrices={built.wallCom} kind=\"wall\" color=\"#38bdf8\" />\n <InstancedC12Piece matrices={built.wallInd} kind=\"wall\" color=\"#b45309\" />\n <InstancedC12Piece matrices={built.roofAll} kind=\"roof\" color=\"#334155\" />\n </group>\n {built.plan2d.roadsideStops.map((stop, idx) => (\n <RoadsideStopCompound\n key={`stop_${idx}`}\n stop={stop}\n groundY={Math.max(\n 2,\n built.shiftedTerrain.height(stop.worldX - built.plan2d.originWorldX, stop.worldZ - built.plan2d.originWorldZ),\n )}\n offX={offX}\n offZ={offZ}\n cellTag={`stop_${mx}_${mz}_${idx}`}\n />\n ))}\n {renderExtra?.(mx, mz, built.plan2d, offX, offZ)}\n </group>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,kBAAkB,EAC9B,IACA,IACA,SACA,SACA,YACA,MACA,MACA,eAUkB;CAClB,MAAM,QAAQ,cAAc,mBAAmB,IAAI,IAAI,SAAS,UAAU,GAAG;EAAC;EAAI;EAAI;EAAS;CAAU,CAAC;CAE1G,sBAAsB;EAClB,MAAM,WAAW,SAAS,QAAQ;EAClC,MAAM,QAAQ,SAAS,MAAM,EAAE,SAAS,QAAQ,CAAC;EACjD,M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A;IAC7F,oBAAC,mBAAD;KAAmB,QAAO;KAAgB,SAAS;MAAC;MAAG;MAAM;KAAC;KAAG,UAAU,MAAM;IAAQ,CAAA;IACzF,oBAAC,mBAAD;KAAmB,QAAO;KAAY,SAAS;MAAC;MAAG;MAAM;KAAC;KAAG,UAAU,MAAM;IAAQ,CAAA;IACrF,oBAAC,mBAAD;KAAmB,QAAO;KAAgB,SAAS;MAAC;MAAG;MAAM;KAAC;KAAG,UAAU,MAAM;IAAQ,CAAA;IACzF,oBAAC,mBAAD;KAAmB,UAAU,MAAM;KAAO,MAAK;KAAS,OAAM;IAAW,CAAA;IACzE,oBAAC,mBAAD;KAAmB,UAAU,MAAM;KAAQ,MAAK;KAAW,OAAM;IAAW,CAAA;IAC5E,oBAAC,mBAAD;KAAmB,UAAU,MAAM;KAAS,MAAK;KAAO,OAAM;IAAW,CAAA;IACzE,oBAAC,mBAAD;KAAmB,UAAU,MAAM;KAAS,MAAK;KAAO,OAAM;IAAW,CAAA;IACzE,oBAAC,mBAAD;KAAmB,UAAU,MAAM;KAAS,MAAK;KAAO,OAAM;IAAW,CAAA;IACzE,oBAAC,mBAAD;KAAmB,UAAU,MAAM;KAAS,MAAK;KAAO,OAAM;IAAW,CAAA;GACtE;;EACN,MAAM,OAAO,cAAc,KAAK,MAAM,QACnC,oBAAC,sBAAD;GAEU;GACN,SAAS,KAAK,IACV,GACA,MAAM,eAAe,OAAO,KAAK,SAAS,MAAM,OAAO,cAAc,KAAK,SAAS,MAAM,OAAO,YAAY,CAChH;GACM;GACA;GACN,SAAS,QAAQ,GAAG,GAAG,GAAG,GAAG;EAChC,GATQ,QAAQ,KAShB,CACJ;EACA,cAAc,IAAI,IAAI,MAAM,QAAQ,MAAM,IAAI;CAC5C,EAAA,CAAA;AAEf"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { type MacroCellPlan2D, type Terrain, type WorldGenResult } from "../world/index.js";
2
+ import type { MacroCellPlan2D, Terrain, WorldGenResult } from "../world/index.js";
3
3
  export interface ShiftedFixedBodyProps {
4
4
  readonly x: number;
5
5
  readonly y?: number;