Skip to main content

Firebug

Overview

This component controls a periodic behavior where the entity spawns a fire prefab at its location and emits a predefined sound/announcement after an initial delay, then repeats at randomized intervals. It supports disabling via a sanity threshold and manages its own update loop lifecycle.

Dependencies & Tags

  • Requires components: talker, transform, and optionally sanity
  • No tags are added or removed
  • Uses global functions: GetString, SpawnPrefab, math.random

Properties

PropertyTypeDefault ValueDescription
time_to_firenumber60Time (in seconds) remaining until the next fire event.
time_intervalnumber120Base interval (in seconds) between fire events.
time_variancenumber120Maximum random variance (in seconds) added to time_interval to compute next fire time.
sanity_thresholdnumber?nilIf set, the behavior is skipped while sanity is at or above this threshold during insanity mode.
prefabstring?nilPrefab name of the fire to spawn; if nil, no fire is spawned.
enabledbooleanfalse (initially)Whether the component is active and updating. Set to true on construction.

Main Functions

Enable(enable)

  • Description: Enables the component. If not already enabled, starts the update loop via StartUpdatingComponent.
  • Parameters: enable — Optional boolean (unused in current implementation; method always enables if called).

Disable()

  • Description: Disables the component. Stops the update loop via StopUpdatingComponent if currently active.
  • Parameters: None.

OnUpdate(dt)

  • Description: Core logic invoked each frame. Decrements time_to_fire until it expires, then triggers a talker announcement and optionally spawns a fire prefab. Resets time_to_fire with a randomized interval.
  • Parameters: dt — Time (in seconds) since last frame.

GetDebugString()

  • Description: Returns a human-readable debug string showing current state.
  • Parameters: None.

Events & Listeners

  • Listens to component update (via StartUpdatingComponent/StopUpdatingComponent) but no explicit ListenForEvent calls.
  • Does not push or trigger any events.