summaryrefslogtreecommitdiff
path: root/honey/ecs.lua
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-03-22 12:12:31 -0500
committersanine-a <sanine.not@pm.me>2023-03-22 12:12:31 -0500
commit16bcc6daab84373cac0f4125c1580d3cb1261baf (patch)
tree7a6156e204579264ce867c4771c35265f680e84b /honey/ecs.lua
parenta45f73c7388b3f5a5901bfcc66fd2d1df58d3001 (diff)
move ecs systems into separate module
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