Oceanfishinglure
Based on game build 714014 | Last updated: 2026-03-06
Overview
oceanfishinglure.lua defines and registers multiple fishing lure prefabs used in DST’s Ocean Fishing subsystem. Each lure type is parameterized via the LURES table and instantiated as an inventory item with specific visual, behavioral, and network configuration. This file does not define a reusable component class; instead, it is a prefab factory that creates multiple entity instances with shared structure but differentiated data.
The prefabs are integrated with the oceanfishingtackle component to expose lure-specific configuration and are assigned the inventoryitem, stackable, and inspectable components for gameplay integration.
Usage example
-- Example: spawn a red spoon lure in the world
local lure = Prefab("oceanfishinglure_spoon_red")
lure:PushEvent("spawn")
Dependencies & tags
Components used: oceanfishingtackle, inventoryitem, stackable, inspectable, weighable (indirectly via helper function heavy_charmfish)
Tags: Adds oceanfishing_lure
Properties
No public properties. The prefabs are instantiated via item_fn, and their configuration is encapsulated in the data parameter passed to that function (derived from LURES).
Main functions
heavy_charmfish(fish)
- Description: A helper function used to compute a bonus modifier for the “heavy” lure. It returns
1if the given fish’s weight percentage meets or exceedsTUNING.WEIGHABLE_HEAVY_WEIGHT_PERCENT, otherwise0. - Parameters:
fish(optional entity) — an entity with aweighablecomponent. - Returns:
0or1(number). - Error states: Returns
0iffishisnil, invalid, or lacks theweighablecomponent.
item_fn(data, name)
- Description: Factory function that constructs and configures a single lure prefab instance.
- Parameters:
data(table) — lure configuration from theLUREStable; includesbuild,symbol,lure_data, and optionalfns.name(string) — the prefab name (e.g.,"oceanfishinglure_spoon_red").
- Returns: The fully configured
inst(entity). - Error states: Returns early on non-master instances (client-side only setup); only full setup occurs on
TheWorld.ismastersim.
SetupLure(data) (via oceanfishingtackle component)
- Description: Configures the lure’s data in the
oceanfishingtacklecomponent (see./components/oceanfishingtackle.lua). - Parameters:
data(table) — the samedatatable passed toitem_fn, includinglure_dataandfns. - Returns: Nothing.
Events & listeners
This file does not register or fire any events directly. Entity instances may fire events via other components (e.g., inventoryitem, inspectable), but none are defined in this file.