Fueltank
Module: fueltank.lua
Overview
The Fueltank module manages the visual effects associated with a fuel tank object. Specifically, it handles starting and stopping flame and smoke emitters when certain state changes occur.
Inheritance
- Inherits from:
none β base/utility module - Imports:
none
Instance pattern
This is a stateless manager/utility module (no per-instance tables). It does not track any specific state fields.
Functions
OnStateChange(uiGuid, uiNodeHashName, uiStateHashName)
Engine-invoked lifecycle hook (see Events below) called when the objectβs world-state node changes. Converts uiStateHashName to a string via Sys.GuidToString and compares against the literal "0x7687DF41". On match, starts the "fx_EmitFlameOilrigTower" emitter via ObjectState.StartEmitter and schedules _StartSmoke after a random Math.randf(12, 20)-second delay using Event.TimerRelative. Any other state hash is ignored (no else branch).
_StartSmoke(uiGuid, uiNodeHashName, fxName)
Helper invoked only via the timer set up in OnStateChange. Stops the emitter named by fxName (the flame effect) and starts a new "fx_EmitSmokeStack" emitter in its place.
Events
OnStateChange(uiGuid, uiNodeHashName, uiStateHashName)is an engine-invoked callback, not something this file registers withEvent.Createβ the same naming/signature convention appears across other resident files (e.g.oilrig.lua,islandfortress.lua). NoEvent.StateChangeconstant is referenced anywhere in this file.Event.TimerRelativeβ the only realEvent.Createcall in this file, used to delay_StartSmokeafter the flame starts.
Module constants & tunables
- Trigger state hash:
"0x7687DF41"βOnStateChangeonly reacts when the incoming state hash stringifies to this value; every other state is ignored. - Emitters (looked up via
ObjectState.GetStringHash): flame"fx_EmitFlameOilrigTower"(started on the trigger) then"fx_EmitSmokeStack"(swapped in by_StartSmoke). Swap these two strings to re-skin the burn. - Flame-to-smoke delay:
Math.randf(12, 20)seconds (inline literal).
Notes for modders
- The two emitter template strings are the whole mod lever here β change
"fx_EmitFlameOilrigTower"/"fx_EmitSmokeStack"to alter the flame/smoke visuals, or theMath.randf(12, 20)range to change how long the flame burns before it becomes a smoke stack. OnStateChangeis engine-invoked and gated on the exact hash"0x7687DF41"; if you retarget it to a different world-state, change that literal to match the new stateβs hash.- The same
OnStateChange(uiGuid, uiNodeHashName, uiStateHashName)emitter-swap convention shows up on oilrig and islandfortress β those are the pages to compare against for the wider destructible-FX pattern.