package EntityManagement import public Entity import Buff public constant activeItr = Entity.iterator() public constant buffItr = Buff.iterator() function updateActiveEntities() activeItr.reset() for e from activeItr if not e.done e.update() function updateInactiveEntities() var e = Entity.firstInactive while e != null e.slowUpdate() e = e.next function updateBuffs() buffItr.reset() for b from buffItr if not b.done b.update() public function startEntityLoop() returns boolean getTimer().startPeriodic(ANIMATION_PERIOD, function updateActiveEntities) getTimer().startPeriodic(BUFF_ANIM_PERIOD, function updateBuffs) getTimer().startPeriodic(1.0, function updateInactiveEntities) // Remove buffs when unit leaves the map onUnitDeindex() -> let e = getIndexingUnit().getEntity() if e != null e.terminate() return true