diff options
Diffstat (limited to 'honey/ecs-systems.lua')
-rw-r--r-- | honey/ecs-systems.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/honey/ecs-systems.lua b/honey/ecs-systems.lua index 9995304..5b9692b 100644 --- a/honey/ecs-systems.lua +++ b/honey/ecs-systems.lua @@ -114,5 +114,20 @@ end --===== update functions =====-- +--===== script system =====-- + +script = function(params) + return { + db=params.db, + update=function(self, dt) + local entities = self.db:queryComponent("script") + for id, script in pairs(entities) do + local f = require(script.name) + f(self.db, id, dt) + end + end + } +end + return module |