Log inGet started
◇
component · drop-in viewer
asset⌬ componentcomponentprimary: init.luau·part ofassettype effect.assetType·originates fromworld 07158574-5…

Effect

Plays one entry of an effect on its entity. Every graph the entry holds runs on a Generator under this entity, from the same moment, each given the inputs it declares; the entity's transform is where the effect stands, and it moves with the entity. `effectRef:play` hands these ou…

by◐lumi·posted 1mo ago
What it does

Effect

Plays one entry of an effect on its entity. Every graph the entry holds runs on a Generator under this entity, from the same moment, each given the inputs it declares; the entity's transform is where the effect stands, and it moves with the entity. effectRef:play hands these out from gameplay; one placed in a scene, or dropped into the viewport, plays the same way.

Fields

FieldWhat it does
effectThe effect this plays.
entryThe entry it plays, as the effect's effect.yaml lists it under plays; empty plays the effect's default.
inputsValues for the entry's inputs, by input name; an input left out takes its default. A name no graph of the entry declares is refused, naming the inputs it does take.
playOnWhat starts it in play mode: load plays as soon as it binds, manual waits for play(). In edit mode an Effect is not set to play, whatever playOn says: it shows the frame it is on until it is played.
endingAt the end of its timeline: graph does what the timeline declares, loop plays it round again, hold stays on the last frame.
speedHow fast it plays: 1 its own rate, 0 still, negative backwards through a timeline with an end.

Methods and events

play() plays the entry from its start; pause(), resume(), seek(seconds) and stop() drive it, and stop() also takes what it shows away. set(input, value) changes one input. getTime() and isFinished() read where it stands, isPrepared() whether its graphs have done the work its first frame needs (every frame of a timeline with an end cooked, one with no end on the device), cookError() why a graph's latest cook failed while one does (the check to make each frame while waiting for isPrepared()), and playback() what it costs: the entry's combined numbers, and each graph's own playback() under graphs. onFinished fires when every graph of the entry has reached the end of its timeline.

From gameplay

A shot, a hit or an explosion is a play of an effect's entry, from the effect itself; it is kept ready and goes back to be played again when it finishes:

local beacons = asset.resolve("beacons", "effect")
beacons:play("flare", { root = mast, offset = { 0, 0.9, 0 }, inputs = { size = 0.4 } })

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

Effect: plays one entry of an effect on its entity. Every graph the entry holds runs on a Generator under this entity, from the same moment, each given the inputs it declares; the entity's transform is where the effect stands. The post-processing the effect carries (`post` in its effect.yaml) stands as a `PostProcess` region under the entity while the entry plays. `effectRef:play` hands these out from gameplay, and one placed in a scene plays the same way.

GeneratorPostProcess

postLive(live: boolean) → void

Make the carried post-processing live or not.

argtypedescription
liveboolean

onGeneratorFinished( ) → void

clear( ) → void

bind(cooperative: boolean?) → void

Bind the entry the fields name: a child with a Generator for each of its graphs, still until played. `cooperative` is true from a task, where describing the effect's graphs hands the frame back between them.

argtypedescription
cooperativeboolean?

childrenStand( ) → boolean

Whether every child entity the entry was bound with is still in the scene: a Generator an author deleted takes its graph's play with it, and the entry is bound again before it plays.

showWhenStanding(started: number) → void

Bring each graph's Generator into the scene once it stands on what the start numbered `started` asked of it: at once for one that stands ready, and for one that cooks first (given inputs other than the ones it last played, or not yet cooked) once that cook's first frame stands, or its clock has run past the frame it held while the cook ran, so what a graph shows of an earlier play never stands at the place this play stands.

argtypedescription
startednumber

start( ) → void

routeInputs( ) → void

Give each Generator its share of the inputs, where it changed.

bindLater( ) → void

Bind the entry in a task, handing the frame back between the effect's graphs, and play it when it is bound if a play was asked for meanwhile.

awake( ) → void

onPropertyChanged(key: ?, _value: ?, _oldValue: ?) → void

argtypedescription
key?
_value?
_oldValue?

onDestroy( ) → void

play( ) → void

Play the entry from its start, on every peer.

examples

effect:play()

set(input: string, value: any) → void

Set one of the entry's inputs, on every graph of it that declares it.

argtypedescription
inputstringThe input's name.
valueanyIts value.

examples

effect:set("intensity", 0.5)

pause( ) → void

Stop the entry's clock where it is.

examples

effect:pause()

stop( ) → void

Stop the entry and take what it shows away; `play()` starts it again. A play `effectRef:play` handed out goes back to be played again.

examples

effect:stop()

resume( ) → void

Run the entry's clock again from where it was paused.

examples

effect:resume()

seek(seconds: number) → void

Move the entry to `seconds` from its start and show that moment.

argtypedescription
secondsnumberTime from the start of the entry's timeline.

examples

effect:seek(1.5)

getTime( ) → number

Where the entry's clock stands, in seconds from its start.

examples

local t = effect:getTime()

prepare( ) → void

Make the entry's first frame stand ready without playing it: every graph of the entry is bound, planned and cooked, and the frame at the start of its timeline presented, whether or not this entity is in the scene yet. The work runs over the frames after the call; `isPrepared` says when it is done, and a `play()` after that shows what stands.

examples

effect:prepare()

isPrepared( ) → boolean

Whether every graph of the entry has its first frame presented and nothing asked of it (each Generator's `isReady`), so `play()` shows what stands.

examples

if effect:isPrepared() then effect:play() end

fxSources( ) →

What a program over many copies of each graph of the entry is made from: for each graph in the entry's order, what its Generator's `fxSource` answers (or why not, and whether it never will), the child entity the graph plays on, and the graph as the entry lists it.

examples

local sources = effect:fxSources()

cookError( ) → string

Why the latest cook of a graph of the entry failed, while one does (the first graph's in the entry's order, each Generator's `cookError`); nil otherwise. Reads no more than that, so a caller waiting a frame at a time for the entry to stand prepared can watch for a failure every frame.

examples

if effect:cookError() ~= nil then print(effect:cookError()) end

isFinished( ) → boolean

Whether every graph of the entry has reached the end of its timeline since it was last played.

examples

if effect:isFinished() then effect:play() end

playback( ) → any

Where the entry stands and what playing it has cost: `{ playing, finished, time, heldFrames, cost, graphs }`. `cost` holds the counters of every graph's Generator added together (`frameMs`, `cookMs`, `cooks`, `memoPresents`, `devicePresents`, `deviceMs`, `framePresents`, `realizeMs`) and `frames`, the most frames any one graph presented, so `(frameMs + cookMs) / frames` is the entry's cost a frame. `heldFrames` is true when every graph plays from the frames the engine holds. `graphs` is one `{ graph, playback }` per graph of the entry, in its order, each `playback` the graph's Generator's own `playback()`.

examples

local p = effect:playback()
print((p.cost.frameMs + p.cost.cookMs) / p.cost.frames)

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.