Skip to main content

Emitter

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

Overview

Emitter is a lightweight component responsible for emitting particles from an entity over time. It supports both legacy ParticleEmitter and modern VFXEffect systems, selecting the appropriate one based on what is attached to the entity. The component calculates particle production rates based on tick time and manages particle count limits using configurable density and lifetime factors. It integrates with the global EmitterManager system to schedule periodic updates.

Usage example

local inst = CreateEntity()
inst:AddComponent("emitter")

inst.components.emitter.max_lifetime = 2.0
inst.components.emitter.ground_height = 0.5
inst.components.emitter.density_factor = 1.5
inst.components.emitter.config = { max_num_particles = 100 }

inst.components.emitter.area_emitter = function()
return 0, 0, 0 -- center emission point
end

inst.components.emitter:Emit()

Dependencies & tags

Components used: None identified
Tags: None identified

Properties

PropertyTypeDefault ValueDescription
instEntitynil (assigned in constructor)The entity instance this component is attached to.
area_emitterfunctionfunction() print("no emitter") endCallback that returns (x, z) coordinates for particle spawn position.
configtable{}Configuration table, expected to contain max_num_particles.
max_lifetimenumber1Maximum lifetime (in seconds) for emitted particles. Actual lifetime is randomized within ±10% of this value.
ground_heightnumber1Vertical (y) position where particles are emitted.
particles_per_ticknumber1Estimated number of particles to emit per tick (derived from desired rate and tick duration).
num_particles_to_emitnumber1Current accumulated particle count scheduled for emission.
density_factornumber1Multiplier applied to particle counts and lifetimes for scaling emission intensity.

Main functions

Emit()

  • Description: Starts the particle emission process by registering an update function with EmitterManager. It calculates per-tick emission rates and configures particle limits for both legacy and modern VFX systems. Does not emit particles immediately — it schedules periodic emission updates.
  • Parameters: None.
  • Returns: Nothing.
  • Error states: If neither VFXEffect nor ParticleEmitter is present on self.inst, the component will silently fail to emit (no particles added, but no error thrown).

Events & listeners

  • Listens to: None identified
  • Pushes: None identified