summaryrefslogtreecommitdiff
path: root/honey/ecs.lua
diff options
context:
space:
mode:
Diffstat (limited to 'honey/ecs.lua')
-rw-r--r--honey/ecs.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/honey/ecs.lua b/honey/ecs.lua
index 4eee343..23bb0ba 100644
--- a/honey/ecs.lua
+++ b/honey/ecs.lua
@@ -194,10 +194,22 @@ end
function Level.update(self, dt)
for _, system in ipairs(self.systems) do
+ if system.preUpdate then
+ for id in pairs(system.entities) do
+ local entity = self.entities[id]
+ system.preUpdate(entity)
+ end
+ end
for id in pairs(system.entities) do
local entity = self.entities[id]
system.update(entity, dt)
end
+ if system.postUpdate then
+ for id in pairs(system.entities) do
+ local entity = self.entities[id]
+ system.postUpdate(entity)
+ end
+ end
end
end