api.module
README.md
api
The seam the rest of the game plays effects through, so nothing else has to know how any of it is made.
Fx.spray(materialKey, worldPos, dir) -- debris off a bite of the chain
Fx.puff(worldPos) -- a softer cloud where a cut lands
Fx.dust() -- the yard's air, once
materialKey is "pine", "oak" or "ice". Positions are engine vectors
(vector.create(x, y, z)); a plain { x, y, z } table is taken too. dir is
the direction the chain throws material and is normalised, so any vector works.
Every call is rate-capped and wrapped, so it is safe to call from a component's
update every frame while cutting: a spray is held to the bursts a second a
chainsaw actually throws, a play that is still running is never doubled, and
nothing a call does can raise into the caller.
Who calls it
require("game.fx.api"). It resolves game.fx.yard_fx itself.
Status
Not currently called. The particle pass was built and wired into the
workpieces component, but the flecks drew at the card's raw one-metre size in
the live effect and read as sheets of wood hanging in the yard. The size was
corrected in the graph sources (parts/motes and graphs/dust now build their
card at 12-14 mm) but the correction did not reach the running effect before
the pass was stopped, so the calls were pulled rather than shipped broken. The
game currently throws its debris through game.workpieces.chips, which works.
To bring this back: load the effect fresh, confirm a spray reads as sawdust a
few millimetres across at the cut, and re-add the three calls.