Skip to main content

Pocket Scale

Based on game build 714014 | Last updated: 2026-03-06

Overview

The pocket_scale prefab represents a handheld item used to weigh fish in DST. It implements the finiteuses, itemweigher, and fuel components, making it a consumable tool with limited durability. When used on a fish, it consumes one use and provides a weight reading; once depleted, the item is automatically removed from the world. It also functions as a small fuel source and can be ignited or used as a Hauntable launch target.

Usage example

local inst = SpawnPrefab("pocket_scale")
if inst and inst.components.finiteuses then
-- Check remaining uses
print("Remaining uses:", inst.components.finiteuses:GetPercent())
-- Perform a weighing action (typically triggered by the itemweigher component)
inst.components.itemweigher:DoWeighIn(some_fish, player)
end

Dependencies & tags

Components used: finiteuses, itemweigher, fuel, inventoryitem, inspectable, burnable, propagator, hauntable Tags: Adds trophyscale_fish and donotautopick; removes itself upon finiteuses depletion (via SetOnFinished calling inst.Remove).

Properties

PropertyTypeDefault ValueDescription
inst.components.finiteuses.totalnumberTUNING.POCKETSCALE_USESMaximum number of uses before depletion.
inst.components.finiteuses.currentnumberTUNING.POCKETSCALE_USESCurrent remaining uses (starts full).
inst.components.itemweigher.typestringTROPHYSCALE_TYPES.FISHIndicates this scale is designated for weighing fish.
inst.components.fuel.fuelvaluenumberTUNING.TINY_FUELFuel value for burning mechanics.
scrapbook_specialinfostring"POCKETSCALE"Metadata used by scrapbook entry logic.

Main functions

doweight(inst, target, doer)

  • Description: Callback function assigned to itemweigher:SetOnDoWeighInFn. Consumes one use of the scale when triggered and returns success.
  • Parameters:
    • inst (Entity) — the pocket scale instance.
    • target (Entity) — the fish being weighed (unused in logic but passed by caller).
    • doer (Entity) — the entity performing the weighing action (e.g., player; unused).
  • Returns: true — indicates weighing was successful.
  • Error states: None; uses nil checks to avoid errors if finiteuses component is missing.

Events & listeners

  • Pushes: percentusedchange — fired by finiteuses:SetUses to update client-side visual state (e.g., wear progress).
  • Listens to: None explicitly (via ListenForEvent); relies on finiteuses internal event handling for deactivation logic.