summaryrefslogtreecommitdiff
path: root/honey
diff options
context:
space:
mode:
Diffstat (limited to 'honey')
-rw-r--r--honey/ecs-systems.lua1
-rw-r--r--honey/ecs.lua29
2 files changed, 17 insertions, 13 deletions
diff --git a/honey/ecs-systems.lua b/honey/ecs-systems.lua
index 237aa78..5dec159 100644
--- a/honey/ecs-systems.lua
+++ b/honey/ecs-systems.lua
@@ -56,6 +56,7 @@ function renderCam(camera, priority)
}
entity.mesh:drawElements()
end,
+ nopause=true,
priority=priority,
}
end
diff --git a/honey/ecs.lua b/honey/ecs.lua
index d611b37..b7806f9 100644
--- a/honey/ecs.lua
+++ b/honey/ecs.lua
@@ -195,23 +195,26 @@ function Level.reconfigureAllEntities(self)
end
-function Level.update(self, dt)
+function Level.update(self, dt, paused)
+ local paused = paused or false
for _, system in ipairs(self.systems) do
- if system.preUpdate then
- system:preUpdate()
- end
- if system.prepareEntity then
+ if (not paused) or (paused and system.nopause) then
+ if system.preUpdate then
+ system:preUpdate()
+ end
+ if system.prepareEntity then
+ for id in pairs(system.entities) do
+ local entity = self.entities[id]
+ system:prepareEntity(entity)
+ end
+ end
for id in pairs(system.entities) do
local entity = self.entities[id]
- system:prepareEntity(entity)
+ system:update(entity, dt)
+ end
+ if system.postUpdate then
+ system:postUpdate()
end
- end
- for id in pairs(system.entities) do
- local entity = self.entities[id]
- system:update(entity, dt)
- end
- if system.postUpdate then
- system:postUpdate()
end
end
end