Skip to main content

Game Hooks

useGameContext

Accesses the global game context.
const useGameContext = (): GameContextType
return
GameContextType
Returns the game context object with boat refs, settings, and world state
Source: src/browser/hooks/useGame/context/index.ts:4

useGameStore

Zustand store for managing game settings and state.
const useGameStore = (): TGameStore
return
TGameStore
Source: src/browser/hooks/useGame/store/index.ts:5

Boat Hooks

useNavigation

Handles boat movement, rotation, and physics.
const useNavigation = ({
  boatRef: TBoatRef,
  floatingRef: TBoatRef
}): { floatingRef: TBoatRef }
return
object
Features:
  • Forward/backward movement with acceleration/deceleration
  • Left/right turning with angular velocity
  • Rocking and bobbing animations based on movement
  • Frame-independent physics using delta time
Source: src/browser/hooks/useBoat/navigation/index.tsx:13

useKeyboard

Captures keyboard input for boat controls.
const useKeyboard = (): DirectionInput
return
DirectionInput
Object with boolean flags for forward, backward, left, right keys
Keyboard Mappings:
  • W / - Forward
  • S / - Backward
  • A / - Turn left
  • D / - Turn right
  • H - Horn sound
  • F - Toggle minimap fullscreen
Source: src/browser/hooks/useBoat/keyboard/index.ts:4

Node Hooks

useNodeMovement

Animates floating and rotation of file/folder nodes.
const useNodeMovement = ({
  nodes: TNodeInstances,
  boatRef: TBoatRef,
  nodeRef: TNodeRef,
  isMinimapFullScreen: boolean
}): void
Features:
  • Floating animation with sine wave motion
  • Nodes rotate to face the boat
  • Fixed orientation in minimap fullscreen mode
Source: src/browser/hooks/useNode/movement/index.ts:4

useNodeCollision

Detects collisions between boat and nodes with avoidance.
const useNodeCollision = ({
  nodes: TNodeInstances,
  boatRef: TBoatRef,
  nodeRef: TNodeRef
}): {
  trackedCollisions: boolean[],
  throttledOpenNode: () => void
}
return
object
Features:
  • Collision detection using configurable radius
  • Push-back avoidance force
  • State tracking for UI feedback
Source: src/browser/hooks/useNode/collision/index.ts:7

Git Hooks

useGit

Provides Git operations and branch data.
const useGit = (): { branches: TBranchesResponse }
return
object
Source: src/browser/hooks/useGit/index.ts:3

useBranches

Manages Git branch listing and checkout.
const useBranches = (): TBranchesResponse
return
TBranchesResponse
Source: src/browser/hooks/useGit/useBranch/index.ts:11

Minimap Hooks

useMinimapCamera

Manages the overhead camera for the minimap view.
const useMinimapCamera = (): {
  gl: WebGLRenderer,
  scene: Scene,
  virtualCam: RefObject<OrthographicCamera>,
  minimapPosition: { x: number, y: number },
  minimapSize: { width: number, height: number }
}
return
object
Source: src/browser/hooks/useMinimap/index.ts:12

useMinimapClickHandler

Handles click interactions on the minimap.
const useMinimapClickHandler = ({
  minimapPosition: { x: number, y: number },
  minimapSize: { width: number, height: number },
  virtualCam: RefObject<OrthographicCamera | null>,
  scene: Scene,
  gl: WebGLRenderer
}): void
Features:
  • Raycasting from minimap clicks to 3D objects
  • Triggers openOnClick on intersected objects
Source: src/browser/hooks/useMinimap/index.ts:67

Ocean Hooks

useOceanRegen

Generates infinite ocean tiles around the boat.
const useOceanRegen = (
  TILE_SIZE: number = 10000,
  TILES_RADIUS: number = 2
): {
  tiles: Array<{ key: string, position: [number, number, number] }>,
  sceneConfig: object,
  planeGeometry: PlaneGeometry,
  oceanRef: TOceanRef
}
return
object
Source: src/browser/hooks/useOcean/regen/index.ts:11

Extension Hooks

useExtensionContext

Accesses VS Code extension context and messaging API.
const useExtensionContext = (): ExtensionContextType
return
ExtensionContextType
Returns extension context with vscodeApi and currentPath
Source: src/browser/hooks/useExtension/context/index.ts:4

Build docs developers (and LLMs) love