Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' of https://github.com/XRFoundation/XREngine into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Dec 19, 2022
2 parents 11af1e4 + b9d978c commit 80f8dfc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/engine/src/ecs/PriorityQueue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DeepReadonly } from '@xrengine/common/src/DeepReadonly'

import { Entity } from './classes/Entity'
import { entityExists } from './functions/EntityFunctions'

export const createPriorityQueue = (args: { accumulationBudget: number }) => {
const accumulatingPriorities = new Map<
Expand Down Expand Up @@ -32,8 +33,9 @@ export const createPriorityQueue = (args: { accumulationBudget: number }) => {
for (const [entity, item] of accumulatingPriorities) {
item.normalizedPriority += (item.accumulatedPriority * queue.accumulationBudget) / totalAccumulation
item.accumulatedPriority = 0
if (item.normalizedPriority >= 1) {
priorityEntites.add(entity)
const exists = entityExists(entity)
if (item.normalizedPriority >= 1 || !exists) {
if (exists) priorityEntites.add(entity)
queue.removeEntity(entity)
}
}
Expand Down

0 comments on commit 80f8dfc

Please sign in to comment.