Skip to main content

Birdattractor

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

Overview​

BirdAttractor is a lightweight component designed to track and compute modifiers that influence how birds (such as Butterflies, Pigs, or other bird-like creatures) are spawned in the world. It uses a SourceModifierList to manage additive modifiers keyed by "maxbirds", "mindelay", and "maxdelay". It is typically attached to entities that act as environmental attractors (e.g., structures, terrain features) influencing bird population or spawn timing in their vicinity.

Usage example​

local inst = CreateEntity()
inst:AddComponent("birdattractor")
-- Example: boost max birds by +2 from a nearby beacon
inst.components.birdattractor.spawnmodifier:ApplyModifier("maxbirds", 2, "beacon")

Dependencies & tags​

Components used: None identified.
Tags: None identified.

Properties​

PropertyTypeDefault ValueDescription
instEntitynilThe entity instance that owns this component.
spawnmodifierSourceModifierListInitialized with 0 and additive modeHolds additive modifiers for spawn parameters: "maxbirds", "mindelay", "maxdelay".

Main functions​

GetDebugString()​

  • Description: Returns a formatted string containing the current computed modifier values for "maxbirds", "mindelay", and "maxdelay". Used for debugging and debugging UI.
  • Parameters: None.
  • Returns: string — Example: "maxbirds:3, mindelay:10, maxdelay:30".
  • Error states: Returns nil if CalculateModifierFromKey() fails for any key (though unlikely, due to default value 0 in SourceModifierList).

Events & listeners​

None identified.