@pinkaphant/kolmo 0.4.7 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -94
- package/dist/engine/actor.d.ts +13 -0
- package/dist/engine/gltfLoader.d.ts +18 -0
- package/dist/engine/index.d.ts +8 -17
- package/dist/engine/index.js +667 -27
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/{kolmoInput.d.ts → input.d.ts} +8 -6
- package/dist/engine/surface.d.ts +17 -0
- package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +24 -48
- package/dist/engine/vehicle.d.ts +20 -0
- package/dist/engine/world.d.ts +76 -0
- package/dist/index.d.ts +14 -18
- package/dist/index.js +16 -116
- package/dist/physics/index.d.ts +3 -3
- package/dist/physics/index.js +1 -131
- package/dist/physics/nBodyGravity.d.ts +14 -7
- package/dist/physics-ZDFXaCli.js +475 -0
- package/dist/physics-ZDFXaCli.js.map +1 -0
- package/dist/surface-DUol_5ml.js +610 -0
- package/dist/surface-DUol_5ml.js.map +1 -0
- package/dist/toolgun/Toolgun.d.ts +33 -0
- package/dist/toolgun/index.d.ts +2 -0
- package/dist/toolgun/index.js +1 -0
- package/dist/toolgun/store.d.ts +198 -0
- package/dist/toolgun-BfcCIAQx.js +1582 -0
- package/dist/toolgun-BfcCIAQx.js.map +1 -0
- package/dist/vite/index.d.ts +0 -4
- package/dist/vite/index.js +1 -9
- package/dist/vite/index.js.map +1 -1
- package/package.json +32 -89
- package/AGENTS.md +0 -29
- package/CLAUDE.md +0 -8
- package/bin/kolmo.mjs +0 -561
- package/dist/engine/causewayBridge.d.ts +0 -14
- package/dist/engine/causewayBridge.js +0 -166
- package/dist/engine/causewayBridge.js.map +0 -1
- package/dist/engine/islandSettlementMesh.d.ts +0 -26
- package/dist/engine/islandSettlementMesh.js +0 -166
- package/dist/engine/islandSettlementMesh.js.map +0 -1
- package/dist/engine/kolmoActions.d.ts +0 -23
- package/dist/engine/kolmoActions.js +0 -179
- package/dist/engine/kolmoActions.js.map +0 -1
- package/dist/engine/kolmoActor.d.ts +0 -21
- package/dist/engine/kolmoActor.js +0 -273
- package/dist/engine/kolmoActor.js.map +0 -1
- package/dist/engine/kolmoActorHelpers.d.ts +0 -24
- package/dist/engine/kolmoActorHelpers.js +0 -64
- package/dist/engine/kolmoActorHelpers.js.map +0 -1
- package/dist/engine/kolmoBotControl.d.ts +0 -44
- package/dist/engine/kolmoBotControl.js +0 -194
- package/dist/engine/kolmoBotControl.js.map +0 -1
- package/dist/engine/kolmoBotJournal.d.ts +0 -23
- package/dist/engine/kolmoBotJournal.js +0 -138
- package/dist/engine/kolmoBotJournal.js.map +0 -1
- package/dist/engine/kolmoFloatingOrigin.d.ts +0 -17
- package/dist/engine/kolmoFloatingOrigin.js +0 -91
- package/dist/engine/kolmoFloatingOrigin.js.map +0 -1
- package/dist/engine/kolmoGame.d.ts +0 -27
- package/dist/engine/kolmoGame.js +0 -83
- package/dist/engine/kolmoGame.js.map +0 -1
- package/dist/engine/kolmoGltfLoader.d.ts +0 -16
- package/dist/engine/kolmoGltfLoader.js +0 -46
- package/dist/engine/kolmoGltfLoader.js.map +0 -1
- package/dist/engine/kolmoHud.d.ts +0 -23
- package/dist/engine/kolmoHud.js +0 -219
- package/dist/engine/kolmoHud.js.map +0 -1
- package/dist/engine/kolmoInput.js +0 -165
- package/dist/engine/kolmoInput.js.map +0 -1
- package/dist/engine/kolmoIsland.d.ts +0 -14
- package/dist/engine/kolmoIsland.js +0 -243
- package/dist/engine/kolmoIsland.js.map +0 -1
- package/dist/engine/kolmoLongDrive.d.ts +0 -12
- package/dist/engine/kolmoLongDrive.js +0 -178
- package/dist/engine/kolmoLongDrive.js.map +0 -1
- package/dist/engine/kolmoPilotMesh.d.ts +0 -6
- package/dist/engine/kolmoPilotMesh.js +0 -377
- package/dist/engine/kolmoPilotMesh.js.map +0 -1
- package/dist/engine/kolmoProcedural.d.ts +0 -13
- package/dist/engine/kolmoProcedural.js +0 -101
- package/dist/engine/kolmoProcedural.js.map +0 -1
- package/dist/engine/kolmoRigs.d.ts +0 -13
- package/dist/engine/kolmoRigs.js +0 -100
- package/dist/engine/kolmoRigs.js.map +0 -1
- package/dist/engine/kolmoStore.d.ts +0 -3
- package/dist/engine/kolmoStore.js +0 -4
- package/dist/engine/kolmoStore.js.map +0 -1
- package/dist/engine/kolmoSurface.d.ts +0 -18
- package/dist/engine/kolmoSurface.js +0 -198
- package/dist/engine/kolmoSurface.js.map +0 -1
- package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
- package/dist/engine/kolmoTouchOverlay.js +0 -326
- package/dist/engine/kolmoTouchOverlay.js.map +0 -1
- package/dist/engine/kolmoTouchState.d.ts +0 -50
- package/dist/engine/kolmoTouchState.js +0 -210
- package/dist/engine/kolmoTouchState.js.map +0 -1
- package/dist/engine/kolmoTraits.js +0 -140
- package/dist/engine/kolmoTraits.js.map +0 -1
- package/dist/engine/kolmoVehicle.d.ts +0 -4
- package/dist/engine/kolmoVehicle.js +0 -80
- package/dist/engine/kolmoVehicle.js.map +0 -1
- package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -11
- package/dist/engine/kolmoVehicleAutoCompile.js +0 -94
- package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
- package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
- package/dist/engine/kolmoVehicleConfig.js +0 -84
- package/dist/engine/kolmoVehicleConfig.js.map +0 -1
- package/dist/engine/kolmoVehicleDriver.d.ts +0 -39
- package/dist/engine/kolmoVehicleDriver.js +0 -147
- package/dist/engine/kolmoVehicleDriver.js.map +0 -1
- package/dist/engine/kolmoVehicleInner.d.ts +0 -7
- package/dist/engine/kolmoVehicleInner.js +0 -307
- package/dist/engine/kolmoVehicleInner.js.map +0 -1
- package/dist/engine/kolmoWardrobeRig.d.ts +0 -22
- package/dist/engine/kolmoWardrobeRig.js +0 -146
- package/dist/engine/kolmoWardrobeRig.js.map +0 -1
- package/dist/engine/kolmoWorld.d.ts +0 -45
- package/dist/engine/kolmoWorld.js +0 -164
- package/dist/engine/kolmoWorld.js.map +0 -1
- package/dist/engine/longDriveKit.d.ts +0 -19
- package/dist/engine/longDriveKit.js +0 -145
- package/dist/engine/longDriveKit.js.map +0 -1
- package/dist/engine/longDriveRoadside.d.ts +0 -16
- package/dist/engine/longDriveRoadside.js +0 -171
- package/dist/engine/longDriveRoadside.js.map +0 -1
- package/dist/engine/macroCellBuilder.d.ts +0 -44
- package/dist/engine/macroCellBuilder.js +0 -228
- package/dist/engine/macroCellBuilder.js.map +0 -1
- package/dist/engine/mainlandMacroCell.d.ts +0 -15
- package/dist/engine/mainlandMacroCell.js +0 -168
- package/dist/engine/mainlandMacroCell.js.map +0 -1
- package/dist/engine/shiftedFixedBody.d.ts +0 -13
- package/dist/engine/shiftedFixedBody.js +0 -75
- package/dist/engine/shiftedFixedBody.js.map +0 -1
- package/dist/importer/ChopShopPanel.d.ts +0 -52
- package/dist/importer/ChopShopPanel.js +0 -409
- package/dist/importer/ChopShopPanel.js.map +0 -1
- package/dist/importer/DomainWorkshopPanel.d.ts +0 -25
- package/dist/importer/DomainWorkshopPanel.js +0 -385
- package/dist/importer/DomainWorkshopPanel.js.map +0 -1
- package/dist/importer/GateHudBar.d.ts +0 -39
- package/dist/importer/GateHudBar.js +0 -401
- package/dist/importer/GateHudBar.js.map +0 -1
- package/dist/importer/GlbImportGate.d.ts +0 -8
- package/dist/importer/GlbImportGate.js +0 -300
- package/dist/importer/GlbImportGate.js.map +0 -1
- package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
- package/dist/importer/ImperativeVehicleRig.js +0 -274
- package/dist/importer/ImperativeVehicleRig.js.map +0 -1
- package/dist/importer/LiveDrivePads.d.ts +0 -20
- package/dist/importer/LiveDrivePads.js +0 -195
- package/dist/importer/LiveDrivePads.js.map +0 -1
- package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
- package/dist/importer/PaperShellDebrisRig.js +0 -143
- package/dist/importer/PaperShellDebrisRig.js.map +0 -1
- package/dist/importer/R2VaultDrawer.d.ts +0 -12
- package/dist/importer/R2VaultDrawer.js +0 -90
- package/dist/importer/R2VaultDrawer.js.map +0 -1
- package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
- package/dist/importer/Step1CalibrationPlinth.js +0 -204
- package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
- package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
- package/dist/importer/Step1ExplodedIslands.js +0 -144
- package/dist/importer/Step1ExplodedIslands.js.map +0 -1
- package/dist/importer/Step2UniversalPad.d.ts +0 -18
- package/dist/importer/Step2UniversalPad.js +0 -123
- package/dist/importer/Step2UniversalPad.js.map +0 -1
- package/dist/importer/VfxEmitterPool.d.ts +0 -8
- package/dist/importer/VfxEmitterPool.js +0 -64
- package/dist/importer/VfxEmitterPool.js.map +0 -1
- package/dist/importer/WardrobeWorkshopPanel.d.ts +0 -15
- package/dist/importer/WardrobeWorkshopPanel.js +0 -529
- package/dist/importer/WardrobeWorkshopPanel.js.map +0 -1
- package/dist/importer/WheelRingHandles3D.d.ts +0 -11
- package/dist/importer/WheelRingHandles3D.js +0 -319
- package/dist/importer/WheelRingHandles3D.js.map +0 -1
- package/dist/importer/archLinerGeom.d.ts +0 -2
- package/dist/importer/archLinerGeom.js +0 -51
- package/dist/importer/archLinerGeom.js.map +0 -1
- package/dist/importer/chopHingeHelpers.d.ts +0 -15
- package/dist/importer/chopHingeHelpers.js +0 -193
- package/dist/importer/chopHingeHelpers.js.map +0 -1
- package/dist/importer/chopShopActions.d.ts +0 -58
- package/dist/importer/chopShopActions.js +0 -165
- package/dist/importer/chopShopActions.js.map +0 -1
- package/dist/importer/chopShopHandlers.d.ts +0 -26
- package/dist/importer/chopShopHandlers.js +0 -283
- package/dist/importer/chopShopHandlers.js.map +0 -1
- package/dist/importer/chopShopIoActions.d.ts +0 -20
- package/dist/importer/chopShopIoActions.js +0 -192
- package/dist/importer/chopShopIoActions.js.map +0 -1
- package/dist/importer/chopShopMcpAction.d.ts +0 -18
- package/dist/importer/chopShopMcpAction.js +0 -58
- package/dist/importer/chopShopMcpAction.js.map +0 -1
- package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
- package/dist/importer/cylinderBooleanSlice.js +0 -110
- package/dist/importer/cylinderBooleanSlice.js.map +0 -1
- package/dist/importer/cylinderSliceMath.d.ts +0 -14
- package/dist/importer/cylinderSliceMath.js +0 -251
- package/dist/importer/cylinderSliceMath.js.map +0 -1
- package/dist/importer/fusedWheelDetect.d.ts +0 -4
- package/dist/importer/fusedWheelDetect.js +0 -297
- package/dist/importer/fusedWheelDetect.js.map +0 -1
- package/dist/importer/fusedWheelFit.d.ts +0 -19
- package/dist/importer/fusedWheelFit.js +0 -219
- package/dist/importer/fusedWheelFit.js.map +0 -1
- package/dist/importer/gateStore.d.ts +0 -73
- package/dist/importer/gateStore.js +0 -102
- package/dist/importer/gateStore.js.map +0 -1
- package/dist/importer/glbNormalizer.d.ts +0 -22
- package/dist/importer/glbNormalizer.js +0 -177
- package/dist/importer/glbNormalizer.js.map +0 -1
- package/dist/importer/importerWebMcp.d.ts +0 -51
- package/dist/importer/importerWebMcp.js +0 -50
- package/dist/importer/importerWebMcp.js.map +0 -1
- package/dist/importer/importerWebMcpTools.d.ts +0 -2
- package/dist/importer/importerWebMcpTools.js +0 -368
- package/dist/importer/importerWebMcpTools.js.map +0 -1
- package/dist/importer/index.d.ts +0 -29
- package/dist/importer/index.js +0 -42
- package/dist/importer/index.js.map +0 -1
- package/dist/importer/khrCarGeometryMass.d.ts +0 -20
- package/dist/importer/khrCarGeometryMass.js +0 -131
- package/dist/importer/khrCarGeometryMass.js.map +0 -1
- package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
- package/dist/importer/khrCarPlanHelpers.js +0 -300
- package/dist/importer/khrCarPlanHelpers.js.map +0 -1
- package/dist/importer/khrCarPlanner.d.ts +0 -8
- package/dist/importer/khrCarPlanner.js +0 -289
- package/dist/importer/khrCarPlanner.js.map +0 -1
- package/dist/importer/khrCompiler.d.ts +0 -5
- package/dist/importer/khrCompiler.js +0 -87
- package/dist/importer/khrCompiler.js.map +0 -1
- package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
- package/dist/importer/khrCraftPropCompiler.js +0 -263
- package/dist/importer/khrCraftPropCompiler.js.map +0 -1
- package/dist/importer/khrNodeNameGuard.d.ts +0 -20
- package/dist/importer/khrNodeNameGuard.js +0 -139
- package/dist/importer/khrNodeNameGuard.js.map +0 -1
- package/dist/importer/launcherBake.d.ts +0 -15
- package/dist/importer/launcherBake.js +0 -117
- package/dist/importer/launcherBake.js.map +0 -1
- package/dist/importer/launcherCadGeometry.d.ts +0 -22
- package/dist/importer/launcherCadGeometry.js +0 -185
- package/dist/importer/launcherCadGeometry.js.map +0 -1
- package/dist/importer/meshIslands.d.ts +0 -17
- package/dist/importer/meshIslands.js +0 -102
- package/dist/importer/meshIslands.js.map +0 -1
- package/dist/importer/meshSliceBuffers.d.ts +0 -15
- package/dist/importer/meshSliceBuffers.js +0 -159
- package/dist/importer/meshSliceBuffers.js.map +0 -1
- package/dist/importer/polygonEarClipYZ.d.ts +0 -3
- package/dist/importer/polygonEarClipYZ.js +0 -67
- package/dist/importer/polygonEarClipYZ.js.map +0 -1
- package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
- package/dist/importer/proceduralC12AndCraft.js +0 -302
- package/dist/importer/proceduralC12AndCraft.js.map +0 -1
- package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
- package/dist/importer/proceduralDomainBuilders.js +0 -346
- package/dist/importer/proceduralDomainBuilders.js.map +0 -1
- package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
- package/dist/importer/proceduralPersonAndProp.js +0 -303
- package/dist/importer/proceduralPersonAndProp.js.map +0 -1
- package/dist/importer/sceneSiNormalize.d.ts +0 -19
- package/dist/importer/sceneSiNormalize.js +0 -145
- package/dist/importer/sceneSiNormalize.js.map +0 -1
- package/dist/importer/starterScene.d.ts +0 -5
- package/dist/importer/starterScene.js +0 -139
- package/dist/importer/starterScene.js.map +0 -1
- package/dist/importer/surfaceCutter.d.ts +0 -16
- package/dist/importer/surfaceCutter.js +0 -83
- package/dist/importer/surfaceCutter.js.map +0 -1
- package/dist/importer/surfaceGeodesic.d.ts +0 -7
- package/dist/importer/surfaceGeodesic.js +0 -130
- package/dist/importer/surfaceGeodesic.js.map +0 -1
- package/dist/importer/surfaceLoopRefine.d.ts +0 -6
- package/dist/importer/surfaceLoopRefine.js +0 -171
- package/dist/importer/surfaceLoopRefine.js.map +0 -1
- package/dist/importer/surfacePeel.d.ts +0 -11
- package/dist/importer/surfacePeel.js +0 -119
- package/dist/importer/surfacePeel.js.map +0 -1
- package/dist/importer/surfaceTopology.d.ts +0 -36
- package/dist/importer/surfaceTopology.js +0 -143
- package/dist/importer/surfaceTopology.js.map +0 -1
- package/dist/importer/universalGateBake.d.ts +0 -45
- package/dist/importer/universalGateBake.js +0 -203
- package/dist/importer/universalGateBake.js.map +0 -1
- package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
- package/dist/importer/usdPhysicsSpecs.js +0 -245
- package/dist/importer/usdPhysicsSpecs.js.map +0 -1
- package/dist/importer/usdTextParse.d.ts +0 -12
- package/dist/importer/usdTextParse.js +0 -118
- package/dist/importer/usdTextParse.js.map +0 -1
- package/dist/importer/usdToGlb.d.ts +0 -12
- package/dist/importer/usdToGlb.js +0 -94
- package/dist/importer/usdToGlb.js.map +0 -1
- package/dist/importer/useChopShopController.d.ts +0 -110
- package/dist/importer/useChopShopController.js +0 -219
- package/dist/importer/useChopShopController.js.map +0 -1
- package/dist/importer/useChopShopState.d.ts +0 -103
- package/dist/importer/useChopShopState.js +0 -350
- package/dist/importer/useChopShopState.js.map +0 -1
- package/dist/importer/useWasdKeyRef.d.ts +0 -9
- package/dist/importer/useWasdKeyRef.js +0 -35
- package/dist/importer/useWasdKeyRef.js.map +0 -1
- package/dist/importer/vehiclePartSplit.d.ts +0 -33
- package/dist/importer/vehiclePartSplit.js +0 -183
- package/dist/importer/vehiclePartSplit.js.map +0 -1
- package/dist/importer/wardrobeAutoFit.d.ts +0 -16
- package/dist/importer/wardrobeAutoFit.js +0 -410
- package/dist/importer/wardrobeAutoFit.js.map +0 -1
- package/dist/importer/wardrobeCatalog.d.ts +0 -16
- package/dist/importer/wardrobeCatalog.js +0 -409
- package/dist/importer/wardrobeCatalog.js.map +0 -1
- package/dist/importer/wardrobeController.d.ts +0 -49
- package/dist/importer/wardrobeController.js +0 -181
- package/dist/importer/wardrobeController.js.map +0 -1
- package/dist/importer/wardrobeFitter.d.ts +0 -27
- package/dist/importer/wardrobeFitter.js +0 -269
- package/dist/importer/wardrobeFitter.js.map +0 -1
- package/dist/importer/wardrobeWebMcpTools.d.ts +0 -2
- package/dist/importer/wardrobeWebMcpTools.js +0 -198
- package/dist/importer/wardrobeWebMcpTools.js.map +0 -1
- package/dist/importer/wheelAxlePairing.d.ts +0 -21
- package/dist/importer/wheelAxlePairing.js +0 -157
- package/dist/importer/wheelAxlePairing.js.map +0 -1
- package/dist/importer/wheelCutterHelpers.d.ts +0 -45
- package/dist/importer/wheelCutterHelpers.js +0 -208
- package/dist/importer/wheelCutterHelpers.js.map +0 -1
- package/dist/importer/wheelRingHandleMath.d.ts +0 -20
- package/dist/importer/wheelRingHandleMath.js +0 -66
- package/dist/importer/wheelRingHandleMath.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/junk/DestructibleTarget.d.ts +0 -18
- package/dist/junk/DestructibleTarget.js +0 -223
- package/dist/junk/DestructibleTarget.js.map +0 -1
- package/dist/junk/KolmoJunk.d.ts +0 -14
- package/dist/junk/KolmoJunk.js +0 -76
- package/dist/junk/KolmoJunk.js.map +0 -1
- package/dist/junk/ShardPieces.d.ts +0 -13
- package/dist/junk/ShardPieces.js +0 -101
- package/dist/junk/ShardPieces.js.map +0 -1
- package/dist/junk/TargetDecals.d.ts +0 -9
- package/dist/junk/TargetDecals.js +0 -77
- package/dist/junk/TargetDecals.js.map +0 -1
- package/dist/junk/bvhShatter.d.ts +0 -3
- package/dist/junk/bvhShatter.js +0 -101
- package/dist/junk/bvhShatter.js.map +0 -1
- package/dist/junk/bvhTriCollector.d.ts +0 -16
- package/dist/junk/bvhTriCollector.js +0 -127
- package/dist/junk/bvhTriCollector.js.map +0 -1
- package/dist/junk/index.d.ts +0 -14
- package/dist/junk/index.js +0 -13
- package/dist/junk/index.js.map +0 -1
- package/dist/junk/junkGeometry.d.ts +0 -13
- package/dist/junk/junkGeometry.js +0 -87
- package/dist/junk/junkGeometry.js.map +0 -1
- package/dist/junk/junkImportSanitize.d.ts +0 -5
- package/dist/junk/junkImportSanitize.js +0 -74
- package/dist/junk/junkImportSanitize.js.map +0 -1
- package/dist/junk/junkImporter.d.ts +0 -14
- package/dist/junk/junkImporter.js +0 -124
- package/dist/junk/junkImporter.js.map +0 -1
- package/dist/junk/junkLabelCanvas.d.ts +0 -2
- package/dist/junk/junkLabelCanvas.js +0 -185
- package/dist/junk/junkLabelCanvas.js.map +0 -1
- package/dist/junk/junkLabels.d.ts +0 -9
- package/dist/junk/junkLabels.js +0 -49
- package/dist/junk/junkLabels.js.map +0 -1
- package/dist/junk/junkProceduralScenes.d.ts +0 -12
- package/dist/junk/junkProceduralScenes.js +0 -220
- package/dist/junk/junkProceduralScenes.js.map +0 -1
- package/dist/junk/junkSheetSplitter.d.ts +0 -38
- package/dist/junk/junkSheetSplitter.js +0 -104
- package/dist/junk/junkSheetSplitter.js.map +0 -1
- package/dist/junk/junkTypes.d.ts +0 -48
- package/dist/junk/junkTypes.js +0 -0
- package/dist/junk/junkTypes.js.map +0 -1
- package/dist/junk/targetHelpers.d.ts +0 -55
- package/dist/junk/targetHelpers.js +0 -157
- package/dist/junk/targetHelpers.js.map +0 -1
- package/dist/junk/targetHitLogic.d.ts +0 -30
- package/dist/junk/targetHitLogic.js +0 -163
- package/dist/junk/targetHitLogic.js.map +0 -1
- package/dist/junk/useTargetAssets.d.ts +0 -19
- package/dist/junk/useTargetAssets.js +0 -130
- package/dist/junk/useTargetAssets.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/nBodyGravity.js +0 -70
- package/dist/physics/nBodyGravity.js.map +0 -1
- package/dist/sand3d/KolmoSand3D.d.ts +0 -19
- package/dist/sand3d/KolmoSand3D.js +0 -92
- package/dist/sand3d/KolmoSand3D.js.map +0 -1
- package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
- package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
- package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
- package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
- package/dist/sand3d/gateBakeHelpers.js +0 -225
- package/dist/sand3d/gateBakeHelpers.js.map +0 -1
- package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
- package/dist/sand3d/gateDoorwayBake.js +0 -203
- package/dist/sand3d/gateDoorwayBake.js.map +0 -1
- package/dist/sand3d/index.d.ts +0 -3
- package/dist/sand3d/index.js +0 -4
- package/dist/sand3d/index.js.map +0 -1
- package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
- package/dist/sand3d/sand3dAssetLoader.js +0 -177
- package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
- package/dist/schema/kolmoSchema.d.ts +0 -9
- package/dist/schema/kolmoSchema.js +0 -110
- package/dist/schema/kolmoSchema.js.map +0 -1
- package/dist/schema/kolmoStamp.d.ts +0 -11
- package/dist/schema/kolmoStamp.js +0 -119
- package/dist/schema/kolmoStamp.js.map +0 -1
- package/dist/schema/kolmoTypes.d.ts +0 -63
- package/dist/schema/kolmoTypes.js +0 -66
- package/dist/schema/kolmoTypes.js.map +0 -1
- package/dist/shaders/celestialBackdrop.d.ts +0 -14
- package/dist/shaders/celestialBackdrop.js +0 -181
- package/dist/shaders/celestialBackdrop.js.map +0 -1
- package/dist/shaders/emitterShaders.d.ts +0 -9
- package/dist/shaders/emitterShaders.js +0 -114
- package/dist/shaders/emitterShaders.js.map +0 -1
- package/dist/shaders/index.d.ts +0 -5
- package/dist/shaders/index.js +0 -12
- package/dist/shaders/index.js.map +0 -1
- package/dist/shaders/plumeAndSparkle.d.ts +0 -12
- package/dist/shaders/plumeAndSparkle.js +0 -233
- package/dist/shaders/plumeAndSparkle.js.map +0 -1
- package/dist/shaders/ps2GlslShared.d.ts +0 -20
- package/dist/shaders/ps2GlslShared.js +0 -30
- package/dist/shaders/ps2GlslShared.js.map +0 -1
- package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
- package/dist/shaders/ps2MaterialsTSL.js +0 -146
- package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
- package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
- package/dist/shaders/ps2MaterialsWebGL.js +0 -57
- package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
- package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
- package/dist/shaders/ps2RoadWebGL.js +0 -138
- package/dist/shaders/ps2RoadWebGL.js.map +0 -1
- package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
- package/dist/shaders/ps2TerrainWebGL.js +0 -131
- package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
- package/dist/shaders/ps2Textures.d.ts +0 -22
- package/dist/shaders/ps2Textures.js +0 -299
- package/dist/shaders/ps2Textures.js.map +0 -1
- package/dist/shaders/retroPalettes.d.ts +0 -24
- package/dist/shaders/retroPalettes.js +0 -221
- package/dist/shaders/retroPalettes.js.map +0 -1
- package/dist/shaders/retroShader.d.ts +0 -13
- package/dist/shaders/retroShader.js +0 -110
- package/dist/shaders/retroShader.js.map +0 -1
- package/dist/shaders/retroUniforms.d.ts +0 -60
- package/dist/shaders/retroUniforms.js +0 -215
- package/dist/shaders/retroUniforms.js.map +0 -1
- package/dist/shaders/skyboxShaders.d.ts +0 -16
- package/dist/shaders/skyboxShaders.js +0 -266
- package/dist/shaders/skyboxShaders.js.map +0 -1
- package/dist/shaders/tsl.d.ts +0 -1
- package/dist/shaders/tsl.js +0 -1
- package/dist/shaders/tsl.js.map +0 -1
- package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
- package/dist/suika/KolmoSuikaOrb.js +0 -375
- package/dist/suika/KolmoSuikaOrb.js.map +0 -1
- package/dist/suika/index.d.ts +0 -4
- package/dist/suika/index.js +0 -5
- package/dist/suika/index.js.map +0 -1
- package/dist/suika/suikaArbiter.d.ts +0 -60
- package/dist/suika/suikaArbiter.js +0 -265
- package/dist/suika/suikaArbiter.js.map +0 -1
- package/dist/suika/suikaGeometry.d.ts +0 -10
- package/dist/suika/suikaGeometry.js +0 -251
- package/dist/suika/suikaGeometry.js.map +0 -1
- package/dist/suika/suikaTypes.d.ts +0 -74
- package/dist/suika/suikaTypes.js +0 -196
- package/dist/suika/suikaTypes.js.map +0 -1
- package/dist/world/frontage.d.ts +0 -26
- package/dist/world/frontage.js +0 -36
- package/dist/world/frontage.js.map +0 -1
- package/dist/world/index.d.ts +0 -9
- package/dist/world/index.js +0 -12
- package/dist/world/index.js.map +0 -1
- package/dist/world/infiniteWorld2D.d.ts +0 -19
- package/dist/world/infiniteWorld2D.js +0 -219
- package/dist/world/infiniteWorld2D.js.map +0 -1
- package/dist/world/island.d.ts +0 -29
- package/dist/world/island.js +0 -116
- package/dist/world/island.js.map +0 -1
- package/dist/world/islandPathing.d.ts +0 -6
- package/dist/world/islandPathing.js +0 -166
- package/dist/world/islandPathing.js.map +0 -1
- package/dist/world/macroCellSchema.d.ts +0 -72
- package/dist/world/macroCellSchema.js +0 -34
- package/dist/world/macroCellSchema.js.map +0 -1
- package/dist/world/macroKnightAStar.d.ts +0 -11
- package/dist/world/macroKnightAStar.js +0 -240
- package/dist/world/macroKnightAStar.js.map +0 -1
- package/dist/world/macroSettlementZones.d.ts +0 -9
- package/dist/world/macroSettlementZones.js +0 -108
- package/dist/world/macroSettlementZones.js.map +0 -1
- package/dist/world/random.d.ts +0 -23
- package/dist/world/random.js +0 -59
- package/dist/world/random.js.map +0 -1
- package/dist/world/road.d.ts +0 -37
- package/dist/world/road.js +0 -198
- package/dist/world/road.js.map +0 -1
- package/dist/world/roadRibbon.d.ts +0 -29
- package/dist/world/roadRibbon.js +0 -166
- package/dist/world/roadRibbon.js.map +0 -1
- package/dist/world/terrain.d.ts +0 -62
- package/dist/world/terrain.js +0 -133
- package/dist/world/terrain.js.map +0 -1
- package/dist/world/terrainGeometry.d.ts +0 -14
- package/dist/world/terrainGeometry.js +0 -76
- package/dist/world/terrainGeometry.js.map +0 -1
- package/dist/world/worldTypes.d.ts +0 -43
- package/dist/world/worldTypes.js +0 -197
- package/dist/world/worldTypes.js.map +0 -1
- package/docs/api-reference.md +0 -728
- package/skills/kolmo-engine/SKILL.md +0 -109
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolgun-BfcCIAQx.js","names":["_jsxs","_jsx","_Fragment"],"sources":["../src/toolgun/store.ts","../src/toolgun/Toolgun.tsx"],"sourcesContent":["import * as THREE from \"three\";\nimport type RAPIER from \"@dimforge/rapier3d-compat\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\nimport { isJointOpen, openTargetForLimits, type JointRuntime, type KhrAssetBundle } from \"@khr3/core\";\nimport {\n STEP_METRES,\n canPlace,\n latticePose,\n poseToFloat,\n snapPose,\n socketFor,\n wrapYaw,\n worldSockets,\n type PieceKind,\n type PiecePose,\n type PlacedPiece,\n type Socket,\n} from \"@khr3/c12\";\n\nexport const TOOLGUN_MODES = [\"spawn\", \"weld\", \"hinge\", \"rig\", \"build\", \"delete\"] as const;\nexport type ToolgunMode = (typeof TOOLGUN_MODES)[number];\n\nexport const TOOLGUN_BUILD_KINDS = [\n \"FoundationSquare\",\n \"FoundationTriangle\",\n \"Wall\",\n \"Doorway\",\n \"Floor\",\n \"FloorTriangle\",\n \"Roof\",\n \"RoofTriangle\",\n \"Stairs\",\n] as const satisfies readonly PieceKind[];\nexport type ToolgunBuildKind = (typeof TOOLGUN_BUILD_KINDS)[number];\n\nexport interface ToolgunSkinSpec {\n readonly bodyHex: string;\n readonly accentHex: string;\n readonly emissiveHex: string;\n readonly metalness: number;\n readonly roughness: number;\n}\n\nexport const TOOLGUN_SKIN_PRESETS = {\n cobalt: { bodyHex: \"#1e293b\", accentHex: \"#38bdf8\", emissiveHex: \"#0ea5e9\", metalness: 0.65, roughness: 0.32 },\n hazard: { bodyHex: \"#292524\", accentHex: \"#f59e0b\", emissiveHex: \"#d97706\", metalness: 0.55, roughness: 0.38 },\n stealth: { bodyHex: \"#0f172a\", accentHex: \"#64748b\", emissiveHex: \"#38bdf8\", metalness: 0.72, roughness: 0.28 },\n chrome: { bodyHex: \"#cbd5e1\", accentHex: \"#0284c7\", emissiveHex: \"#38bdf8\", metalness: 0.92, roughness: 0.14 },\n arctic: { bodyHex: \"#f1f5f9\", accentHex: \"#06b6d4\", emissiveHex: \"#22d3ee\", metalness: 0.35, roughness: 0.42 },\n ember: { bodyHex: \"#1c1917\", accentHex: \"#ef4444\", emissiveHex: \"#f97316\", metalness: 0.62, roughness: 0.34 },\n} as const satisfies Record<string, ToolgunSkinSpec>;\n\nexport type ToolgunSkinPreset = keyof typeof TOOLGUN_SKIN_PRESETS;\n\nexport interface ArmedToolgunAsset {\n readonly id: string;\n readonly name: string;\n readonly src?: string;\n readonly bundle?: KhrAssetBundle;\n readonly kind?: \"auto\" | \"vehicle\" | \"prop\";\n readonly fixed?: boolean;\n}\n\nexport interface SpawnedToolgunEntity {\n readonly id: string;\n readonly name: string;\n readonly kind: \"vehicle\" | \"prop\";\n readonly src?: string;\n readonly bundle?: KhrAssetBundle;\n readonly fixed: boolean;\n readonly position: [number, number, number];\n readonly quaternion: [number, number, number, number];\n}\n\nexport interface CreatedToolgunJoint {\n readonly id: string;\n readonly kind: \"weld\" | \"hinge\";\n readonly handle: number;\n readonly joint: RAPIER.ImpulseJoint;\n readonly anchorWorld: [number, number, number];\n}\n\nexport interface ToolgunRayHit {\n readonly point: [number, number, number];\n readonly normal: [number, number, number];\n readonly distanceM: number;\n readonly collider: RAPIER.Collider;\n readonly body: RAPIER.RigidBody | null;\n readonly label: string;\n readonly spawnedEntityId?: string;\n readonly placedPieceId?: string;\n}\n\nexport interface PendingJointAnchor {\n readonly body: RAPIER.RigidBody;\n readonly worldPoint: [number, number, number];\n readonly worldNormal: [number, number, number];\n readonly label: string;\n}\n\nexport interface BuildSnapCandidate {\n readonly kind: ToolgunBuildKind;\n readonly pose: PiecePose;\n readonly position: [number, number, number];\n readonly quaternion: [number, number, number, number];\n readonly snappedSocket: boolean;\n readonly valid: boolean;\n readonly reason: string;\n}\n\nexport type ToolgunHistoryEntry =\n | { readonly type: \"spawn\"; readonly id: string }\n | { readonly type: \"piece\"; readonly id: string }\n | { readonly type: \"joint\"; readonly id: string };\n\nexport interface ToolgunActionOutcome {\n readonly ok: boolean;\n readonly status: string;\n readonly beamEnd: [number, number, number];\n}\n\nconst _upDefault = new THREE.Vector3(0, 1, 0);\nconst _nrmVec = new THREE.Vector3();\nconst _alignQuat = new THREE.Quaternion();\nconst _yawQuat = new THREE.Quaternion();\nconst _qA = new THREE.Quaternion();\nconst _qB = new THREE.Quaternion();\nconst _qInvA = new THREE.Quaternion();\nconst _qInvB = new THREE.Quaternion();\nconst _qRel = new THREE.Quaternion();\nconst _vA = new THREE.Vector3();\nconst _vB = new THREE.Vector3();\nconst _axLocal = new THREE.Vector3();\nconst _axWorldB = new THREE.Vector3();\n\n/**\n * Casts a solid ray against Rapier WASM colliders, ignoring sensors and the optional actor RigidBody.\n */\nexport function castToolgunRay(\n rapier: typeof RAPIER,\n world: RAPIER.World,\n origin: readonly [number, number, number],\n direction: readonly [number, number, number],\n maxRange = 80,\n excludeBody?: RAPIER.RigidBody | null,\n): {\n point: [number, number, number];\n normal: [number, number, number];\n toi: number;\n collider: RAPIER.Collider;\n body: RAPIER.RigidBody | null;\n} | null {\n const dirLen = Math.hypot(direction[0], direction[1], direction[2]);\n if (dirLen < 1e-8 || maxRange <= 0)\n return null;\n const dx = direction[0] / dirLen;\n const dy = direction[1] / dirLen;\n const dz = direction[2] / dirLen;\n const ray = new rapier.Ray({ x: origin[0], y: origin[1], z: origin[2] }, { x: dx, y: dy, z: dz });\n const hit = world.castRayAndGetNormal(\n ray,\n maxRange,\n true,\n rapier.QueryFilterFlags.EXCLUDE_SENSORS,\n undefined,\n undefined,\n excludeBody ?? undefined,\n );\n if (!hit)\n return null;\n const nLen = Math.hypot(hit.normal.x, hit.normal.y, hit.normal.z);\n const nx = nLen > 1e-6 ? hit.normal.x / nLen : 0;\n const ny = nLen > 1e-6 ? hit.normal.y / nLen : 1;\n const nz = nLen > 1e-6 ? hit.normal.z / nLen : 0;\n return {\n point: [origin[0] + dx * hit.timeOfImpact, origin[1] + dy * hit.timeOfImpact, origin[2] + dz * hit.timeOfImpact],\n normal: [nx, ny, nz],\n toi: hit.timeOfImpact,\n collider: hit.collider,\n body: hit.collider.parent(),\n };\n}\n\n/**\n * Aligns a spawned asset's +Y axis to `surfaceNormal` (when sloped) composed with exact 30° `yaw12` turn.\n */\nexport function computeAlignedSpawnPose(\n point: readonly [number, number, number],\n yaw12: number,\n surfaceNormal: readonly [number, number, number] = [0, 1, 0],\n clearanceM = 0.04,\n): { position: [number, number, number]; quaternion: [number, number, number, number] } {\n _nrmVec.set(surfaceNormal[0], surfaceNormal[1], surfaceNormal[2]);\n if (_nrmVec.lengthSq() < 1e-6)\n _nrmVec.set(0, 1, 0);\n else\n _nrmVec.normalize();\n // Keep ground vehicles/props upright on steep side walls (> 55°), align on ramps/floors\n if (_nrmVec.y < 0.57)\n _nrmVec.set(0, 1, 0);\n _alignQuat.setFromUnitVectors(_upDefault, _nrmVec);\n const yawRad = (wrapYaw(yaw12) * Math.PI) / 6;\n _yawQuat.setFromAxisAngle(_upDefault, yawRad);\n _alignQuat.multiply(_yawQuat).normalize();\n return {\n position: [\n point[0] + _nrmVec.x * clearanceM,\n point[1] + _nrmVec.y * clearanceM,\n point[2] + _nrmVec.z * clearanceM,\n ],\n quaternion: [_alignQuat.x, _alignQuat.y, _alignQuat.z, _alignQuat.w],\n };\n}\n\n/**\n * Creates a real Rapier WASM Fixed `ImpulseJoint` locking `bodyA` and `bodyB` at their current relative 6-DOF pose.\n */\nexport function createWeldImpulseJoint(\n rapier: typeof RAPIER,\n world: RAPIER.World,\n bodyA: RAPIER.RigidBody,\n bodyB: RAPIER.RigidBody,\n worldAnchor: readonly [number, number, number],\n): RAPIER.ImpulseJoint {\n const tA = bodyA.translation();\n const rA = bodyA.rotation();\n const tB = bodyB.translation();\n const rB = bodyB.rotation();\n\n _qA.set(rA.x, rA.y, rA.z, rA.w).normalize();\n _qB.set(rB.x, rB.y, rB.z, rB.w).normalize();\n _qInvA.copy(_qA).invert();\n _qInvB.copy(_qB).invert();\n\n _vA.set(worldAnchor[0] - tA.x, worldAnchor[1] - tA.y, worldAnchor[2] - tA.z).applyQuaternion(_qInvA);\n _vB.set(worldAnchor[0] - tB.x, worldAnchor[1] - tB.y, worldAnchor[2] - tB.z).applyQuaternion(_qInvB);\n _qRel.copy(_qInvA).multiply(_qB).normalize();\n\n const data = rapier.JointData.fixed(\n { x: _vA.x, y: _vA.y, z: _vA.z },\n { x: _qRel.x, y: _qRel.y, z: _qRel.z, w: _qRel.w },\n { x: _vB.x, y: _vB.y, z: _vB.z },\n { x: 0, y: 0, z: 0, w: 1 },\n );\n const imp = world.createImpulseJoint(data, bodyA, bodyB, true);\n imp.setContactsEnabled(false);\n if (bodyA.isDynamic())\n bodyA.wakeUp();\n if (bodyB.isDynamic())\n bodyB.wakeUp();\n return imp;\n}\n\n/**\n * Creates a real Rapier WASM Revolute `ImpulseJoint` around `worldAxis` through `worldAnchor`.\n * Aligns `bodyB`'s hinge shaft to `worldAxis` about `worldAnchor` when `bodyB` is tilted off-axis so `t=0` has zero snap error.\n */\nexport function createHingeImpulseJoint(\n rapier: typeof RAPIER,\n world: RAPIER.World,\n bodyA: RAPIER.RigidBody,\n bodyB: RAPIER.RigidBody,\n worldAnchor: readonly [number, number, number],\n worldAxis: readonly [number, number, number] = [0, 1, 0],\n): RAPIER.ImpulseJoint {\n _nrmVec.set(worldAxis[0], worldAxis[1], worldAxis[2]);\n if (_nrmVec.lengthSq() < 1e-8)\n _nrmVec.set(0, 1, 0);\n else\n _nrmVec.normalize();\n\n const tA = bodyA.translation();\n const rA = bodyA.rotation();\n const tB = bodyB.translation();\n const rB = bodyB.rotation();\n\n _qA.set(rA.x, rA.y, rA.z, rA.w).normalize();\n _qB.set(rB.x, rB.y, rB.z, rB.w).normalize();\n _qInvA.copy(_qA).invert();\n _qInvB.copy(_qB).invert();\n\n _vA.set(worldAnchor[0] - tA.x, worldAnchor[1] - tA.y, worldAnchor[2] - tA.z).applyQuaternion(_qInvA);\n _vB.set(worldAnchor[0] - tB.x, worldAnchor[1] - tB.y, worldAnchor[2] - tB.z).applyQuaternion(_qInvB);\n _axLocal.copy(_nrmVec).applyQuaternion(_qInvA).normalize();\n\n // Ensure bodyB's local axis maps onto the same world hinge shaft so RevoluteImpulseJoint starts with zero swing error\n _axWorldB.copy(_axLocal).applyQuaternion(_qB).normalize();\n if (_axWorldB.dot(_nrmVec) < 1 - 1e-5 && bodyB.isDynamic()) {\n _alignQuat.setFromUnitVectors(_axWorldB, _nrmVec).multiply(_qB).normalize();\n const worldOffsetB = _axWorldB.copy(_vB).applyQuaternion(_alignQuat);\n bodyB.setRotation({ x: _alignQuat.x, y: _alignQuat.y, z: _alignQuat.z, w: _alignQuat.w }, true);\n bodyB.setTranslation(\n {\n x: worldAnchor[0] - worldOffsetB.x,\n y: worldAnchor[1] - worldOffsetB.y,\n z: worldAnchor[2] - worldOffsetB.z,\n },\n true,\n );\n }\n\n const data = rapier.JointData.revolute(\n { x: _vA.x, y: _vA.y, z: _vA.z },\n { x: _vB.x, y: _vB.y, z: _vB.z },\n { x: _axLocal.x, y: _axLocal.y, z: _axLocal.z },\n );\n const imp = world.createImpulseJoint(data, bodyA, bodyB, true);\n imp.setContactsEnabled(false);\n if (bodyA.isDynamic())\n bodyA.wakeUp();\n if (bodyB.isDynamic())\n bodyB.wakeUp();\n return imp;\n}\n\n/**\n * Toggles or breaks an articulated `@khr3/core` `JointRuntime`.\n */\nexport function rigJointRuntime(rt: JointRuntime, severBreakaway = false): string {\n if (rt.detached)\n return `${rt.nodeName} already detached`;\n if (severBreakaway) {\n const res = rt.applyImpactImpulse(Number.POSITIVE_INFINITY);\n if (res === \"detached\")\n return `Detached ${rt.nodeName}`;\n }\n if (rt.drive?.stiffness !== undefined) {\n const limits = rt.limits ?? [0, Math.PI / 2];\n const nextOpen = !isJointOpen(rt);\n const target = nextOpen ? openTargetForLimits(limits) : Math.min(limits[1], Math.max(limits[0], 0));\n rt.applyTarget(target);\n return `${nextOpen ? \"Opened\" : \"Closed\"} ${rt.nodeName}`;\n }\n const res = rt.applyImpactImpulse(Number.POSITIVE_INFINITY);\n return res === \"detached\" ? `Detached ${rt.nodeName}` : `Joint ${rt.nodeName} (${rt.kind})`;\n}\n\n/**\n * Computes the nearest exact `@khr3/c12` socket-snapped or ground-lattice `BuildSnapCandidate` for `kind`.\n */\nexport function computeBuildCandidate(\n placedPieces: readonly PlacedPiece[],\n aimPoint: readonly [number, number, number],\n kind: ToolgunBuildKind,\n yaw12: number,\n snapRadiusM = 2.6,\n): BuildSnapCandidate {\n const wantedSocketKind = socketFor(kind);\n const maxDistSq = snapRadiusM * snapRadiusM;\n let bestSocket: Socket | null = null;\n let bestDistSq = maxDistSq;\n\n for (const placed of placedPieces) {\n const socks = worldSockets(placed.kind, placed.pose);\n for (const s of socks) {\n if (kind === \"FoundationSquare\" || kind === \"FoundationTriangle\") {\n if (s.kind !== \"edge\")\n continue;\n }\n else if (s.kind !== wantedSocketKind) {\n continue;\n }\n const flt = poseToFloat({ pos: s.mid, yaw: s.yaw });\n const dx = flt.position[0] - aimPoint[0];\n const dy = flt.position[1] - aimPoint[1];\n const dz = flt.position[2] - aimPoint[2];\n const dSq = dx * dx + dy * dy + dz * dz;\n if (dSq < bestDistSq) {\n const testOwn = kind === \"Stairs\" ? Math.floor(wrapYaw(yaw12) / 3) : wrapYaw(yaw12);\n const candidatePose = snapPose(kind, s, testOwn);\n if (canPlace(placedPieces, kind, candidatePose).ok) {\n bestDistSq = dSq;\n bestSocket = s;\n }\n }\n }\n }\n\n let pose: PiecePose;\n let snappedSocket = false;\n if (bestSocket) {\n const own = kind === \"Stairs\" ? Math.floor(wrapYaw(yaw12) / 3) : wrapYaw(yaw12);\n pose = snapPose(kind, bestSocket, own);\n snappedSocket = true;\n }\n else {\n const xSteps = Math.round(aimPoint[0] / STEP_METRES);\n const ySteps = Math.max(0, Math.round(aimPoint[1] / STEP_METRES));\n const zSteps = Math.round(aimPoint[2] / STEP_METRES);\n pose = latticePose(xSteps, zSteps, wrapYaw(yaw12), ySteps);\n }\n\n const check = canPlace(placedPieces, kind, pose);\n const flt = poseToFloat(pose);\n return {\n kind,\n pose,\n position: flt.position,\n quaternion: flt.quaternion,\n snappedSocket,\n valid: check.ok,\n reason: check.reason,\n };\n}\n\nexport interface ToolgunStoreState {\n readonly mode: ToolgunMode;\n readonly skinPreset: ToolgunSkinPreset;\n readonly yaw12: number;\n readonly buildKind: ToolgunBuildKind;\n readonly zoomed: boolean;\n readonly armedAsset: ArmedToolgunAsset | null;\n readonly target: ToolgunRayHit | null;\n readonly buildPreview: BuildSnapCandidate | null;\n readonly pendingAnchor: PendingJointAnchor | null;\n readonly spawnedEntities: readonly SpawnedToolgunEntity[];\n readonly placedPieces: readonly PlacedPiece[];\n readonly createdJoints: readonly CreatedToolgunJoint[];\n readonly history: readonly ToolgunHistoryEntry[];\n readonly statusText: string;\n readonly fireCount: number;\n\n setMode: (mode: ToolgunMode) => void;\n cycleMode: (delta?: number) => void;\n setSkinPreset: (preset: ToolgunSkinPreset) => void;\n rotateYaw12: (stepsDelta?: number) => void;\n setBuildKind: (kind: ToolgunBuildKind) => void;\n cycleBuildKind: (delta?: number) => void;\n setZoomed: (zoomed: boolean) => void;\n armAsset: (asset: ArmedToolgunAsset | null) => void;\n setTarget: (hit: ToolgunRayHit | null) => void;\n setBuildPreview: (candidate: BuildSnapCandidate | null) => void;\n setPendingAnchor: (anchor: PendingJointAnchor | null) => void;\n recordSpawn: (entry: SpawnedToolgunEntity) => void;\n placeBuildPiece: (candidate: BuildSnapCandidate) => PlacedPiece | null;\n recordJoint: (entry: CreatedToolgunJoint) => void;\n removeEntityById: (id: string) => boolean;\n removePieceById: (id: string) => boolean;\n removeJointByBody: (world: RAPIER.World, body: RAPIER.RigidBody) => number;\n undoLast: (world?: RAPIER.World | null) => string;\n bumpFire: (status: string) => void;\n resetAll: (world?: RAPIER.World | null) => void;\n}\n\nlet nextSeq = 1;\n\nexport function createToolgunStore(): UseBoundStore<StoreApi<ToolgunStoreState>> {\n return create<ToolgunStoreState>((set, get) => ({\n mode: \"spawn\",\n skinPreset: \"cobalt\",\n yaw12: 0,\n buildKind: \"FoundationSquare\",\n zoomed: false,\n armedAsset: null,\n target: null,\n buildPreview: null,\n pendingAnchor: null,\n spawnedEntities: [],\n placedPieces: [],\n createdJoints: [],\n history: [],\n statusText: \"READY\",\n fireCount: 0,\n\n setMode: (mode) => set({ mode, pendingAnchor: null, statusText: `MODE: ${mode.toUpperCase()}` }),\n cycleMode: (delta = 1) => {\n const idx = TOOLGUN_MODES.indexOf(get().mode);\n const next = TOOLGUN_MODES[((idx + delta) % TOOLGUN_MODES.length + TOOLGUN_MODES.length) % TOOLGUN_MODES.length];\n set({ mode: next, pendingAnchor: null, statusText: `MODE: ${next.toUpperCase()}` });\n },\n setSkinPreset: (skinPreset) => set({ skinPreset }),\n rotateYaw12: (stepsDelta = 1) => {\n const nextYaw = wrapYaw(get().yaw12 + stepsDelta);\n set({ yaw12: nextYaw, statusText: `YAW: ${nextYaw * 30}°` });\n },\n setBuildKind: (buildKind) => set({ buildKind, mode: \"build\", statusText: `BUILD: ${buildKind}` }),\n cycleBuildKind: (delta = 1) => {\n const idx = TOOLGUN_BUILD_KINDS.indexOf(get().buildKind);\n const next = TOOLGUN_BUILD_KINDS[((idx + delta) % TOOLGUN_BUILD_KINDS.length + TOOLGUN_BUILD_KINDS.length) % TOOLGUN_BUILD_KINDS.length];\n set({ buildKind: next, statusText: `BUILD: ${next}` });\n },\n setZoomed: (zoomed) => set({ zoomed }),\n armAsset: (armedAsset) => set({\n armedAsset,\n ...(armedAsset ? { statusText: `ARMED: ${armedAsset.name}` } : {}),\n }),\n setTarget: (target) => set({ target }),\n setBuildPreview: (buildPreview) => set({ buildPreview }),\n setPendingAnchor: (pendingAnchor) => set({ pendingAnchor }),\n\n recordSpawn: (entry) => set((s) => ({\n spawnedEntities: [...s.spawnedEntities, entry],\n history: [...s.history, { type: \"spawn\", id: entry.id }],\n statusText: `SPAWNED ${entry.name}`,\n fireCount: s.fireCount + 1,\n })),\n\n placeBuildPiece: (candidate) => {\n const st = get();\n const check = canPlace(st.placedPieces, candidate.kind, candidate.pose);\n if (!check.ok) {\n set({ statusText: check.reason.toUpperCase(), fireCount: st.fireCount + 1 });\n return null;\n }\n const piece: PlacedPiece = {\n id: `c12_${nextSeq++}`,\n kind: candidate.kind,\n pose: candidate.pose,\n };\n set((s) => ({\n placedPieces: [...s.placedPieces, piece],\n history: [...s.history, { type: \"piece\", id: piece.id }],\n statusText: `PLACED ${piece.kind}`,\n fireCount: s.fireCount + 1,\n }));\n return piece;\n },\n\n recordJoint: (entry) => set((s) => ({\n createdJoints: [...s.createdJoints, entry],\n history: [...s.history, { type: \"joint\", id: entry.id }],\n pendingAnchor: null,\n statusText: `${entry.kind === \"weld\" ? \"WELDED\" : \"HINGED\"} #${entry.handle}`,\n fireCount: s.fireCount + 1,\n })),\n\n removeEntityById: (id) => {\n const before = get().spawnedEntities;\n if (!before.some((e) => e.id === id))\n return false;\n set((s) => ({\n spawnedEntities: s.spawnedEntities.filter((e) => e.id !== id),\n history: s.history.filter((h) => !(h.type === \"spawn\" && h.id === id)),\n statusText: `DELETED ${id}`,\n fireCount: s.fireCount + 1,\n }));\n return true;\n },\n\n removePieceById: (id) => {\n const before = get().placedPieces;\n if (!before.some((p) => p.id === id))\n return false;\n set((s) => ({\n placedPieces: s.placedPieces.filter((p) => p.id !== id),\n history: s.history.filter((h) => !(h.type === \"piece\" && h.id === id)),\n statusText: `REMOVED ${id}`,\n fireCount: s.fireCount + 1,\n }));\n return true;\n },\n\n removeJointByBody: (world, body) => {\n const keep: CreatedToolgunJoint[] = [];\n const removedIds = new Set<string>();\n for (const cj of get().createdJoints) {\n const live = world.getImpulseJoint(cj.joint.handle);\n if (!live) {\n removedIds.add(cj.id);\n continue;\n }\n if (live.body1().handle === body.handle || live.body2().handle === body.handle) {\n world.removeImpulseJoint(live, true);\n removedIds.add(cj.id);\n }\n else {\n keep.push(cj);\n }\n }\n if (removedIds.size > 0) {\n set((s) => ({\n createdJoints: keep,\n history: s.history.filter((h) => !(h.type === \"joint\" && removedIds.has(h.id))),\n statusText: `UNWELDED (${removedIds.size})`,\n fireCount: s.fireCount + 1,\n }));\n }\n return removedIds.size;\n },\n\n undoLast: (world) => {\n const st = get();\n const last = st.history[st.history.length - 1];\n if (!last)\n return \"NOTHING TO UNDO\";\n const nextHistory = st.history.slice(0, -1);\n if (last.type === \"spawn\") {\n set({\n spawnedEntities: st.spawnedEntities.filter((e) => e.id !== last.id),\n history: nextHistory,\n statusText: `UNDO SPAWN ${last.id}`,\n });\n return `UNDO SPAWN ${last.id}`;\n }\n if (last.type === \"piece\") {\n set({\n placedPieces: st.placedPieces.filter((p) => p.id !== last.id),\n history: nextHistory,\n statusText: `UNDO PIECE ${last.id}`,\n });\n return `UNDO PIECE ${last.id}`;\n }\n const jEntry = st.createdJoints.find((j) => j.id === last.id);\n if (jEntry && world && world.getImpulseJoint(jEntry.joint.handle)) {\n world.removeImpulseJoint(jEntry.joint, true);\n }\n set({\n createdJoints: st.createdJoints.filter((j) => j.id !== last.id),\n history: nextHistory,\n statusText: `UNDO JOINT ${last.id}`,\n });\n return `UNDO JOINT ${last.id}`;\n },\n\n bumpFire: (statusText) => set((s) => ({ statusText, fireCount: s.fireCount + 1 })),\n\n resetAll: (world) => {\n if (world) {\n for (const cj of get().createdJoints) {\n if (world.getImpulseJoint(cj.joint.handle))\n world.removeImpulseJoint(cj.joint, true);\n }\n }\n set({\n pendingAnchor: null,\n spawnedEntities: [],\n placedPieces: [],\n createdJoints: [],\n history: [],\n statusText: \"CLEARED\",\n });\n },\n }));\n}\n\nexport const useToolgunStore = createToolgunStore();\n","import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef } from \"react\";\nimport * as THREE from \"three\";\nimport { createPortal, useFrame, useThree } from \"@react-three/fiber\";\nimport { ConvexHullCollider, CuboidCollider, RigidBody, useRapier } from \"@react-three/rapier\";\nimport type RAPIER from \"@dimforge/rapier3d-compat\";\nimport { easing } from \"maath\";\nimport type { EcctrlHandle } from \"@pinkaphant/ecctrl\";\nimport { JointRegistryContext, cloneKhrBundle, useKhrGlb, type JointRuntime, type KhrAssetBundle } from \"@khr3/core\";\nimport { DOOR_HINGE_SPEC, SIDE_METRES, STOREY_METRES, poseToFloat, triangleCorners, type PlacedPiece } from \"@khr3/c12\";\nimport { ActorTrait, PilotedTag, VehicleTrait, pilotedVehicleQuery, useActiveKolmoWorld } from \"../engine/traits.js\";\nimport { KolmoProp } from \"../engine/surface.js\";\nimport { KolmoVehicle } from \"../engine/vehicle.js\";\nimport {\n TOOLGUN_MODES,\n TOOLGUN_SKIN_PRESETS,\n castToolgunRay,\n computeAlignedSpawnPose,\n computeBuildCandidate,\n createHingeImpulseJoint,\n createWeldImpulseJoint,\n rigJointRuntime,\n useToolgunStore,\n type ArmedToolgunAsset,\n type BuildSnapCandidate,\n type ToolgunActionOutcome,\n type ToolgunMode,\n type ToolgunSkinPreset,\n} from \"./store.js\";\n\nconst LCD_W = 256;\nconst LCD_H = 192;\nconst WALL_THICK = 0.2;\nconst SLAB_THICK = 0.2;\n\nexport interface MeasuredToolgunViewmodel {\n readonly scene: THREE.Object3D;\n readonly gripOffset: [number, number, number];\n readonly muzzleLocal: [number, number, number];\n readonly screenPos: [number, number, number];\n readonly screenQuat: [number, number, number, number];\n readonly screenSize: [number, number];\n}\n\nexport function measureToolgunViewmodel(sourceScene: THREE.Object3D): MeasuredToolgunViewmodel {\n const cloned = sourceScene.clone(true);\n cloned.updateMatrixWorld(true);\n const invRoot = cloned.matrixWorld.clone().invert();\n let grip: [number, number, number] = [0, 0, 0];\n let muzzle: [number, number, number] = [0, 0.04, -0.24];\n let screenPos: [number, number, number] = [0, 0.068, 0.095];\n let screenQuat: [number, number, number, number] = [0, 0, 0, 1];\n let screenSize: [number, number] = [0.068, 0.051];\n const tmpPos = new THREE.Vector3();\n const tmpQuat = new THREE.Quaternion();\n\n cloned.traverse((node) => {\n const low = node.name.toLowerCase();\n if (low === \"ik_palm_primary\" || low === \"grip\" || low === \"socket_grip\") {\n node.getWorldPosition(tmpPos).applyMatrix4(invRoot);\n grip = [-tmpPos.x, -tmpPos.y, -tmpPos.z];\n }\n else if (low === \"socket_muzzle\" || low === \"muzzle\") {\n node.getWorldPosition(tmpPos).applyMatrix4(invRoot);\n muzzle = [tmpPos.x, tmpPos.y, tmpPos.z];\n }\n else if (low === \"screen_rect\" || low === \"lcd_screen\") {\n node.getWorldPosition(tmpPos).applyMatrix4(invRoot);\n node.getWorldQuaternion(tmpQuat);\n screenPos = [tmpPos.x, tmpPos.y, tmpPos.z + 0.001];\n screenQuat = [tmpQuat.x, tmpQuat.y, tmpQuat.z, tmpQuat.w];\n const mesh = node as THREE.Mesh;\n if (mesh.isMesh && mesh.geometry) {\n mesh.geometry.computeBoundingBox();\n const bb = mesh.geometry.boundingBox;\n if (bb) {\n const sz = bb.getSize(new THREE.Vector3());\n screenSize = [Math.max(0.025, sz.x), Math.max(0.02, sz.y)];\n }\n }\n }\n });\n\n return { scene: cloned, gripOffset: grip, muzzleLocal: muzzle, screenPos, screenQuat, screenSize };\n}\n\ninterface LcdSurface {\n readonly texture: THREE.CanvasTexture | null;\n draw: (state: {\n mode: ToolgunMode;\n yawDeg: number;\n detail: string;\n targetLabel: string;\n status: string;\n accentHex: string;\n }) => void;\n dispose: () => void;\n}\n\nfunction createLcdSurface(): LcdSurface {\n if (typeof document === \"undefined\") {\n return { texture: null, draw: () => {}, dispose: () => {} };\n }\n const canvas = document.createElement(\"canvas\");\n canvas.width = LCD_W;\n canvas.height = LCD_H;\n const ctx = canvas.getContext(\"2d\");\n const texture = new THREE.CanvasTexture(canvas);\n texture.colorSpace = THREE.SRGBColorSpace;\n texture.minFilter = THREE.LinearFilter;\n texture.magFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n\n let prevSig = \"\";\n return {\n texture,\n draw: ({ mode, yawDeg, detail, targetLabel, status, accentHex }) => {\n if (!ctx)\n return;\n const sig = `${mode}|${yawDeg}|${detail}|${targetLabel}|${status}|${accentHex}`;\n if (sig === prevSig)\n return;\n prevSig = sig;\n\n ctx.fillStyle = \"#070d19\";\n ctx.fillRect(0, 0, LCD_W, LCD_H);\n\n ctx.strokeStyle = accentHex;\n ctx.lineWidth = 3;\n ctx.strokeRect(4, 4, LCD_W - 8, LCD_H - 8);\n\n ctx.fillStyle = accentHex;\n ctx.fillRect(4, 4, LCD_W - 8, 28);\n ctx.fillStyle = \"#040812\";\n ctx.font = \"bold 15px ui-monospace, SFMono-Regular, Menlo, monospace\";\n ctx.fillText(`KOLMO // ${mode.toUpperCase()}`, 12, 23);\n ctx.textAlign = \"right\";\n ctx.fillText(`${yawDeg}°`, LCD_W - 12, 23);\n ctx.textAlign = \"left\";\n\n ctx.fillStyle = \"#e2e8f0\";\n ctx.font = \"bold 13px ui-monospace, SFMono-Regular, Menlo, monospace\";\n ctx.fillText(detail.slice(0, 26), 12, 58);\n\n ctx.fillStyle = \"#7dd3fc\";\n ctx.font = \"12px ui-monospace, SFMono-Regular, Menlo, monospace\";\n ctx.fillText(targetLabel.slice(0, 28), 12, 86);\n\n ctx.strokeStyle = \"rgba(148, 163, 184, 0.28)\";\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(12, 106);\n ctx.lineTo(LCD_W - 12, 106);\n ctx.stroke();\n\n ctx.fillStyle = \"#34d399\";\n ctx.font = \"bold 12px ui-monospace, SFMono-Regular, Menlo, monospace\";\n ctx.fillText(status.slice(0, 28), 12, 130);\n\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = \"10px ui-monospace, SFMono-Regular, Menlo, monospace\";\n ctx.fillText(\"[1-6/Q] MODE [R] +30° [Z] UNDO\", 12, 160);\n ctx.fillText(\"[LMB] FIRE [RMB] ZOOM [[/]] C12\", 12, 176);\n\n texture.needsUpdate = true;\n },\n dispose: () => {\n texture.dispose();\n },\n };\n}\n\nfunction createTriangleExtrudedGeometry(thicknessM: number): THREE.BufferGeometry {\n const corners = triangleCorners();\n const y0 = 0;\n const y1 = thicknessM;\n const positions: number[] = [];\n const pushTri = (a: [number, number, number], b: [number, number, number], c: [number, number, number]) => {\n positions.push(a[0], a[1], a[2], b[0], b[1], b[2], c[0], c[1], c[2]);\n };\n const bot: [number, number, number][] = corners.map(([x, , z]) => [x, y0, z]);\n const top: [number, number, number][] = corners.map(([x, , z]) => [x, y1, z]);\n // Top & bottom faces (CCW seen from outside)\n pushTri(top[0], top[1], top[2]);\n pushTri(bot[0], bot[2], bot[1]);\n for (let i = 0; i < 3; i++) {\n const j = (i + 1) % 3;\n pushTri(bot[i], bot[j], top[j]);\n pushTri(bot[i], top[j], top[i]);\n }\n const geo = new THREE.BufferGeometry();\n geo.setAttribute(\"position\", new THREE.Float32BufferAttribute(positions, 3));\n geo.computeVertexNormals();\n return geo;\n}\n\nfunction buildTriangleHullVertices(thicknessM: number): Float32Array {\n const corners = triangleCorners();\n const verts: number[] = [];\n for (const [x, , z] of corners) {\n verts.push(x, 0, z, x, thicknessM, z);\n }\n return new Float32Array(verts);\n}\n\nfunction C12PieceColliderAndMesh({ piece }: { piece: PlacedPiece }): React.JSX.Element {\n const flt = useMemo(() => poseToFloat(piece.pose), [piece.pose]);\n const userData = useMemo(() => ({ kolmoPlacedPieceId: piece.id, name: piece.kind }), [piece.id, piece.kind]);\n const triGeo = useMemo(\n () => (piece.kind === \"FoundationTriangle\" || piece.kind === \"FloorTriangle\" || piece.kind === \"RoofTriangle\"\n ? createTriangleExtrudedGeometry(SLAB_THICK)\n : null),\n [piece.kind],\n );\n const triVerts = useMemo(\n () => (triGeo ? buildTriangleHullVertices(SLAB_THICK) : null),\n [triGeo],\n );\n useEffect(() => () => triGeo?.dispose(), [triGeo]);\n\n if (piece.kind === \"FoundationSquare\" || piece.kind === \"Floor\" || piece.kind === \"Roof\" || piece.kind === \"Street\") {\n const yOff = piece.kind === \"FoundationSquare\" || piece.kind === \"Street\" ? SLAB_THICK * 0.5 : -SLAB_THICK * 0.5;\n const color = piece.kind === \"Roof\" ? \"#475569\" : piece.kind === \"Street\" ? \"#334155\" : \"#64748b\";\n return (\n <RigidBody type=\"fixed\" colliders={false} position={flt.position} quaternion={flt.quaternion} friction={0.6} restitution={0.1} userData={userData}>\n <CuboidCollider args={[SIDE_METRES * 0.5, SLAB_THICK * 0.5, SIDE_METRES * 0.5]} position={[0, yOff, 0]} />\n <mesh position={[0, yOff, 0]} castShadow receiveShadow>\n <boxGeometry args={[SIDE_METRES, SLAB_THICK, SIDE_METRES]} />\n <meshStandardMaterial color={color} roughness={0.82} metalness={0.08} />\n </mesh>\n </RigidBody>\n );\n }\n\n if (triGeo && triVerts) {\n return (\n <RigidBody type=\"fixed\" colliders={false} position={flt.position} quaternion={flt.quaternion} friction={0.6} restitution={0.1} userData={userData}>\n <ConvexHullCollider args={[triVerts]} />\n <mesh geometry={triGeo} castShadow receiveShadow>\n <meshStandardMaterial color=\"#64748b\" roughness={0.82} metalness={0.08} />\n </mesh>\n </RigidBody>\n );\n }\n\n if (piece.kind === \"Wall\") {\n return (\n <RigidBody type=\"fixed\" colliders={false} position={flt.position} quaternion={flt.quaternion} friction={0.6} restitution={0.1} userData={userData}>\n <CuboidCollider args={[SIDE_METRES * 0.5, STOREY_METRES * 0.5, WALL_THICK * 0.5]} position={[0, STOREY_METRES * 0.5, 0]} />\n <mesh position={[0, STOREY_METRES * 0.5, 0]} castShadow receiveShadow>\n <boxGeometry args={[SIDE_METRES, STOREY_METRES, WALL_THICK]} />\n <meshStandardMaterial color=\"#94a3b8\" roughness={0.78} metalness={0.06} />\n </mesh>\n </RigidBody>\n );\n }\n\n if (piece.kind === \"Doorway\") {\n const openW = DOOR_HINGE_SPEC.openingWidthM;\n const openH = DOOR_HINGE_SPEC.openingHeightM;\n const jambW = (SIDE_METRES - openW) * 0.5;\n const lintelH = STOREY_METRES - openH;\n const jambX = openW * 0.5 + jambW * 0.5;\n return (\n <RigidBody type=\"fixed\" colliders={false} position={flt.position} quaternion={flt.quaternion} friction={0.6} restitution={0.1} userData={userData}>\n <CuboidCollider args={[jambW * 0.5, openH * 0.5, WALL_THICK * 0.5]} position={[-jambX, openH * 0.5, 0]} />\n <CuboidCollider args={[jambW * 0.5, openH * 0.5, WALL_THICK * 0.5]} position={[jambX, openH * 0.5, 0]} />\n <CuboidCollider args={[SIDE_METRES * 0.5, lintelH * 0.5, WALL_THICK * 0.5]} position={[0, openH + lintelH * 0.5, 0]} />\n <mesh position={[-jambX, openH * 0.5, 0]} castShadow receiveShadow>\n <boxGeometry args={[jambW, openH, WALL_THICK]} />\n <meshStandardMaterial color=\"#94a3b8\" roughness={0.78} />\n </mesh>\n <mesh position={[jambX, openH * 0.5, 0]} castShadow receiveShadow>\n <boxGeometry args={[jambW, openH, WALL_THICK]} />\n <meshStandardMaterial color=\"#94a3b8\" roughness={0.78} />\n </mesh>\n <mesh position={[0, openH + lintelH * 0.5, 0]} castShadow receiveShadow>\n <boxGeometry args={[SIDE_METRES, lintelH, WALL_THICK]} />\n <meshStandardMaterial color=\"#94a3b8\" roughness={0.78} />\n </mesh>\n </RigidBody>\n );\n }\n\n // Stairs (sloped walkable ramp spanning 3m x 3m rising 3m)\n const rampLen = Math.hypot(SIDE_METRES, STOREY_METRES);\n const rampPitch = -Math.atan2(STOREY_METRES, SIDE_METRES);\n return (\n <RigidBody type=\"fixed\" colliders={false} position={flt.position} quaternion={flt.quaternion} friction={0.85} restitution={0.05} userData={userData}>\n <CuboidCollider\n args={[SIDE_METRES * 0.45, SLAB_THICK * 0.5, rampLen * 0.5]}\n position={[0, STOREY_METRES * 0.5, 0]}\n rotation={[rampPitch, 0, 0]}\n />\n <mesh position={[0, STOREY_METRES * 0.5, 0]} rotation={[rampPitch, 0, 0]} castShadow receiveShadow>\n <boxGeometry args={[SIDE_METRES * 0.9, SLAB_THICK, rampLen]} />\n <meshStandardMaterial color=\"#cbd5e1\" roughness={0.75} />\n </mesh>\n </RigidBody>\n );\n}\n\nfunction BuildGhostPreview({ candidate }: { candidate: BuildSnapCandidate }): React.JSX.Element {\n const color = candidate.valid ? \"#34d399\" : \"#ef4444\";\n const isSlab = candidate.kind === \"FoundationSquare\" || candidate.kind === \"Floor\" || candidate.kind === \"Roof\";\n const isTri = candidate.kind === \"FoundationTriangle\" || candidate.kind === \"FloorTriangle\" || candidate.kind === \"RoofTriangle\";\n const triGeo = useMemo(() => (isTri ? createTriangleExtrudedGeometry(SLAB_THICK) : null), [isTri]);\n useEffect(() => () => triGeo?.dispose(), [triGeo]);\n\n const dims: [number, number, number] = isSlab\n ? [SIDE_METRES, SLAB_THICK, SIDE_METRES]\n : candidate.kind === \"Stairs\"\n ? [SIDE_METRES * 0.9, STOREY_METRES, SIDE_METRES]\n : [SIDE_METRES, STOREY_METRES, WALL_THICK];\n const yCenter = isSlab ? SLAB_THICK * 0.5 : STOREY_METRES * 0.5;\n\n return (\n <group position={candidate.position} quaternion={candidate.quaternion}>\n {triGeo ? (\n <mesh geometry={triGeo}>\n <meshBasicMaterial color={color} transparent opacity={0.36} depthWrite={false} />\n </mesh>\n ) : (\n <mesh position={[0, yCenter, 0]}>\n <boxGeometry args={dims} />\n <meshBasicMaterial color={color} transparent opacity={0.36} depthWrite={false} />\n </mesh>\n )}\n </group>\n );\n}\n\nfunction ProceduralToolgunBody({\n skinPreset,\n lcdTexture,\n}: {\n skinPreset: ToolgunSkinPreset;\n lcdTexture: THREE.CanvasTexture | null;\n}): React.JSX.Element {\n const skin = TOOLGUN_SKIN_PRESETS[skinPreset];\n return (\n <group>\n {/* Receiver */}\n <mesh position={[0, 0.032, -0.04]} castShadow>\n <boxGeometry args={[0.056, 0.062, 0.22]} />\n <meshStandardMaterial color={skin.bodyHex} metalness={skin.metalness} roughness={skin.roughness} />\n </mesh>\n {/* Barrel emitter */}\n <mesh position={[0, 0.038, -0.2]} rotation={[Math.PI / 2, 0, 0]} castShadow>\n <cylinderGeometry args={[0.014, 0.018, 0.14, 12]} />\n <meshStandardMaterial color={skin.accentHex} emissive={skin.emissiveHex} emissiveIntensity={0.6} metalness={0.8} roughness={0.2} />\n </mesh>\n {/* Grip */}\n <mesh position={[0, -0.042, 0.03]} rotation={[0.24, 0, 0]} castShadow>\n <boxGeometry args={[0.042, 0.11, 0.048]} />\n <meshStandardMaterial color=\"#0f172a\" roughness={0.75} metalness={0.2} />\n </mesh>\n {/* Back bezel LCD screen */}\n <mesh position={[0, 0.052, 0.072]}>\n <planeGeometry args={[0.064, 0.048]} />\n <meshBasicMaterial\n {...(lcdTexture ? { map: lcdTexture } : { color: skin.accentHex })}\n toneMapped={false}\n />\n </mesh>\n </group>\n );\n}\n\nexport interface KolmoToolgunHandle {\n fire: (shiftKey?: boolean) => ToolgunActionOutcome;\n undo: () => string;\n}\n\nexport interface KolmoToolgunProps {\n readonly ref?: React.Ref<KolmoToolgunHandle>;\n readonly src?: string;\n readonly bundle?: KhrAssetBundle | null;\n readonly actorRef?: React.RefObject<EcctrlHandle | null>;\n readonly skinPreset?: ToolgunSkinPreset;\n readonly defaultArmedAsset?: ArmedToolgunAsset | null;\n readonly maxRangeM?: number;\n readonly hipOffset?: readonly [number, number, number];\n readonly zoomOffset?: readonly [number, number, number];\n readonly enableShortcuts?: boolean;\n readonly mountWorldOutlets?: boolean;\n readonly enable?: boolean;\n}\n\nconst _camPos = new THREE.Vector3();\nconst _camDir = new THREE.Vector3();\nconst _muzzleWorld = new THREE.Vector3();\nconst _beamEndVec = new THREE.Vector3();\nconst _targetOffset = new THREE.Vector3();\n\nfunction ToolgunCore({\n ref,\n viewmodelBundle,\n actorRef,\n skinPreset: skinProp,\n defaultArmedAsset,\n maxRangeM = 75,\n hipOffset = [0.24, -0.21, -0.42],\n zoomOffset = [0, -0.055, -0.22],\n enableShortcuts = true,\n mountWorldOutlets = true,\n enable = true,\n}: Omit<KolmoToolgunProps, \"src\" | \"bundle\"> & { viewmodelBundle: KhrAssetBundle | null }): React.JSX.Element | null {\n const { rapier, world: rapierWorld } = useRapier();\n const camera = useThree((s) => s.camera);\n const gl = useThree((s) => s.gl);\n const kootaWorld = useActiveKolmoWorld();\n const jointRegistry = useContext(JointRegistryContext);\n\n const mode = useToolgunStore((s) => s.mode);\n const storeSkin = useToolgunStore((s) => s.skinPreset);\n const buildPreview = useToolgunStore((s) => s.buildPreview);\n const spawnedEntities = useToolgunStore((s) => s.spawnedEntities);\n const placedPieces = useToolgunStore((s) => s.placedPieces);\n\n const effSkin = skinProp ?? storeSkin;\n\n useEffect(() => {\n if (defaultArmedAsset && !useToolgunStore.getState().armedAsset) {\n useToolgunStore.getState().armAsset(defaultArmedAsset);\n }\n }, [defaultArmedAsset]);\n\n const measured = useMemo(\n () => (viewmodelBundle ? measureToolgunViewmodel(viewmodelBundle.scene) : null),\n [viewmodelBundle],\n );\n const lcd = useMemo(createLcdSurface, []);\n useEffect(() => () => lcd.dispose(), [lcd]);\n\n const holderRef = useRef<THREE.Group | null>(null);\n const recoilRef = useRef(0);\n const beamTimerRef = useRef(0);\n const beamMatRef = useRef<THREE.LineBasicMaterial | null>(null);\n const beamGeo = useMemo(() => {\n const g = new THREE.BufferGeometry();\n g.setAttribute(\"position\", new THREE.Float32BufferAttribute([0, 0, 0, 0, 0, -1], 3));\n return g;\n }, []);\n const beamLine = useMemo(() => {\n const mat = new THREE.LineBasicMaterial({ color: \"#38bdf8\", transparent: true, opacity: 0, depthTest: false });\n beamMatRef.current = mat;\n const line = new THREE.Line(beamGeo, mat);\n line.frustumCulled = false;\n line.visible = false;\n return line;\n }, [beamGeo]);\n useEffect(() => () => {\n beamGeo.dispose();\n beamMatRef.current?.dispose();\n }, [beamGeo]);\n\n const resolvePlayerBody = useCallback((): RAPIER.RigidBody | null => {\n if (actorRef?.current?.body)\n return actorRef.current.body;\n const pilot = kootaWorld.queryFirst(ActorTrait);\n return pilot?.get(ActorTrait)?.handle?.body ?? null;\n }, [actorRef, kootaWorld]);\n\n const findJointForBody = useCallback((body: RAPIER.RigidBody | null): JointRuntime | null => {\n if (!body || !jointRegistry)\n return null;\n for (const rt of jointRegistry) {\n if (!rt.detached && rt.childBody?.handle === body.handle)\n return rt;\n }\n return null;\n }, [jointRegistry]);\n\n const fire = useCallback((shiftKey = false): ToolgunActionOutcome => {\n camera.getWorldPosition(_camPos);\n camera.getWorldDirection(_camDir);\n const st = useToolgunStore.getState();\n const playerBody = resolvePlayerBody();\n const rawHit = castToolgunRay(\n rapier,\n rapierWorld,\n [_camPos.x, _camPos.y, _camPos.z],\n [_camDir.x, _camDir.y, _camDir.z],\n maxRangeM,\n playerBody,\n );\n\n let fallbackPoint: [number, number, number] = [\n _camPos.x + _camDir.x * 5,\n Math.max(0, _camPos.y + _camDir.y * 5),\n _camPos.z + _camDir.z * 5,\n ];\n if (_camDir.y < -0.02 && _camPos.y > 0) {\n const tGround = -_camPos.y / _camDir.y;\n if (tGround > 0.1 && tGround <= maxRangeM) {\n fallbackPoint = [_camPos.x + _camDir.x * tGround, 0, _camPos.z + _camDir.z * tGround];\n }\n }\n const aimPoint = rawHit ? rawHit.point : fallbackPoint;\n const aimNormal: [number, number, number] = rawHit ? rawHit.normal : [0, 1, 0];\n\n recoilRef.current = 1;\n beamTimerRef.current = 0.09;\n _beamEndVec.set(aimPoint[0], aimPoint[1], aimPoint[2]);\n\n if (holderRef.current) {\n const mLocal = measured?.muzzleLocal ?? [0, 0.038, -0.26];\n _muzzleWorld.set(mLocal[0], mLocal[1], mLocal[2]).applyMatrix4(holderRef.current.matrixWorld);\n }\n else {\n _muzzleWorld.copy(_camPos).addScaledVector(_camDir, 0.35);\n }\n const posAttr = beamGeo.getAttribute(\"position\") as THREE.BufferAttribute;\n posAttr.setXYZ(0, _muzzleWorld.x, _muzzleWorld.y, _muzzleWorld.z);\n posAttr.setXYZ(1, _beamEndVec.x, _beamEndVec.y, _beamEndVec.z);\n posAttr.needsUpdate = true;\n beamLine.visible = true;\n\n if (st.mode === \"spawn\") {\n const asset = st.armedAsset;\n if (!asset || (!asset.bundle && !asset.src)) {\n st.bumpFire(\"NO ASSET ARMED\");\n return { ok: false, status: \"NO ASSET ARMED\", beamEnd: aimPoint };\n }\n const pose = computeAlignedSpawnPose(aimPoint, st.yaw12, aimNormal, 0.08);\n const isVehicle = asset.kind === \"vehicle\" || (\n asset.kind !== \"prop\" &&\n Boolean(asset.bundle && (asset.bundle.wheels.length > 0 || asset.bundle.propellers.length > 0))\n );\n const id = `tg_ent_${Date.now().toString(36)}_${st.fireCount}`;\n st.recordSpawn({\n id,\n name: asset.name,\n kind: isVehicle ? \"vehicle\" : \"prop\",\n ...(asset.src ? { src: asset.src } : {}),\n ...(asset.bundle ? { bundle: asset.bundle } : {}),\n fixed: Boolean(asset.fixed),\n position: pose.position,\n quaternion: pose.quaternion,\n });\n return { ok: true, status: `SPAWNED ${asset.name}`, beamEnd: aimPoint };\n }\n\n if (st.mode === \"build\") {\n const candidate = computeBuildCandidate(st.placedPieces, aimPoint, st.buildKind, st.yaw12);\n const placed = st.placeBuildPiece(candidate);\n return {\n ok: placed !== null,\n status: placed ? `PLACED ${placed.kind}` : candidate.reason.toUpperCase(),\n beamEnd: candidate.position,\n };\n }\n\n if (st.mode === \"rig\") {\n const hitJoint = findJointForBody(rawHit?.body ?? null);\n if (!hitJoint) {\n st.bumpFire(\"NO KHR JOINT HIT\");\n return { ok: false, status: \"NO KHR JOINT HIT\", beamEnd: aimPoint };\n }\n const status = rigJointRuntime(hitJoint, shiftKey);\n st.bumpFire(status.toUpperCase());\n return { ok: true, status, beamEnd: aimPoint };\n }\n\n if (st.mode === \"weld\" || st.mode === \"hinge\") {\n if (!rawHit?.body) {\n st.setPendingAnchor(null);\n st.bumpFire(\"MISS — CLEARED ANCHOR\");\n return { ok: false, status: \"MISS — CLEARED ANCHOR\", beamEnd: aimPoint };\n }\n const pending = st.pendingAnchor;\n if (!pending) {\n const ud = rawHit.body.userData as { name?: string } | undefined;\n const label = ud?.name ?? `body_${rawHit.body.handle}`;\n st.setPendingAnchor({\n body: rawHit.body,\n worldPoint: rawHit.point,\n worldNormal: rawHit.normal,\n label,\n });\n st.bumpFire(`LOCKED A: ${label}`);\n return { ok: true, status: `LOCKED A: ${label}`, beamEnd: aimPoint };\n }\n if (pending.body.handle === rawHit.body.handle) {\n st.setPendingAnchor(null);\n st.bumpFire(\"SAME BODY — CANCELLED\");\n return { ok: false, status: \"SAME BODY — CANCELLED\", beamEnd: aimPoint };\n }\n const anchorMid: [number, number, number] = [\n 0.5 * (pending.worldPoint[0] + rawHit.point[0]),\n 0.5 * (pending.worldPoint[1] + rawHit.point[1]),\n 0.5 * (pending.worldPoint[2] + rawHit.point[2]),\n ];\n const imp = st.mode === \"weld\"\n ? createWeldImpulseJoint(rapier, rapierWorld, pending.body, rawHit.body, anchorMid)\n : createHingeImpulseJoint(rapier, rapierWorld, pending.body, rawHit.body, anchorMid, pending.worldNormal);\n const id = `tg_${st.mode}_${imp.handle}`;\n st.recordJoint({\n id,\n kind: st.mode,\n handle: imp.handle,\n joint: imp,\n anchorWorld: anchorMid,\n });\n return { ok: true, status: `${st.mode.toUpperCase()} CREATED`, beamEnd: anchorMid };\n }\n\n // delete mode\n if (!rawHit) {\n st.bumpFire(\"NOTHING HIT\");\n return { ok: false, status: \"NOTHING HIT\", beamEnd: aimPoint };\n }\n const ud = (rawHit.body?.userData ?? {}) as { kolmoSpawnedId?: string; kolmoPlacedPieceId?: string };\n if (ud.kolmoPlacedPieceId && st.removePieceById(ud.kolmoPlacedPieceId)) {\n return { ok: true, status: `REMOVED ${ud.kolmoPlacedPieceId}`, beamEnd: aimPoint };\n }\n if (ud.kolmoSpawnedId && st.removeEntityById(ud.kolmoSpawnedId)) {\n return { ok: true, status: `DELETED ${ud.kolmoSpawnedId}`, beamEnd: aimPoint };\n }\n if (rawHit.body) {\n const removedJoints = st.removeJointByBody(rapierWorld, rawHit.body);\n if (removedJoints > 0)\n return { ok: true, status: `REMOVED ${removedJoints} JOINT(S)`, beamEnd: aimPoint };\n }\n st.bumpFire(\"STATIC WORLD TARGET\");\n return { ok: false, status: \"STATIC WORLD TARGET\", beamEnd: aimPoint };\n }, [camera, rapier, rapierWorld, maxRangeM, resolvePlayerBody, findJointForBody, measured, beamGeo, beamLine]);\n\n useImperativeHandle(ref, () => ({\n fire,\n undo: () => useToolgunStore.getState().undoLast(rapierWorld),\n }), [fire, rapierWorld]);\n\n useEffect(() => {\n if (!enable || !enableShortcuts || typeof window === \"undefined\")\n return;\n const isEditable = (el: Element | null): boolean => {\n if (!el)\n return false;\n const tag = (el as HTMLElement).tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\" || Boolean((el as HTMLElement).isContentEditable);\n };\n\n const onKeyDown = (e: KeyboardEvent): void => {\n if (isEditable(document.activeElement))\n return;\n // Suspend toolgun shortcuts while piloting a vehicle so [R] Flip / [Q] Roll never conflict\n if (kootaWorld.queryFirst(pilotedVehicleQuery))\n return;\n const st = useToolgunStore.getState();\n if (e.code >= \"Digit1\" && e.code <= \"Digit6\") {\n const idx = Number(e.code.slice(5)) - 1;\n if (TOOLGUN_MODES[idx])\n st.setMode(TOOLGUN_MODES[idx]);\n return;\n }\n if (e.code === \"KeyQ\" && !e.metaKey && !e.ctrlKey) {\n st.cycleMode(e.shiftKey ? -1 : 1);\n }\n else if (e.code === \"KeyR\" && !e.metaKey && !e.ctrlKey) {\n st.rotateYaw12(e.shiftKey ? -1 : 1);\n }\n else if (e.code === \"BracketLeft\") {\n st.cycleBuildKind(-1);\n }\n else if (e.code === \"BracketRight\") {\n st.cycleBuildKind(1);\n }\n else if (e.code === \"KeyZ\" && !e.metaKey && !e.ctrlKey) {\n st.undoLast(rapierWorld);\n }\n else if (e.code === \"Tab\") {\n e.preventDefault();\n st.setZoomed(!st.zoomed);\n }\n };\n\n const dom = gl?.domElement;\n let downPos: [number, number] | null = null;\n const onPointerDown = (e: PointerEvent): void => {\n if (kootaWorld.queryFirst(pilotedVehicleQuery))\n return;\n if (e.button === 2) {\n useToolgunStore.getState().setZoomed(true);\n }\n else if (e.button === 0) {\n downPos = [e.clientX, e.clientY];\n }\n };\n const onPointerUp = (e: PointerEvent): void => {\n if (e.button === 2) {\n useToolgunStore.getState().setZoomed(false);\n return;\n }\n if (e.button === 0 && downPos && !kootaWorld.queryFirst(pilotedVehicleQuery)) {\n const moved = Math.hypot(e.clientX - downPos[0], e.clientY - downPos[1]);\n downPos = null;\n if (moved <= 6)\n fire(e.shiftKey);\n }\n };\n const onContextMenu = (e: MouseEvent): void => {\n if (!kootaWorld.queryFirst(pilotedVehicleQuery))\n e.preventDefault();\n };\n\n window.addEventListener(\"keydown\", onKeyDown);\n dom?.addEventListener(\"pointerdown\", onPointerDown);\n window.addEventListener(\"pointerup\", onPointerUp);\n dom?.addEventListener(\"contextmenu\", onContextMenu);\n return () => {\n window.removeEventListener(\"keydown\", onKeyDown);\n dom?.removeEventListener(\"pointerdown\", onPointerDown);\n window.removeEventListener(\"pointerup\", onPointerUp);\n dom?.removeEventListener(\"contextmenu\", onContextMenu);\n };\n }, [enable, enableShortcuts, gl, kootaWorld, rapierWorld, fire]);\n\n useFrame((_, delta) => {\n const dt = Math.min(Math.max(delta, 1e-4), 1 / 20);\n const piloted = Boolean(kootaWorld.queryFirst(pilotedVehicleQuery));\n const holder = holderRef.current;\n if (holder) {\n holder.visible = enable && !piloted;\n }\n if (!enable || piloted) {\n beamLine.visible = false;\n return;\n }\n\n const st = useToolgunStore.getState();\n if (recoilRef.current > 0)\n recoilRef.current = Math.max(0, recoilRef.current - dt * 7.5);\n if (beamTimerRef.current > 0) {\n beamTimerRef.current = Math.max(0, beamTimerRef.current - dt);\n if (beamMatRef.current)\n beamMatRef.current.opacity = Math.min(1, beamTimerRef.current * 12);\n if (beamTimerRef.current <= 0)\n beamLine.visible = false;\n }\n\n if (holder) {\n const goal = st.zoomed ? zoomOffset : hipOffset;\n _targetOffset.set(goal[0], goal[1] - recoilRef.current * 0.012, goal[2] + recoilRef.current * 0.038);\n easing.damp3(holder.position, _targetOffset, 0.09, dt);\n holder.rotation.set(recoilRef.current * 0.14, 0, 0);\n }\n\n camera.getWorldPosition(_camPos);\n camera.getWorldDirection(_camDir);\n const playerBody = resolvePlayerBody();\n const hit = castToolgunRay(\n rapier,\n rapierWorld,\n [_camPos.x, _camPos.y, _camPos.z],\n [_camDir.x, _camDir.y, _camDir.z],\n maxRangeM,\n playerBody,\n );\n\n let targetLabel = \"NO TARGET\";\n if (hit) {\n const jRt = findJointForBody(hit.body);\n const ud = (hit.body?.userData ?? {}) as { name?: string; kolmoPlacedPieceId?: string; kolmoSpawnedId?: string };\n const name = jRt ? `JOINT:${jRt.nodeName}` : (ud.name ?? ud.kolmoPlacedPieceId ?? ud.kolmoSpawnedId ?? \"SURFACE\");\n targetLabel = `${name} (${hit.toi.toFixed(1)}m)`;\n }\n\n if (st.mode === \"build\") {\n let fallbackPt: [number, number, number] = [\n _camPos.x + _camDir.x * 5,\n Math.max(0, _camPos.y + _camDir.y * 5),\n _camPos.z + _camDir.z * 5,\n ];\n if (!hit && _camDir.y < -0.02 && _camPos.y > 0) {\n const tFloor = -_camPos.y / _camDir.y;\n if (tFloor > 0.1 && tFloor <= maxRangeM) {\n fallbackPt = [_camPos.x + _camDir.x * tFloor, 0, _camPos.z + _camDir.z * tFloor];\n }\n }\n const cand = computeBuildCandidate(st.placedPieces, hit ? hit.point : fallbackPt, st.buildKind, st.yaw12);\n const prev = st.buildPreview;\n if (\n !prev ||\n prev.kind !== cand.kind ||\n prev.valid !== cand.valid ||\n Math.abs(prev.position[0] - cand.position[0]) > 1e-4 ||\n Math.abs(prev.position[1] - cand.position[1]) > 1e-4 ||\n Math.abs(prev.position[2] - cand.position[2]) > 1e-4 ||\n Math.abs(prev.quaternion[1] - cand.quaternion[1]) > 1e-4\n ) {\n st.setBuildPreview(cand);\n }\n }\n else if (st.buildPreview !== null) {\n st.setBuildPreview(null);\n }\n\n const detail = st.mode === \"build\"\n ? st.buildKind\n : st.mode === \"spawn\"\n ? (st.armedAsset?.name ?? \"UNARMED\")\n : st.pendingAnchor\n ? `A: ${st.pendingAnchor.label}`\n : `${st.mode.toUpperCase()} READY`;\n\n lcd.draw({\n mode: st.mode,\n yawDeg: st.yaw12 * 30,\n detail,\n targetLabel,\n status: st.statusText,\n accentHex: TOOLGUN_SKIN_PRESETS[effSkin].accentHex,\n });\n });\n\n const isPiloted = Boolean(useActiveKolmoWorld().queryFirst(VehicleTrait, PilotedTag));\n\n return (\n <>\n {createPortal(\n <group ref={holderRef} position={[hipOffset[0], hipOffset[1], hipOffset[2]]}>\n {measured ? (\n <group position={measured.gripOffset}>\n <primitive object={measured.scene} />\n <mesh position={measured.screenPos} quaternion={measured.screenQuat}>\n <planeGeometry args={measured.screenSize} />\n <meshBasicMaterial\n {...(lcd.texture ? { map: lcd.texture } : { color: \"#38bdf8\" })}\n toneMapped={false}\n />\n </mesh>\n </group>\n ) : (\n <ProceduralToolgunBody skinPreset={effSkin} lcdTexture={lcd.texture} />\n )}\n </group>,\n camera,\n )}\n <primitive object={beamLine} />\n {enable && !isPiloted && mode === \"build\" && buildPreview && (\n <BuildGhostPreview candidate={buildPreview} />\n )}\n {mountWorldOutlets && (\n <group name=\"kolmo_toolgun_outlets\">\n {spawnedEntities.map((entry) =>\n entry.kind === \"vehicle\" ? (\n <KolmoVehicle\n key={entry.id}\n id={entry.id}\n {...(entry.bundle ? { bundle: entry.bundle } : {})}\n {...(entry.src ? { src: entry.src } : {})}\n position={entry.position}\n quaternion={entry.quaternion}\n userData={{ kolmoSpawnedId: entry.id, name: entry.name }}\n />\n ) : (\n <KolmoProp\n key={entry.id}\n {...(entry.bundle ? { bundle: entry.bundle } : {})}\n {...(entry.src ? { src: entry.src } : {})}\n fixed={entry.fixed}\n position={entry.position}\n quaternion={entry.quaternion}\n rigidBodyProps={{ userData: { kolmoSpawnedId: entry.id, name: entry.name } }}\n />\n ),\n )}\n {placedPieces.map((piece) => (\n <C12PieceColliderAndMesh key={piece.id} piece={piece} />\n ))}\n </group>\n )}\n </>\n );\n}\n\nfunction ToolgunFromUrl({ src, ...rest }: Omit<KolmoToolgunProps, \"src\" | \"bundle\"> & { src: string }): React.JSX.Element | null {\n const bundle = useKhrGlb(src);\n return <ToolgunCore {...rest} viewmodelBundle={bundle} />;\n}\n\nexport function KolmoToolgun({ src, bundle, ...rest }: KolmoToolgunProps): React.JSX.Element | null {\n const cloned = useMemo(() => (bundle ? cloneKhrBundle(bundle) : null), [bundle]);\n if (src)\n return <ToolgunFromUrl src={src} {...rest} />;\n return <ToolgunCore {...rest} viewmodelBundle={cloned} />;\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAa,gBAAgB;CAAC;CAAS;CAAQ;CAAS;CAAO;CAAS;AAAQ;AAGhF,IAAa,sBAAsB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAWA,IAAa,uBAAuB;CAChC,QAAQ;EAAE,SAAS;EAAW,WAAW;EAAW,aAAa;EAAW,WAAW;EAAM,WAAW;CAAK;CAC7G,QAAQ;EAAE,SAAS;EAAW,WAAW;EAAW,aAAa;EAAW,WAAW;EAAM,WAAW;CAAK;CAC7G,SAAS;EAAE,SAAS;EAAW,WAAW;EAAW,aAAa;EAAW,WAAW;EAAM,WAAW;CAAK;CAC9G,QAAQ;EAAE,SAAS;EAAW,WAAW;EAAW,aAAa;E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AAU,MAAM;IAChB,YAAY,MAAM;IAClB,UAAU;KAAE,gBAAgB,MAAM;KAAI,MAAM,MAAM;IAAK;GAC1D,GAPQ,MAAM,EAOd,IAEDA,oBAAC,WAAD;IAEI,GAAK,MAAM,SAAS,EAAE,QAAQ,MAAM,OAAO,IAAI,CAAC;IAChD,GAAK,MAAM,MAAM,EAAE,KAAK,MAAM,IAAI,IAAI,CAAC;IACvC,OAAO,MAAM;IACb,UAAU,MAAM;IAChB,YAAY,MAAM;IAClB,gBAAgB,EAAE,UAAU;KAAE,gBAAgB,MAAM;KAAI,MAAM,MAAM;IAAK,EAAE;GAC9E,GAPQ,MAAM,EAOd,CAET,GACC,aAAa,KAAK,UACfA,oBAAC,yBAAD,EAA+C,MAAQ,GAAzB,MAAM,EAAmB,CAC1D,CACE;;CAEb,EAAA,CAAA;AAEV;AAEA,SAAS,eAAe,EAAE,KAAK,GAAG,QAA+F;CAC7H,MAAM,SAAS,UAAU,GAAG;CAC5B,OAAOA,oBAAC,aAAD;EAAa,GAAI;EAAM,iBAAiB;CAAS,CAAA;AAC5D;AAEA,SAAgB,aAAa,EAAE,KAAK,QAAQ,GAAG,QAAqD;CAChG,MAAM,SAAS,cAAe,SAAS,eAAe,MAAM,IAAI,MAAO,CAAC,MAAM,CAAC;CAC/E,IAAI,KACA,OAAOA,oBAAC,gBAAD;EAAqB;EAAK,GAAI;CAAO,CAAA;CAChD,OAAOA,oBAAC,aAAD;EAAa,GAAI;EAAM,iBAAiB;CAAS,CAAA;AAC5D"}
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import type { Plugin, UserConfig } from "vite";
|
|
2
1
|
export declare const KOLMO_SINGLETON_DEDUPE: string[];
|
|
3
|
-
/** No-op compatibility stub; `@dimforge/rapier3d-compat` loads directly in standard Vite without WASM regex transforms. */
|
|
4
|
-
export declare function externalizeRapierWasm(): Plugin;
|
|
5
|
-
export declare const KOLMO_ROLLDOWN_BUILD: NonNullable<UserConfig["build"]>;
|
package/dist/vite/index.js
CHANGED
|
@@ -14,14 +14,6 @@ var KOLMO_SINGLETON_DEDUPE = [
|
|
|
14
14
|
"maath",
|
|
15
15
|
"zustand"
|
|
16
16
|
];
|
|
17
|
-
|
|
18
|
-
function externalizeRapierWasm() {
|
|
19
|
-
return {
|
|
20
|
-
name: "kolmo-rapier-compat",
|
|
21
|
-
apply: "build"
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var KOLMO_ROLLDOWN_BUILD = {};
|
|
25
|
-
export { KOLMO_ROLLDOWN_BUILD, KOLMO_SINGLETON_DEDUPE, externalizeRapierWasm };
|
|
17
|
+
export { KOLMO_SINGLETON_DEDUPE };
|
|
26
18
|
|
|
27
19
|
//# sourceMappingURL=index.js.map
|
package/dist/vite/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite/index.ts"],"sourcesContent":["export const KOLMO_SINGLETON_DEDUPE: string[] = [\n \"react\",\n \"react-dom\",\n \"three\",\n \"@react-three/fiber\",\n \"@react-three/drei\",\n \"@react-three/rapier\",\n \"@dimforge/rapier3d-compat\",\n \"@pinkaphant/ecctrl\",\n \"@khr3/core\",\n \"@khr3/c12\",\n \"koota\",\n \"maath\",\n \"zustand\",\n];\n"],"mappings":";AAAA,IAAa,yBAAmC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinkaphant/kolmo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Thin React Three Fiber + Rapier WASM + @pinkaphant/ecctrl + @khr3/core + @khr3/c12 + Koota ECA game layer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
|
-
"bin": {
|
|
9
|
-
"kolmo": "./bin/kolmo.mjs"
|
|
10
|
-
},
|
|
11
8
|
"main": "./dist/index.js",
|
|
12
9
|
"types": "./dist/index.d.ts",
|
|
13
10
|
"exports": {
|
|
@@ -15,104 +12,64 @@
|
|
|
15
12
|
"types": "./dist/index.d.ts",
|
|
16
13
|
"import": "./dist/index.js"
|
|
17
14
|
},
|
|
18
|
-
"./
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
20
|
-
"import": "./dist/index.js"
|
|
15
|
+
"./engine": {
|
|
16
|
+
"types": "./dist/engine/index.d.ts",
|
|
17
|
+
"import": "./dist/engine/index.js"
|
|
21
18
|
},
|
|
22
19
|
"./physics": {
|
|
23
20
|
"types": "./dist/physics/index.d.ts",
|
|
24
21
|
"import": "./dist/physics/index.js"
|
|
25
22
|
},
|
|
23
|
+
"./toolgun": {
|
|
24
|
+
"types": "./dist/toolgun/index.d.ts",
|
|
25
|
+
"import": "./dist/toolgun/index.js"
|
|
26
|
+
},
|
|
26
27
|
"./vite": {
|
|
27
28
|
"types": "./dist/vite/index.d.ts",
|
|
28
29
|
"import": "./dist/vite/index.js"
|
|
29
30
|
},
|
|
30
|
-
"./shaders": {
|
|
31
|
-
"types": "./dist/shaders/index.d.ts",
|
|
32
|
-
"import": "./dist/shaders/index.js"
|
|
33
|
-
},
|
|
34
|
-
"./shaders/tsl": {
|
|
35
|
-
"types": "./dist/shaders/tsl.d.ts",
|
|
36
|
-
"import": "./dist/shaders/tsl.js"
|
|
37
|
-
},
|
|
38
|
-
"./world": {
|
|
39
|
-
"types": "./dist/world/index.d.ts",
|
|
40
|
-
"import": "./dist/world/index.js"
|
|
41
|
-
},
|
|
42
|
-
"./engine": {
|
|
43
|
-
"types": "./dist/engine/index.d.ts",
|
|
44
|
-
"import": "./dist/engine/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./importer": {
|
|
47
|
-
"types": "./dist/importer/index.d.ts",
|
|
48
|
-
"import": "./dist/importer/index.js"
|
|
49
|
-
},
|
|
50
|
-
"./junk": {
|
|
51
|
-
"types": "./dist/junk/index.d.ts",
|
|
52
|
-
"import": "./dist/junk/index.js"
|
|
53
|
-
},
|
|
54
|
-
"./suika": {
|
|
55
|
-
"types": "./dist/suika/index.d.ts",
|
|
56
|
-
"import": "./dist/suika/index.js"
|
|
57
|
-
},
|
|
58
|
-
"./sand3d": {
|
|
59
|
-
"types": "./dist/sand3d/index.d.ts",
|
|
60
|
-
"import": "./dist/sand3d/index.js"
|
|
61
|
-
},
|
|
62
|
-
"./schema": {
|
|
63
|
-
"types": "./dist/schema/kolmoSchema.d.ts",
|
|
64
|
-
"import": "./dist/schema/kolmoSchema.js"
|
|
65
|
-
},
|
|
66
31
|
"./package.json": "./package.json"
|
|
67
32
|
},
|
|
68
33
|
"files": [
|
|
69
34
|
"dist",
|
|
70
|
-
"docs",
|
|
71
|
-
"skills",
|
|
72
|
-
"AGENTS.md",
|
|
73
|
-
"bin",
|
|
74
35
|
"LICENSE",
|
|
75
|
-
"README.md"
|
|
76
|
-
"CLAUDE.md"
|
|
36
|
+
"README.md"
|
|
77
37
|
],
|
|
78
38
|
"publishConfig": {
|
|
79
39
|
"access": "public"
|
|
80
40
|
},
|
|
81
41
|
"scripts": {
|
|
82
42
|
"dev": "vite",
|
|
83
|
-
"
|
|
84
|
-
"typecheck": "tsc --noEmit && tsc -p tests/e2e/tsconfig.json --noEmit",
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
85
44
|
"test": "node --import tsx --test \"src/**/*.test.ts*\"",
|
|
86
|
-
"build": "
|
|
87
|
-
"
|
|
88
|
-
"prepack": "npm run build:lib >&2",
|
|
45
|
+
"build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && vite build && tsc -p tsconfig.build.json",
|
|
46
|
+
"prepack": "npm run build >&2",
|
|
89
47
|
"pack:dry": "npm pack --dry-run"
|
|
90
48
|
},
|
|
91
|
-
"dependencies": {
|
|
92
|
-
"@khr3/assets": "^0.2.9",
|
|
93
|
-
"@khr3/c12": "^0.3.9",
|
|
94
|
-
"@khr3/core": "^0.2.9",
|
|
95
|
-
"@khr3/launchers": "^0.2.9",
|
|
96
|
-
"@khr3/vehicles": "^0.2.5"
|
|
97
|
-
},
|
|
98
|
-
"overrides": {
|
|
99
|
-
"@dimforge/rapier3d-compat": "0.19.2",
|
|
100
|
-
"@pinkaphant/ecctrl": "2.0.4-beta.5"
|
|
101
|
-
},
|
|
102
49
|
"peerDependencies": {
|
|
103
50
|
"@dimforge/rapier3d-compat": "0.19.2",
|
|
51
|
+
"@khr3/c12": ">=0.3.11",
|
|
52
|
+
"@khr3/core": ">=0.2.11",
|
|
104
53
|
"@pinkaphant/ecctrl": "2.0.4-beta.5",
|
|
105
|
-
"@react-three/drei": "^10.
|
|
54
|
+
"@react-three/drei": "^10.0.0",
|
|
106
55
|
"@react-three/fiber": "^9.0.0",
|
|
107
56
|
"@react-three/rapier": "^2.2.0",
|
|
108
|
-
"koota": "^0.6.
|
|
57
|
+
"koota": "^0.6.6",
|
|
58
|
+
"maath": "^0.10.8",
|
|
109
59
|
"react": "^19.0.0",
|
|
110
60
|
"react-dom": "^19.0.0",
|
|
111
|
-
"three": "
|
|
61
|
+
"three": "0.184.0",
|
|
112
62
|
"zustand": "^5.0.0"
|
|
113
63
|
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"react-dom": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
114
69
|
"devDependencies": {
|
|
115
70
|
"@dimforge/rapier3d-compat": "0.19.2",
|
|
71
|
+
"@khr3/c12": "^0.3.11",
|
|
72
|
+
"@khr3/core": "^0.2.11",
|
|
116
73
|
"@pinkaphant/ecctrl": "2.0.4-beta.5",
|
|
117
74
|
"@react-three/drei": "^10.7.7",
|
|
118
75
|
"@react-three/fiber": "^9.6.1",
|
|
@@ -120,33 +77,19 @@
|
|
|
120
77
|
"@types/node": "^22.20.5",
|
|
121
78
|
"@types/react": "^19.2.16",
|
|
122
79
|
"@types/react-dom": "^19.2.3",
|
|
123
|
-
"@types/three": "
|
|
124
|
-
"
|
|
125
|
-
"
|
|
80
|
+
"@types/three": "0.184.0",
|
|
81
|
+
"koota": "^0.6.6",
|
|
82
|
+
"maath": "^0.10.8",
|
|
126
83
|
"react": "^19.2.7",
|
|
127
84
|
"react-dom": "^19.2.7",
|
|
128
|
-
"three": "
|
|
85
|
+
"three": "0.184.0",
|
|
129
86
|
"tsx": "^4.23.15",
|
|
130
|
-
"typescript": "^
|
|
87
|
+
"typescript": "^5.8.3",
|
|
131
88
|
"vite": "^8.3.8",
|
|
132
|
-
"
|
|
133
|
-
"zustand": "^5.0.14"
|
|
89
|
+
"zustand": "^5.1.0"
|
|
134
90
|
},
|
|
135
|
-
"keywords": [
|
|
136
|
-
"threejs",
|
|
137
|
-
"react-three-fiber",
|
|
138
|
-
"rapier",
|
|
139
|
-
"ecctrl",
|
|
140
|
-
"khr3",
|
|
141
|
-
"retro",
|
|
142
|
-
"game-engine"
|
|
143
|
-
],
|
|
144
91
|
"repository": {
|
|
145
92
|
"type": "git",
|
|
146
93
|
"url": "git+https://github.com/pinkAphant/Kolmo.git"
|
|
147
|
-
},
|
|
148
|
-
"homepage": "https://github.com/pinkAphant/kolmo#readme",
|
|
149
|
-
"bugs": {
|
|
150
|
-
"url": "https://github.com/pinkAphant/kolmo/issues"
|
|
151
94
|
}
|
|
152
95
|
}
|
package/AGENTS.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# `@pinkaphant/kolmo` — Agent & Contributor Guide
|
|
2
|
-
|
|
3
|
-
`Kolmo` is a 3D game runtime built on React Three Fiber, `@react-three/rapier` (`0.19.2`), `@pinkaphant/ecctrl@2.0.4-beta.5`, `@khr3/*`, and Koota ECS — combining `npx @pinkaphant/kolmo create` templates, declarative `<Game>` entities (`<Vehicle>`, `<Actor>`, `<Island>`, `<LongDrive>`, `<Sand3D>`, `<Junk>`, `<SuikaSystem>`), and in-browser `navigator.modelContext` WebMCP tools (`useImporterWebMcp`, `useKolmoDriveWebMcp`).
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Shared Human + AI Agency Workflow
|
|
8
|
-
|
|
9
|
-
1. **Scaffold in One Command**: Run `npx @pinkaphant/kolmo create <dir> --template game|longline|dust|garage` ([bin/kolmo.mjs](./bin/kolmo.mjs)) to generate a runnable Vite 8 + TypeScript + Cloudflare Worker (`wrangler.jsonc`) app with pinned physics overrides.
|
|
10
|
-
2. **Compose Self-Contained Entities**: Drop `<Vehicle>`, `<Actor>`, `<Island>`, `<LongDrive>`, `<Sand3D>`, `<Junk>`, `<SuikaSystem>`, `<Hud>`, and `<MobileTouchOverlay />` inside `<Game>` ([src/engine/kolmoGame.tsx](./src/engine/kolmoGame.tsx)). Each entity registers its own Koota ECS traits, Rapier colliders/joints, `KOLMO_emitter` VFX plumes, and `0.08`-deadzone touch bindings automatically.
|
|
11
|
-
3. **Co-Author & Co-Drive via WebMCP & Import Gate**: Mount `<GlbImportGate />` ([src/importer/GlbImportGate.tsx](./src/importer/GlbImportGate.tsx)) to calibrate `.glb`, `.gltf`, OpenUSD (`.usd*`), or `.sand3d` Code-CAD scripts across 8 domains (`vehicle | c12 | launcher | person | prop | junk | suika | sand3d`). Browser-connected AI agents inspect, forge, and live-drive through all 14 WebMCP tools ([src/importer/importerWebMcpTools.ts](./src/importer/importerWebMcpTools.ts), [src/engine/kolmoBotControl.ts](./src/engine/kolmoBotControl.ts)): `importer_state`, `importer_capture_view`, `importer_list_models`, `importer_set_stage`, `importer_load`, `importer_orient`, `importer_scale`, `importer_set_kind`, `importer_pop_wheels`, `importer_cut_part`, `importer_set_points`, `importer_export`, plus `kolmo_drive` and `kolmo_telemetry` (pipeline order: load → orient → scale → set_kind → pop_wheels → cut_part / set_points → set_stage(2) or export → kolmo_drive / kolmo_telemetry), while `<KolmoBotJournalFeed />` renders live bot activity for the human co-watcher.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 2. Core Technical Architecture
|
|
16
|
-
|
|
17
|
-
- **Pinned Stack**: `"@pinkaphant/ecctrl": "2.0.4-beta.5"`, `"@dimforge/rapier3d-compat": "0.19.2"`, `"three": "0.184.0"`, `"@react-three/fiber": "^9.6.1"`, `"@react-three/rapier": "^2.2.0"`, `"koota": "^0.6.5"`.
|
|
18
|
-
- **Imperative R3F Loop (`useRef` + `useFrame`)**: Step Rapier inside `<KolmoPhysics>` (`<Physics paused timeStep="vary">` + `<TimeControl maxDelta={1 / 30}>`), reading `rapierWorld.timestep` and transient store state (`useGateStore.getState()`) with module-scoped scratch vectors. Drive `<KolmoHud>` and `<MobileTouchOverlay>` at 60 Hz through DOM `ref.current` mutations.
|
|
19
|
-
- **Koota SoA ECS**: Mutate `TransformTrait`, `VelocityTrait`, and `VehicleTelemetryTrait` in place via `.updateEach(..., { changeDetection: "never" })` or `writeEntityKinematics` / `writeVehicleTelemetry` ([src/engine/kolmoTraits.ts](./src/engine/kolmoTraits.ts)), and link actors to vehicles with `PilotLink = relation({ exclusive: true })`.
|
|
20
|
-
- **Real Vehicle & C12 Physics**: Compile Fritsch–Carlson monotone Pacejka tire LUTs (`@khr3/core/curves`), SI corner-load suspension (`solveWheelLoads` on `@pinkaphant/ecctrl@2.0.4-beta.5`), volume-weighted chassis inertia (`deriveChassisGeometryPlan`), cylindrical boolean wheel coring (`sliceCarWheelCylinders`), and exact `Z[1/2, sqrt(3)]` 3.0 m `C12` modular batches (`@khr3/c12`).
|
|
21
|
-
- **Co-op Room Multiplayer**: Pair Koota entity traits (`TransformTrait`, `VelocityTrait`, `PilotLink`) with Cloudflare Durable Objects WebSocket Hibernation (`partyserver` `static options = { hibernate: true }` + `partysocket` + `serializeAttachment`) for 1–8 player room-code co-op sessions.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 3. Commands & Module Hygiene
|
|
26
|
-
|
|
27
|
-
- Keep every `.ts` / `.tsx` source module focused (`<= 250` lines) with calm Title/Sentence UI copy, `100dvh`, `env(safe-area-inset-*)`, and `>= 44x44 px` touch targets.
|
|
28
|
-
- Run `npm run typecheck`, `npm test`, and `npm run build` (plus `npx vite build` for the interactive `dist-example/` home page) with exit code `0`.
|
|
29
|
-
- Full subpath signatures live in [README.md](./README.md), [docs/api-reference.md](./docs/api-reference.md), and the portable agent skill [skills/kolmo-engine/SKILL.md](./skills/kolmo-engine/SKILL.md).
|
package/CLAUDE.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|
|
2
|
-
|
|
3
|
-
# `@pinkaphant/kolmo` — Claude Code Guide
|
|
4
|
-
|
|
5
|
-
Follow [AGENTS.md](./AGENTS.md), [README.md](./README.md), [docs/api-reference.md](./docs/api-reference.md), and [skills/kolmo-engine/SKILL.md](./skills/kolmo-engine/SKILL.md):
|
|
6
|
-
- Pin `"@pinkaphant/ecctrl": "2.0.4-beta.5"`, `"@dimforge/rapier3d-compat": "0.19.2"`, and `"three": "0.184.0"`.
|
|
7
|
-
- Compose `<Game>`, `<Vehicle>`, `<Actor>`, `<Island>`, `<LongDrive>`, `<Sand3D>`, `<Junk>`, `<SuikaSystem>`, `<Hud>`, `<MobileTouchOverlay />`, and `<GlbImportGate enableWebMcp />` with Koota SoA traits (`{ changeDetection: "never" }`) and `<= 250`-line modules.
|
|
8
|
-
- Verify with `npm run typecheck && npm test && npm run build`.
|