Skip to main content

Lunar Goop Trail Fx

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

Overview

lunar_goop_trail_fx is a prefab-based entity component that renders a short animated particle trail effect (e.g., for lunar goop projectiles or environmental interactions). It uses an ANIM asset, plays a three-stage animation sequence (_pre → active trail → _pst), handles scaling and timing, and supports cleanup or custom callbacks upon completion. This effect is non-interactive (NOCLICK) and persists only on the client (persists = false on the master), with the transform and AnimState component managing its visual appearance and layering.

Usage example

local inst = SpawnPrefab("lunar_goop_trail_fx")
if inst ~= nil then
inst.components.transform:SetPosition(x, y, z)
inst:SetVariation(2, Vector(1, 1, 1), 1.5)
end

Dependencies & tags

Components used: transform, animstate, network
Tags: Adds FX, NOCLICK

Properties

PropertyTypeDefault ValueDescription
trailnamestring"trail1"Base animation name used to construct pre-active-post animation sequences (trailname.."_pre", trailname, trailname.."_pst").
durationnumber1Duration in seconds the active animation plays before initiating the fade-out stage.
tasktask (optional)nilActive timer used to schedule the fade-out stage; cancels on SetVariation or Dissipate.
onfinishedfunction (optional)nilOptional callback executed when the post-fade animation completes.

Main functions

SetVariation(rand, scale, duration)

  • Description: Updates the effect’s animation variation, scale, and duration, restarting the animation sequence from the pre-stage. Typically used to randomize or adjust trail appearance dynamically.
  • Parameters:
    rand (number) - Integer index (1–3+) determining which trail animation to use (trailX).
    scale (Vector or number) - Uniform scale factor applied to the entity (Vector(x, y, z) or single scalar).
    duration (number) - Duration (in seconds) to hold the active trail animation before fading.
  • Returns: Nothing.
  • Error states: Cancels any existing task before setting up a new animation sequence.

Dissipate()

  • Description: Immediately initiates the fade-out (_pst) animation stage, cancelling any pending active-duration task. Useful for prematurely ending the trail effect.
  • Parameters: None.
  • Returns: Nothing.
  • Error states: If no active task exists, sets duration to 0 to trigger instant fade-out.

Events & listeners

  • Listens to: animover - triggers OnAnimOver to transition from pre → active → post animation stages and finalize cleanup.
  • Pushes: None identified.