many
This commit is contained in:
parent
0b9ff1363b
commit
0a6148c73f
67 changed files with 2653 additions and 1519 deletions
|
|
@ -3,6 +3,13 @@
|
|||
(function (global) {
|
||||
const World = global.World;
|
||||
if (!World) throw new Error("World is not available for mixin: world_spatial_budget.js");
|
||||
|
||||
function liveCount(list) {
|
||||
let count = 0;
|
||||
for (const item of list || []) if (item && !item.dead) count += 1;
|
||||
return count;
|
||||
}
|
||||
|
||||
Object.defineProperties(World.prototype, Object.getOwnPropertyDescriptors({
|
||||
performanceLevel() {
|
||||
if (window.TarinaiPerformance) return window.TarinaiPerformance.level || 0;
|
||||
|
|
@ -33,8 +40,8 @@
|
|||
|
||||
sortedDrawList() {
|
||||
if (!this.drawList) this.drawList = [];
|
||||
const antCount = (this.ants || []).filter(a => a && !a.dead).length;
|
||||
const tarinaiCount = (this.tarinai || []).filter(t => t && !t.dead).length;
|
||||
const antCount = liveCount(this.ants);
|
||||
const tarinaiCount = liveCount(this.tarinai);
|
||||
if (this.drawListDirty || this.drawList.length !== tarinaiCount + antCount) {
|
||||
this.drawList.length = 0;
|
||||
for (const t of this.tarinai || []) if (t && !t.dead) this.drawList.push(t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue