Dock Kit
Based on game build 714014 | Last updated: 2026-03-07
Overview
The dock_kit prefab functions as a deployable inventory item used to construct monkey docks on ocean shore tiles. It is deployed using custom validation logic that verifies the tile is an ocean coastal type and has adjacent permanent land tiles. Upon successful deployment, it registers a dock tile with the dockmanager component and handles unsafe placement warnings. It also spawns a temporary dock_tile_registrator entity to manage persistent state (e.g., undertile data) and ensure proper tile-layer integration.
Usage example
-- Example: Creating and deploying a dock kit in code
local inst = SpawnPrefab("dock_kit")
inst.components.stackable:SetStackSize(1)
inst.components.deployable:SetDeployMode(DEPLOYMODE.CUSTOM)
-- Assume 'pt' is a valid Vector3 position on an ocean shore
inst.components.deployable.ondeploy(inst, pt, ThePlayer)
Dependencies & tags
Components used: deployable, stackable, inventoryitem, inspectable, undertile (via dock_tile_registrator), dockmanager, talker.
Tags added by prefab: groundtile, deploykititem, usedeployspacingasoffset.
Tags added by registrator: CLASSIFIED.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
_loaded_undertile | WORLD_TILES.* or nil | nil | Stores the undertile type loaded from saved data for registrator persistence. |
_custom_candeploy_fn | function | CLIENT_CanDeployDockKit | Custom client-side deploy validation function for DEPLOYMODE.CUSTOM. |
Main functions
CLIENT_CanDeployDockKit(inst, pt, mouseover, deployer, rotation)
- Description: Validates whether the dock kit can be deployed at a given world point. Checks that the tile is coastal/ocean shore and has adjacent permanent land tiles.
- Parameters:
inst(entity): The dock kit prefab instance.pt(Vector3): World position to test.mouseover(any): Unused in this function.deployer(entity ornil): The entity attempting deployment.rotation(any): Unused in this function.
- Returns:
trueif deployable; otherwisefalse. - Error states: Returns
falseif the tile is not ocean coastal type, lacks adjacent valid land tiles, ordockmanager:CanDeployDockAtPointreturnsfalse.
on_deploy(inst, pt, deployer)
- Description: Server-side callback invoked after deployment succeeds. Creates a monkey dock tile, checks dock safety, and removes the deployed kit. Announces boat sinking if unsafe.
- Parameters:
inst(entity): The dock kit instance being deployed.pt(Vector3): Deployment world position.deployer(entity ornil): The entity deploying the kit.
- Returns: Nothing.
- Error states:
- Does nothing if
TheWorld.components.dockmanageris missing. - Sound effect only plays if
deployeranddeployer.SoundEmitterexist. - Warning only spoken if
dock_unsafeis true anddeployer.components.talkerexists. - Always removes the kit instance after processing via
inst.components.stackable:Get():Remove().
- Does nothing if
Events & listeners
- Listens to:
dock_tile_registratorentity listens to internal task delay (DoTaskInTime(1*FRAMES, on_registrator_postpass)). - Pushes: None explicitly; interacts via component function calls (e.g.,
dockmanager:CreateDockAtPoint,dockmanager:ResolveDockSafetyAtPoint,talker:Say).