{
  "name": "well",
  "title": "Well",
  "type": "registry:component",
  "description": "Stone well with a dark pool, posts, a little pyramid roof, and a bucket on a rope.",
  "dependencies": [
    "@react-three/rapier@^2.2.0",
    "@runek/core@^0.12.0"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "Well.tsx",
      "content": "import { CuboidCollider, RigidBody } from '@react-three/rapier'\nimport { useWorld, type Vec3 } from '@runek/core'\n\nexport interface WellProps {\n  position?: Vec3\n  rotation?: Vec3\n  radius?: number\n  wallHeight?: number\n  /** Stone color; defaults to the world palette's `stone` slot. */\n  color?: string\n  /** Roof + frame color; defaults to the world palette's `wood` slot. */\n  roofColor?: string\n}\n\n/** A stone well: ring wall, a dark pool, two posts carrying a little pyramid roof,\n *  and a bucket on a rope. A village focal point. */\nexport function Well({\n  position = [0, 0, 0],\n  rotation = [0, 0, 0],\n  radius = 0.7,\n  wallHeight = 0.8,\n  color,\n  roofColor,\n}: WellProps) {\n  const { unit, palette } = useWorld()\n  const stone = color ?? palette.stone\n  const wood = roofColor ?? palette.wood\n  const R = radius * unit\n  const wh = wallHeight * unit\n  const postX = R * 0.92\n  const postH = wh + 1.0 * unit\n  const roofH = 0.5 * unit\n\n  return (\n    <RigidBody type=\"fixed\" colliders={false} position={position} rotation={rotation}>\n      <CuboidCollider args={[R, wh / 2, R]} position={[0, wh / 2, 0]} />\n\n      <mesh castShadow receiveShadow position={[0, wh / 2, 0]}>\n        <cylinderGeometry args={[R, R * 1.05, wh, 20]} />\n        <meshStandardMaterial color={stone} roughness={0.95} />\n      </mesh>\n      <mesh castShadow position={[0, wh, 0]} rotation={[Math.PI / 2, 0, 0]}>\n        <torusGeometry args={[R, 0.06 * unit, 8, 20]} />\n        <meshStandardMaterial color={stone} roughness={0.9} />\n      </mesh>\n      <mesh position={[0, wh - 0.08 * unit, 0]} rotation={[-Math.PI / 2, 0, 0]}>\n        <circleGeometry args={[R * 0.8, 20]} />\n        <meshStandardMaterial color=\"#0c1a22\" roughness={1} />\n      </mesh>\n\n      {[-1, 1].map((s) => (\n        <mesh key={`post-${s}`} castShadow position={[s * postX, postH / 2, 0]}>\n          <boxGeometry args={[0.1 * unit, postH, 0.1 * unit]} />\n          <meshStandardMaterial color={wood} roughness={0.85} />\n        </mesh>\n      ))}\n      <mesh castShadow position={[0, postH, 0]} rotation={[0, 0, Math.PI / 2]}>\n        <cylinderGeometry args={[0.04 * unit, 0.04 * unit, postX * 2, 8]} />\n        <meshStandardMaterial color={wood} roughness={0.85} />\n      </mesh>\n\n      <mesh castShadow position={[0, postH + roofH / 2, 0]} rotation={[0, Math.PI / 4, 0]}>\n        <coneGeometry args={[R * 1.6, roofH, 4]} />\n        <meshStandardMaterial color={wood} roughness={0.8} flatShading />\n      </mesh>\n\n      <mesh position={[R * 0.3, postH - 0.4 * unit, 0]}>\n        <cylinderGeometry args={[0.008 * unit, 0.008 * unit, 0.75 * unit, 6]} />\n        <meshStandardMaterial color=\"#5a4a32\" />\n      </mesh>\n      <mesh castShadow position={[R * 0.3, postH - 0.85 * unit, 0]}>\n        <cylinderGeometry args={[0.1 * unit, 0.08 * unit, 0.16 * unit, 12]} />\n        <meshStandardMaterial color={wood} roughness={0.8} />\n      </mesh>\n    </RigidBody>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}
