From 5a92be47c1ac1e9a93b34f4a753817a142b2382f Mon Sep 17 00:00:00 2001 From: cha0s Date: Tue, 23 Jul 2024 17:03:53 -0500 Subject: [PATCH] fix: index only active --- app/ecs/ecs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/ecs/ecs.js b/app/ecs/ecs.js index 8a47672..7485a94 100644 --- a/app/ecs/ecs.js +++ b/app/ecs/ecs.js @@ -178,7 +178,11 @@ export default class Ecs { deindex(entityIds) { for (const systemName in this.Systems) { - this.Systems[systemName].deindex(entityIds); + const System = this.Systems[systemName]; + if (!System.active) { + continue; + } + System.deindex(entityIds); } } @@ -384,7 +388,11 @@ export default class Ecs { reindex(entityIds) { for (const systemName in this.Systems) { - this.Systems[systemName].reindex(entityIds); + const System = this.Systems[systemName]; + if (!System.active) { + continue; + } + System.reindex(entityIds); } }