Fx
Based on game build 722832 | Last updated: 2026-04-28
Overview
fx.lua is a data configuration file that defines a comprehensive table of visual effect configurations and local helper functions for animation state manipulation in Don't Starve Together. The file contains effect definitions for splash effects, transformation effects, buff effects, environmental FX, turf effects, wagpunk, slingshot, and WX78 shield animations. Helper functions configure animation state properties such as final offset, bloom effects, orientation, and layer settings. This file is required by other systems that need to spawn or configure visual effects on entities.
Usage example
local fx = require("fx")
-- Access a specific effect configuration from the fx table
local splash_fx = fx.splash
-- Apply a helper function to configure an entity's animation state
local effect_entity = SpawnPrefab("fx_splash")
if effect_entity ~= nil then
fx.FinalOffset1(effect_entity)
fx.Bloom(effect_entity)
fx.GroundOrientation(effect_entity)
end
-- Use WX78 shield effect functions
fx.Wx78ShieldFn(effect_entity)
Dependencies & tags
External dependencies:
FRAMES-- Animation frame constant used in timing calculations and position updatesTUNING-- Accesses TUNING.OCEAN_SHADER.EFFECT_TINT_AMOUNT for ocean blend parametersSTRINGS-- Accesses STRINGS.NAMES.MOLE_UNDERGROUND for mole effect name overrideVector3-- Creates color tint and transform scale vectors for effectsANIM_ORIENTATION-- Sets animation orientation to OnGround for ground-level effectsLAYER_BACKGROUND-- Sets animation layer for background renderingLAYER_WORLD_BACKGROUND-- Sets animation layer for world background renderingLAYER_BELOW_GROUND-- Sets animation layer for below-ground renderingANIM_SORT_ORDER-- Sets animation sort order for proper rendering depthANIM_SORT_ORDER_BELOW_GROUND-- Sets animation sort order for below-ground elements like boat trailsGetString-- Retrieves localized description strings for mole underground effectLAYER_GROUND-- Animation layeringFinalOffset1-- Referenced as fn callbackFinalOffset2-- Referenced as fn callbackFinalOffset3-- Referenced as fn callbackErodeAway-- Called in degrade_fx_ice fnGetRandomWithVariance-- Called in degrade_fx_ice fn
Components used:
AnimState-- SetScale, SetMultColour, SetFinalOffset, PlayAnimation, SetOrientation, SetLayer, SetSortOrder, SetBloomEffectHandle, SetLightOverride, Hide, OverrideSymbol, SetFrame, SetAddColour, SetSymbolBloom, SetSymbolLightOverrideTransform-- SetFourFaced, SetScale, SetPosition, GetWorldPositionSoundEmitter-- PlaySound, PlaySoundWithParams, KillSoundentity-- AddSoundEmitter, GetParent, SetParent
Tags: None identified
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
SHOT_TYPES | table | {} | Table defining available shot types for the weapon. |
SPECIFIC_HITFX_ANIM | table | {} | Table mapping hit effects to specific animations. |
FX_SIZES | table | {"tiny", "small", "med", "large"} | Valid size identifiers for visual effects. |
FX_HEIGHTS | table | {"_low", "", "_high"} | Valid height identifiers for visual effects (empty string = medium). |
WX_SHIELD_COLOUR | table | {243/255, 187/255, 6/255} | RGB color values for WX-78 shield effect. |
DELAY_SHIELDFX_SET_NO_PARENT | number | 11 * FRAMES | Frame delay before shield effect clears parent reference. |
Main functions
Events & listeners
None.