Boat Leak
Based on game build 722832 | Last updated: 2026-04-18
Overview
boat_leak is a prefab that spawns on boats to simulate water leakage. When entities block the leak opening, it becomes plugged and applies wetness to nearby entities. If plugged long enough, it launches inventory items into the air. The leak is removed when repaired via the boatleak component callbacks.
Usage example
-- Leak spawns automatically on boats; callbacks are set internally during prefab construction
-- External code typically interacts via the boatleak component state
local inst = SpawnPrefab("boat_leak")
inst.components.boatleak:SetPlugged(true) -- Manually plug/unplug the leak
Dependencies & tags
External dependencies:
TUNING-- constants for haunt values, wetness rates, and plug timers
Components used:
boatleak-- core leak state management with spring/repair callbacksupdatelooper-- runsFindLeakBlockerperiodicallylootdropper-- added but not actively used in this prefabinspectable-- added when leak springs, removed when repairedhauntable-- added when leak springs for ghost interactionsmoisture-- accessed on entities to apply wetness rate bonusesinventoryitem-- accessed on items for moisture and landing statemine-- deactivated on items before launchingfloater-- checked to determine if item is heavyhullhealth-- checked forleakproofproperty on boat
Tags:
boatleak-- added on creation for entity identificationNOCLICK-- added when repaired, removed when sprungNOBLOCK-- added when repaired, removed when sprung
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
_wettargets | table | {} | Tracks entities receiving wetness from the leak. |
launchtime | number | nil | Countdown timer before launching plugged items. |
jiggletime | number | nil | Countdown timer for item jiggle animation phase. |
FindLeakBlocker | function | FindLeakBlocker | Assigned update function for leak detection. |
persists | boolean | false | Entity does not persist through save/load. |
Main functions
onsprungleak(inst)
- Description: Called when the leak springs open. Adds
inspectableandhauntablecomponents, initializes wet target tracking, and removesNOCLICK/NOBLOCKtags. - Parameters:
inst-- the boat leak entity instance - Returns: None
- Error states: None
onrepairedleak(inst)
- Description: Called when the leak is repaired. Removes
inspectableandhauntablecomponents, clears wet target moisture bonuses, and addsNOCLICK/NOBLOCKtags. - Parameters:
inst-- the boat leak entity instance - Returns: None
- Error states: None
FindLeakBlocker(inst, dt)
- Description: Main update function that finds entities within
BLOCK_RADIUS(0.4) blocking the leak. Applies wetness to entities, tracks inventory items, and manages launch/jiggle timers when plugged. - Parameters:
inst-- the boat leak entity instancedt-- delta time since last update
- Returns: None
- Error states: Errors if
inst.components.boatleakis nil when callingSetPlugged()— no nil guard present.
checkforleakimmune(inst)
- Description: Validates that the leak spawned on a valid boat. Removes the leak if spawned on land or a leakproof boat (via
hullhealth.leakproof). - Parameters:
inst-- the boat leak entity instance - Returns: None
- Error states: Errors if
inst:GetCurrentPlatform()returns an entity withouthullhealthcomponent — no nil guard onboat.components.hullhealth.
SpikeLaunch(inst, launcher, basespeed, startheight, startradius)
- Description: Launches an entity with physics velocity. Calculates random angle and applies vertical/horizontal velocity for projectile motion.
- Parameters:
inst-- entity to launchlauncher-- the boat leak entity launching the itembasespeed-- base horizontal speed valuestartheight-- initial Y position for teleportstartradius-- spawn radius offset from launcher
- Returns: None
- Error states: None
LaunchItems(items, launcher)
- Description: Launches all inventory items from the plugged leak. Deactivates mines, sets items to not landed, removes physics colliders, and listens for landing events.
- Parameters:
items-- table of item entities to launchlauncher-- the boat leak entity
- Returns: None
- Error states: None
JiggleItems(items)
- Description: Applies small vertical velocity to items as a pre-launch jiggle effect. Deactivates mines and sets items to not landed state.
- Parameters:
items-- table of item entities to jiggle - Returns: None
- Error states: None
OnEndFlung(inst)
- Description: Cleanup function called when launched item enters limbo or lands. Removes event callbacks and restores inventory item physics.
- Parameters:
inst-- the launched item entity - Returns: None
- Error states: None
Events & listeners
- Listens to:
enterlimbo- triggersOnEndFlungcleanup on launched items - Listens to:
on_landed- triggersOnEndFlungcleanup on launched items - Pushes: None identified