Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

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.