better boom-job juggling

This commit is contained in:
minjaesong
2024-02-16 02:55:36 +09:00
parent 693ad05352
commit cac9e947f7
3 changed files with 49 additions and 13 deletions

View File

@@ -876,8 +876,9 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
repossessActor()
// process actor addition requests
actorAdditionQueue.forEach { forceAddActor(it.first, it.second) }
actorAdditionQueue.clear()
val addCueCpy = actorAdditionQueue.toList()
addCueCpy.forEach { forceAddActor(it.first, it.second) }
actorAdditionQueue.removeAll(addCueCpy)
// determine whether the inactive actor should be activated
wakeDormantActors()
// update NOW; allow one last update for the actors flagged to despawn
@@ -885,10 +886,11 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
// determine whether the actor should keep being activated or be dormant
killOrKnockdownActors()
// process actor removal requests
actorRemovalQueue.forEach { forceRemoveActor(it.first, it.second) }
actorRemovalQueue.clear()
val remCueCpy = actorRemovalQueue.toList()
remCueCpy.forEach { forceRemoveActor(it.first, it.second) }
actorRemovalQueue.removeAll(remCueCpy)
// update particles
particlesContainer.forEach { if (!it.flagDespawn) particlesActive++; it.update(delta) }
particlesContainer.toList().forEach { if (!it.flagDespawn) particlesActive++; it.update(delta) }
// TODO thread pool(?)
CollisionSolver.process()