Megaflare
Based on game build 714014 | Last updated: 2026-03-05
Overview
The megaflare is a deployable item prefab that serves as a high-impact visual signal device. When ignited, it triggers a detonation sequence that plays sound effects, updates the HUD overlay for nearby players, notifies other players via speech, and spawns temporary minimap markers. It uses components like burnable, propagator, and inventoryitem, and interacts with the minimap and HUD systems via specialized client-side functions. It does not function as a damage-dealing propagator — its heat and damage output are explicitly disabled.
Usage example
local flare = SpawnPrefab("megaflare")
flare.Transform:SetPosition(x, y, z)
flare:DoTaskInTime(5, function()
if flare ~= nil and flare:IsValid() then
flare.components.burnable:Ignite()
end
end)
Dependencies & tags
Components used: burnable, propagator, tradable, inspectable, inventoryitem, hauntable
Tags: donotautopick (added on spawn)
Notable external components accessed: talker (via player.components.talker:Say()), minimap (via MiniMapEntity), hud (via ThePlayer.HUD)
Properties
No public properties are exposed directly by the prefab constructor or component functions. State is managed via local variables (inst._megaflarecooldown, inst._small_minimap, inst.flare_igniter) and component-backed fields (e.g., inst.components.propagator.heatoutput).
Main functions
flare_fn()
- Description: The core prefab factory function that creates and configures the main megaflare entity. It sets up animation, physics, inventory behavior, and component hooks, including attaching the
burnablecomponent withon_igniteas its ignition handler. - Parameters: None.
- Returns:
inst— The fully configured entity instance. - Error states: Returns early on the client if
TheWorld.ismastersimisfalse(i.e., non-authoritative simulation).
flare_minimap()
- Description: Factory function for the minimap marker entity used during detonation — spawns
megaflare_minimapprefabs to enhance local minimap visibility. - Parameters: None.
- Returns:
inst— The minimap marker entity. - Error states: None identified.
on_ignite(inst, source, doer)
- Description: Callback registered via
burnable:SetOnIgniteFn(). Initiates the detonation process when the flare is lit: disables saving, disables sleep, plays fire animation, registersanimoverlistener, and plays launch sound. - Parameters:
inst(Entity) — The megaflare instance.source(Entityornil) — The source of ignition (e.g., fire).doer(Entityornil) — The entity that directly ignited the flare (e.g., player).
- Returns: Nothing.
- Error states: Assigns
inst.flare_ignitertodoer or source or nil— may benilif both are missing.
on_ignite_over(inst)
- Description: Callback triggered after the "fire" animation completes. Finalizes detonation: spawns minimap flash indicators, notifies nearby players via speech, emits global event
megaflare_detonated, and removes the flare entity. - Parameters:
inst(Entity) — The megaflare instance. - Returns: Nothing.
- Error states:
inst.flare_igniteris cleaned up if invalid before event push.
show_flare_hud(inst)
- Description: Client-side function that plays detonation sound if not on cooldown and updates the HUD overlay based on player proximity. Invokes
SetupHudIndicator()for longer-distance detection. - Parameters:
inst(Entity) — The megaflare instance. - Returns: Nothing.
- Error states: Returns early if
ThePlayerisnil.
show_flare_minimap(inst)
- Description: Client-side (and master sim) function that spawns and configures a
globalmapiconentity to mirror the flare’s minimap presence. Also schedules periodic minimap icon swapping viado_flare_minimap_swap. - Parameters:
inst(Entity) — The megaflare instance. - Returns: Nothing.
- Error states: None identified.
Events & listeners
-
Listens to:
animover— fireson_ignite_overafter the "fire" animation completes.ondropped— triggerson_dropped(plays "place" animation then reverts to "idle").floater_startfloating— plays "float" animation.floater_stopfloating— plays "idle" animation.onremove— triggersRemoveHudIndicatorto clean up HUD indicator.
-
Pushes:
startflareoverlay— client event (viaThePlayer:PushEvent()) to trigger HUD overlay (only if close enough).megaflare_detonated— global world event with{sourcept, pt, igniter}payload upon detonation.