Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage effectShowcase.package·originates fromworld 0fc7535e-6…

schedule

The storm's clock. Every strike is a pure function of the storm phase, so the storm graph (as expressions over its own time) and the director (as Luau over the generator's clock) agree exactly, and the whole storm loops every `PERIOD` seconds.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

schedule

The storm's clock. Every strike is a pure function of the storm phase, so the storm graph (as expressions over its own time) and the director (as Luau over the generator's clock) agree exactly, and the whole storm loops every PERIOD seconds.

Two assets require it: the storm graph beside it (storm.procGraph, which builds its flash, bolt and burst expressions from STRIKES, flashExpr, envelopeExpr and windowOne) and the StormDirector component of the Procgen Effects Showcase world (lights, materials and thunder from phase, envelope, afterglow and STRIKES).

Exports

Values

  • M.PERIOD: 13.6, the loop length in seconds.

  • M.OFFSET: 5.006, the phase the storm is in at graph time 0. A strike has just landed there, so a paused frame is a hero frame.

  • M.STRIKES: the four strikes, each { t, kind, target, top, variant, weight }. t is the phase the strike lands at, target where it lands, top where the bolt starts, and weight its brightness weight. kind is "ground" (throws sparks and smoke where it hits) or "tower" (hits the finial). target and top are in the storm graph's own space, where the tower stands at the origin; in the world they stand where the entity playing the graph does.

    tkindtargettopvariantweight
    1.6ground{ 15, 0, -8 }{ 3, 135, -2 }11.0
    5.0tower{ 0.05, 48.6, 0.1 }{ -7, 135, 5 }21.2
    8.6ground{ -19, 0, 7 }{ -30, 135, 12 }31.0
    11.0tower{ 0.05, 48.6, 0.1 }{ 9, 135, 6 }41.3
  • M.PULSES: the return strokes of a strike, each { delay after the leader, strength, decay rate per second }: { 0.00, 1.00, 30 }, { 0.11, 0.80, 26 }, { 0.24, 0.62, 20 }, { 0.43, 0.36, 11 }.

Functions

  • M.phase(t): the storm phase at graph time t, (t + OFFSET) % PERIOD.
  • M.envelope(ph, s): how bright strike s is at phase ph: 0 before the strike, about 1 at the return stroke. It sums every pulse whose delay has passed, each decaying exponentially at its rate.
  • M.afterglow(ph, s): the cloud glow that lingers after strike s, at phase ph: 0.55 * exp(-d * 1.7) * min(d * 20, 1) for d seconds after the strike, 0 before it.
  • M.envelopeExpr(s): the same envelope as envelope, written as an anim expression string over t.
  • M.afterglowExpr(s): the same afterglow as afterglow, as an expression string over t.
  • M.flashExpr(): the scene-wide flash as an expression string: the sum of every strike's envelope times its weight, capped at 3.
  • M.windowExpr(only, lag, rise, fall): a burst of activity lag seconds after each strike, as a bump expression in [0, 1]: it rises with min(d * rise, 1) and falls with exp(-d * fall). only limits it to strikes of one kind ("ground" or "tower"); nil includes every strike.
  • M.windowOne(s, lag, rise, fall): the same bump for strike s alone.

Usage

local S = require("~.storm.schedule")

local generator = entity.find("storm").component("Generator")
local ph = S.phase(generator:getTime())
local flash = 0
for _, strike in ipairs(S.STRIKES) do
    flash += S.envelope(ph, strike) * strike.weight
end

-- the same flash, as an anim expression for a procGraph
local flashExpr = proc.anim.expr(S.flashExpr())

-- a burst 0.15 s after each ground strike
local bursts = S.windowExpr("ground", 0.15, 12, 1.0)

Interface

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

conforms to

zero/source-extract/v2

The storm's clock. Every strike is a pure function of the storm phase, so the graph (as expressions over its own time) and the director (as Luau over the generator's clock) agree exactly, and the whole thing loops seamlessly every PERIOD seconds.

phase(t: number) → number

argtypedescription
tnumber

envelope(ph: number, s: ?) → number

The strike envelope, numerically: how bright strike `s` is at phase `ph` (0 dark, ~1 at the return stroke).

argtypedescription
phnumber
s?

afterglow(ph: number, s: ?) → number

Cloud glow that lingers after a strike, numerically.

argtypedescription
phnumber
s?

envelopeExpr(s: ?) → string

The same envelope written as an anim expression over `t`.

argtypedescription
s?

afterglowExpr(s: ?) → string

argtypedescription
s?

flashExpr( ) → string

Sum of every strike's envelope (weighted), as an expression: the scene-wide flash.

windowExpr(only: string?, lag: number, rise: number, fall: number) → string

A burst of activity `lag` seconds after each strike lasting about `span`: a bump expression in [0,1]. `only` limits it to strikes of one kind ("ground" / "tower"); pass nil for every strike.

argtypedescription
onlystring?
lagnumber
risenumber
fallnumber

windowOne(s: ?, lag: number, rise: number, fall: number) → string

The same bump for one strike alone.

argtypedescription
s?
lagnumber
risenumber
fallnumber
⌬ Metadata
descriptionThe lightning storm's shared clock: strike schedule, flash and afterglow envelopes, and the same curves as procGraph anim expressions.

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

3items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · effectShowcase.package/storm/schedule.module

Problems

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

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬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.