Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

Particles.spawnBatches

The spawn batches a particle emitter keeps, as a min-heap on the clock each batch leaves the live bound at, and the count of particles they can still hold alive. An entry whose slots a whole capacity of later placements has overwritten holds no particle, and a sweep drops it, so the heap stays within twice the emitter's capacity whatever the particles' lifetime.

  • newSpawnBatches() answers an empty heap.
  • pushBatch(b, leavesAt, count, capacity) files a batch of count particles, the last of which leaves the bound at leavesAt, into an emitter of capacity slots.
  • batchesHeldAt(b, now) drops every entry whose clock is at or behind now and answers how many particles the rest placed.
  • forgetBatches(b) forgets every batch.
local Batches = require("@builtin::deprecated.deprecatedParticles.engine.spawnBatches")
local b = Batches.newSpawnBatches()
Batches.pushBatch(b, 2.0, 10, 100)
print(Batches.batchesHeldAt(b, 1.0)) -- 10
print(Batches.batchesHeldAt(b, 3.0)) -- 0