Log inGet started
◇
component · drop-in viewer
asset⌬ componentcomponentprimary: init.luau·originates fromworld 0fc7535e-6…

ShieldFxDriver

ShieldFxDriver runs the energy-shield effect from the `ShieldFx` module around the entity it sits on. The dome is centred on the entity's position, incoming fire hammers it, and the impact lights named by `lights` flash where each shot lands. It runs while the scene is authored a…

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

ShieldFxDriver

ShieldFxDriver runs the energy-shield effect from the ShieldFx module around the entity it sits on. The dome is centred on the entity's position, incoming fire hammers it, and the impact lights named by lights flash where each shot lands. It runs while the scene is authored and while it plays.

The fx_shield scene uses it on the ShieldDome entity (which also carries a Model), with radius = 9 and lights = "ImpactLight"; the scene holds the lights ImpactLight1 to ImpactLight4.

It requires ShieldFx (require("ShieldFx")). The impact lights are entities named lights followed by 1, 2, 3 and so on, each with a Light component.

Fields

FieldTypeDefaultDescription
radiusnumber9The dome's radius, in metres.
lightsstring"ImpactLight"The name every impact light starts with; the entities named it followed by 1, 2, 3 and so on flash at each impact.

Both fields are Sync.

Lifecycle

  • start(): calls ShieldFx.start, with center set to the entity's position and radius set to the radius field, and keeps the token it returns. It then collects the impact lights, looking up lights .. 1, lights .. 2 and onward for as long as each name finds an entity with a Light component, and hands them to ShieldFx.attachLights.
  • update(dt): calls ShieldFx.step(dt).
  • editorUpdate(dt): calls ShieldFx.step(dt) while engine.paused is true.
  • onDestroy(): calls ShieldFx.stop(token) with the token from start.

Interface

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

conforms to

zero/source-extract/v2

component

begin( ) → void

start( ) → void

update(dt: number) → void

argtypedescription
dtnumber

editorUpdate(dt: number) → void

argtypedescription
dtnumber

onDestroy( ) → void

⌬ Metadata
descriptionRuns the ShieldFx energy-shield dome around its entity and flashes the numbered impact lights where each shot lands.

Sub-parts

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

Showing up to 3 levels deep. Open a part to see what it holds further down.

7+items
▣
module · born here
❒asset
# ShieldFx ShieldFx is the energy-shield dome hero effect. Tracer shots fly in from far out, low over the horizon, singly and in volleys, and strike a dome of a given radius. Each impact throws a flare, sparks and burning fragments that fall under gravity and bounce off the dome and the ground, flashes a pooled impact light, and records the hit in a table the dome and ground shaders read. Everything drawn as particles is an instance in one of four GPU-instanced draws (one draw call per pool), whose transform and data buffers the module writes each frame. The hit table goes to two materials as one batched property set each per step. `ShieldFxDriver` uses it: that component starts it centred on its entity, steps it every frame and stops it on destroy. The module resolves these materials by name, so the world holds them: - `shield_dome_mat` and `ground_arcs_mat`: receive `center` (the dome centre's three coordinates followed by the radius) at start, and `hit0` to `hit11` plus `strain` every step. - `fx_streak_mat` (tracers), `fx_flare_mat` (flares), `fx_spark_mat` (sparks) and `fx_frag_mat` (fragments): the materials of the four instanced draws. ## Exports - `M.start(opts)`: builds a run. If one is already running it is stopped first. `opts.radius` sets the dome radius (default 9) and `opts.center` its centre as a three-number array (default `{ 0, 0, 0 }`). It resets the simulation, sets `center` on the dome and ground materials, and creates the four pools `streak` (16 instances), `flare` (12), `spark` (260) and `frag` (90). Each pool has a mesh, two GPU substrate buffers (for the streak pool, `shieldfx.streak.xf` holding mat4 transforms and `shieldfx.streak.dat` holding vec4 data; the other pools follow the same naming), and one instanced draw with shadows off. Returns a token table that identifies this run. - `M.attachLights(list)`: takes a list of `{ ent = entity, comp = lightComponent }` entries. Each impact moves the light whose last impact is oldest to the impact point, and its intensity then decays from `160 * strength`. - `M.hit(dx, dy, dz, s)`: forces an impact on the dome in the direction `(dx, dy, dz)` (normalised by the call) with strength `s` (default 1). - `M.step(dt)`: advances a running effect by `dt`, clamped to at most 1/20. It schedules incoming fire, moves the tracers (an impact fires when a tracer reaches the dome), sparks, fragments and flares, ages the recorded hits (a hit clears after an age of 3.5), decays `strain` (held at most 3), writes the hit table to the materials, writes the instance buffers and drives the attached lights. - `M.stop(token)`: ends the running effect: drops the four instanced draws and destroys their meshes and buffers. With a token, it acts only when the token is the current run's, so a scene unloading after its successor already started leaves the new run alone. - `M.stats()`: returns `{ sparks, frags, streaks, flares, strain, t }`, the live counts of each particle kind, the current strain and the run's elapsed time. - `M.domeGeometry(R)`: returns the dome surface geometry (`{ positions, normals, uvs, indices }`), a hemisphere of radius `R` with 64 latitude and 160 longitude segments. - `M.groundGeometry(R)`: returns the ground ring geometry, a flat annulus from `R - 1.6` to `R + 10.0` at height 0.04, with 5 radial and 160 around segments. - `M._state`: the table that holds the running effect's state. `domeGeometry` and `groundGeometry` are the geometry of the two scene-authored surfaces; the source states they are called once by the authoring script, and the resulting `.mesh` assets are what the scene's Model entities reference. ### The hit table `hit0` to `hit11` form a ring of the 12 most recent hits. Each is a vec4: the hit direction on the dome scaled by the hit strength, and the hit's age in its fourth component (`-1` for an empty slot). `strain` rises with every hit, and rises more for hits that land near recent hits. ## Usage ```luau local ShieldFx = require("ShieldFx") local token = ShieldFx.start({ center = { 0, 0, 0 }, radius = 9 }) local light = entity.findAll("ImpactLight1")[1] ShieldFx.attachLights({ { ent = light, comp = light.component.get("Light") } }) -- every frame ShieldFx.step(dt) -- force an impact straight overhead at full strength ShieldFx.hit(0, 1, 0, 1) print(ShieldFx.stats().sparks) -- when done ShieldFx.stop(token) ```
▲ 0↑ born
backing path · ShieldFxDriver.component

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.