Pocketwatch Dismantler
Based on game build 714014 | Last updated: 2026-03-03
Overview
PocketWatch_Dismantler is a utility component that enforces ownership and readiness rules before allowing a pocket watch–type item to be dismantled. When conditions are met, it handles the disassembly process: replacing mimic items with an aggressive version, producing a broken tool, and dropping each recipe ingredient as loot—either into a container (if owned by a non-pocket-dimension entity) or directly onto the ground. It is typically added to the dismantler tool (e.g., a screwdriver) rather than the target item itself.
The component relies on:
rechargeableto verify the target is not on cooldown.inventoryitemto locate the item’s grand owner and determine drop behavior.itemmimicto transform mimics before dismantling.lootdropperto resolve recipe ingredients and spawn loot.
Usage example
-- Example: Adding to a screwdriver tool and calling from a recipe
local inst = CreateEntity()
inst:AddComponent("pocketwatch_dismantler")
-- Later, inside an action callback:
if target.components.pocketwatch_dismantler then
local can, reason = target.components.pocketwatch_dismantler:CanDismantle(target, doer)
if can then
target.components.pocketwatch_dismantler:Dismantle(target, doer)
end
end
Dependencies & tags
Components used: rechargeable, inventoryitem, itemmimic, lootdropper
Tags: Checks clockmaker (on doer) and pocketdimension_container (on owner). No tags added or removed by this component.
Properties
No public properties.
Main functions
CanDismantle(target, doer)
- Description: Validates whether
targetcan be dismantled bydoer. Checks thatdoeris a Clockmaker and thattarget(if rechargeable) is fully charged. - Parameters:
target(Entity) — the item to be dismantled; must haverechargeable,itemmimic,lootdropper, andinventoryitemcomponents for full operation.doer(Entity) — the actor attempting the dismantle, must have theclockmakertag.
- Returns:
true(boolean) — if dismantling is allowed.false, "ONCOOLDOWN"(boolean, string) — iftargethasrechargeableand is not charged.
- Error states: Returns
false(without message) ifdoerlacks theclockmakertag.
Dismantle(target, doer)
- Description: Performs dismantling of
target. Iftargetis a mimic, it triggers a revealed transformation and panic reaction. Otherwise, it resolves the crafting recipe fortarget, spawns abrokentool, and drops each ingredient as loot. Items are given to the grand owner’s inventory/container if it’s not a pocket-dimension container; otherwise, loot is dropped atdoer’s position. Thetargetentity is removed after looting. - Parameters:
target(Entity) — the item to dismantle; itsprefabmust exist as a key inAllRecipes.doer(Entity) — the actor performing the dismantle, used for sound, position, and sanity damage (if mimic).
- Returns: Nothing.
- Error states:
- If
targetis a mimic,SpawnPrefab("itemmimic_revealed")may returnnilif prefabs fail, but the component does not explicitly guard against this. - If loot or container operations fail (e.g., full inventory), the game may silently skip dropping items.
- If
Events & listeners
- Listens to: None.
- Pushes: None. Events are handled via calls to other components (
itemmimic:TurnEviltriggersstartledon thedoer;lootdropper:SpawnLootPrefabpusheson_loot_dropped).