Skip to main content

Critterlab

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

Overview

critterlab is a static decorative environment prefab that functions as a lab-themed critter den. It plays idle animations and ambient sounds when active, supports turning on/off via the prototyper component, and contributes to the world’s aesthetic and functional craftability system. It is commonly used in prefabricated rooms and world layouts. The prefab does not host logic itself but delegates behavior to attached components, notably prototyper and hauntable.

Usage example

-- Typically instantiated internally by the worldgen system
local inst = Prefab("critterlab", fn, assets, prefabs)

-- After creation, the component behavior is controlled automatically:
-- - When turned on: plays idle sound and random proximity animations
-- - When turned off: stops sound and animations
-- - Can be hauntable by players (e.g., via hauntable component behavior)

Dependencies & tags

Components used: animstate, transform, minimapentity, soundemitter, network, inspectable, prototyper, hauntable
Tags added: critterlab, antlion_sinkhole_blocker, prototyper

Properties

PropertyTypeDefault ValueDescription
idletaskTask or nilnilHolds the scheduled idle animation task; set/cleared by blink() and onturnoff().
scrapbook_specialinfostring"CRITTERDEN"Metadata used by the game to categorize this entity in the scrapbook.
prototyper.treesTechTreeTUNING.PROTOTYPER_TREES.CRITTERLABCrafting trees associated with this prototyper.
hauntable.hauntvaluenumberTUNING.HAUNT_TINYHaunt value applied when players approach or interact.

Main functions

blink(inst)

  • Description: Plays a randomly selected proximity loop animation ("proximity_loop1""proximity_loop4") and schedules the next blink after a random delay (1.0–2.0 seconds).
  • Parameters: inst (Entity) – The entity instance.
  • Returns: Nothing.
  • Error states: None. Only active when onturnon has been called and idletask is not nil.

onturnoff(inst)

  • Description: Stops idle animations and sound loop when the prototyper is turned off.
  • Parameters: inst (Entity) – The entity instance.
  • Returns: Nothing.
  • Error states: Safely handles missing idletask by checking for nil before canceling.

onturnon(inst)

  • Description: Starts the idle sound loop and initiates blinking animation when the prototyper is turned on.
  • Parameters: inst (Entity) – The entity instance.
  • Returns: Nothing.

Events & listeners

  • Listens to: None explicitly defined in this file. Event interactions occur via component callbacks (onturnon, onturnoff).
  • Pushes: None.

External component behaviors used:

  • inst.components.prototyper.onturnon / onturnoff – Hooked to onturnon/onturnoff functions above.
  • inst.components.hauntable:SetHauntValue() – Sets haunt threshold to TUNING.HAUNT_TINY.
  • inst.components.prototyper.trees – Assigned TUNING.PROTOTYPER_TREES.CRITTERLAB.