Lavae
Based on game build 714014 | Last updated: 2026-03-05
Overview
lavae is a temporary boss/minion entity that spawns during volcanic activity. It operates as a mobile combat unit with a predetermined lifespan, using a custom brain (lavaebrain) and state graph (SGlavae). It selects targets dynamically from its mother entity's target list, maintains range and attack timing, and automatically destroys itself when its lifespan expires. It is immune to fire damage and electric damage, and ignites flammable entities on physical contact.
Usage example
local inst = SpawnPrefab("lavae")
if inst ~= nil then
-- Lavae is fully self-contained; no further setup required
-- It will track targets, fight, and self-destruct automatically
print("Lavae spawned with health:", inst.components.health.currenthealth)
end
Dependencies & tags
Components used: health, combat, lootdropper, inspectable, locomotor, homeseeker, entitytracker, timer, transform, animstate, soundemitter, dynamicshadow, light, physics, network
Tags added: lavae, monster, hostile, electricdamageimmune
Tags checked: fireimmune, controlled_burner, player
Properties
No public properties are exposed beyond standard component members.
Main functions
OnCollide(inst, other)
- Description: Called when this entity collides with another; ignites
burnableentities that are not fueled (e.g., plants, trees). - Parameters:
inst(Entity) – this lavae instance.
other(Entity) – the entity collided with. - Returns: Nothing.
- Error states: Only ignites if
otheris valid, hasburnable, and lacksfueledcomponent.
RetargetFn(inst)
- Description: Function assigned to
Combat:SetRetargetFunction; selects a new target from the mother entity’s group target list if no current target exists. - Parameters:
inst(Entity) – this lavae instance. - Returns:
nilorEntity– the closest entity to the mother in the target list. - Error states: Sets
inst.reset = trueand triggers removal if the mother entity is missing.
KeepTargetFn(inst, target)
- Description: Function assigned to
Combat:SetKeepTargetFunction; determines if the current target should be retained based on proximity to the mother entity. - Parameters:
inst(Entity) – this lavae instance.
target(Entity) – the current combat target. - Returns:
trueif the mother is within 75 units of the target; otherwisefalse.
LockTarget(inst, target)
- Description: Utility function exposed on
instto programmatically set a new combat target. - Parameters:
inst(Entity) – this lavae instance.
target(Entity) – the desired target. - Returns: Nothing.
OnNewTarget(inst, data)
- Description: Listener for
newcombattarget; manages death callback for player targets. - Parameters:
inst(Entity) – this lavae instance.
data(table) –{ oldtarget = Entity?, target = Entity? }. - Returns: Nothing.
- Error states: Only registers death callback if
data.targetexists and has theplayertag.
OnTimerDone(inst, data)
- Description: Timer callback for
selfdestructtimer; kills the lavae when lifespan expires. - Parameters:
inst(Entity) – this lavae instance.
data(table) –{ name = "selfdestruct" }. - Returns: Nothing.
OnEntitySleep(inst)
- Description: Listener for
entitysleep; removes the entity ifinst.resetis true (e.g., mother missing). - Parameters:
inst(Entity) – this lavae instance. - Returns: Nothing.
Events & listeners
- Listens to:
timerdone– triggersOnTimerDoneto kill self upon lifespan expiry.
newcombattarget– triggersOnNewTargetto update death callbacks.
entitysleep– triggersOnEntitySleepto clean up orphaned minions. - Pushes: None directly; relies on core components for event emission.