Builtin Library
README.md
procgen.onPresent
Arms a probe that fires the moment a generator presents a frame matching every
term given, so an effect can be caught at the instant something happens in it:
a burst reaching a count, a time inside a looping cycle, an output appearing.
It is a probe on proc.cooks.presented, so probe.list, probe.hits and
probe.cancel manage it like any other, and probe.hits lists what each hit
reported.
Terms, each optional, all of them held together:
entity: the generator, by entity id or name.output: a frame on which that output presents;minElementswith it asks for at least that many elements in it.at: a frame at or past that graph time. Withevery, the time within each repeating cycle of that length:at = 0.4, every = 3fires on a frame from 0.4 s to 0.4 s +withininto any three-second cycle (withindefaults to 0.25 s, room for the presents a heavy cook spaces out).how: how the frame was made,"cook","memo","device"or"held".when: a Luau condition of your own over the present inargs[1](time,frame,how,ms,ownerandoutputs, each output{ elements }by name).
What a hit does:
- By default its notice reports the frame's time and frame, how it was made,
its milliseconds and each output's element count by output name
(
{ time, frame, how, ms, sparks = 315 });runreports what your own code returns instead, andnoticereplaces the notice's text. capture = truetakes a picture of each frame it fires on: the generator is held on that frame while the picture is taken, of what it draws alone, framed to fit, over the grey studio backdrop, and the effect plays on. A table states the picture's options:width,height,angle({ yaw, pitch }in degrees),margin,backdrop("studio"or"dark") andpath(a file to write it to as well).freeze = trueholds the generator on the frame it fires on and stops the world there, for looking at it from more than one place.generator:play()plays the generator on, andengine.paused = falseresumes the session.limit(default 1),cooldown,labelandsilentmean what they mean onprobe.onCall.
A frame the picture tools present while holding a generator is never a hit.
procgen.frames takes the pictures of several chosen moments in one call.
tools.use("procgen", "onPresent", { entity = "Grow", output = "output", at = 0.5, limit = 1 })
Part of procgen.toolbox, called as tools.use("procgen", "onPresent", ...) (zero procgen onPresent in the engine shell). Returns { probe, source, when }: the probe's id, the function it is attached to, and the
condition it was armed with.