diff options
author | sanine-a <sanine.not@pm.me> | 2023-03-22 12:12:31 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-03-22 12:12:31 -0500 |
commit | 16bcc6daab84373cac0f4125c1580d3cb1261baf (patch) | |
tree | 7a6156e204579264ce867c4771c35265f680e84b /honey/ecs.lua | |
parent | a45f73c7388b3f5a5901bfcc66fd2d1df58d3001 (diff) |
move ecs systems into separate module
Diffstat (limited to 'honey/ecs.lua')
-rw-r--r-- | honey/ecs.lua | 12 |
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 |