Skip to main content

Carnival Gametoken

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

Overview

The carnival_gametoken prefab represents an in-game item that functions as both a consumable and tradable resource, primarily used as bait (e.g., for moles). It is implemented as a Prefab definition with multiple components attached during instantiation, including edible, tradable, inventoryitem, stackable, bait, and inspectable. It is non-sinking by default but configured to sink (SetSinks(true)), and includes a recursive sparkle animation effect.

Usage example

local token = Prefab("carnival_gametoken", fn)
-- Typically spawned via worldgen or crafting, not instantiated directly
-- When added to a player inventory, it inherits:
-- - edible properties (FOODTYPE.ELEMENTAL, hunger value = 2)
-- - stackable capacity (stack size = TUNING.STACK_SIZE_SMALLITEM)
-- - tradability (gold value set via tuning)

Dependencies & tags

Components used: edible, inventoryitem, stackable, tradable, inspectable, bait, hauntablelaunch
Tags: Adds molebait on entity instantiation.

Properties

PropertyTypeDefault ValueDescription
foodtypeFOODTYPE enumFOODTYPE.ELEMENTALType of food; determines compatibility with certain feeders.
hungervaluenumber2Amount of hunger restored when consumed.
goldvaluenumber(commented out)Gold value used in trading; defaults to 0 if not set.
maxsizenumberTUNING.STACK_SIZE_SMALLITEMMaximum stack size.
sinksbooleantrueWhether the item sinks in water (via inventoryitem:SetSinks(true)).

Main functions

shine(inst)

  • Description: Triggers a sparkle animation on the token and schedules the next sparkle after a random delay (4–9 seconds). This creates a recurring visual effect.
  • Parameters: inst (entity instance) — the token instance.
  • Returns: Nothing.
  • Error states: Does nothing if animation "sparkle" is already playing; otherwise overwrites any pending animation queue with "sparkle" followed by "idle".

Events & listeners

  • Pushes: shine recursively schedules itself via inst:DoTaskInTime(...), but does not push any named events.