summaryrefslogtreecommitdiff
path: root/honey/ecs-systems.lua
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-04-12 19:50:55 -0500
committersanine <sanine.not@pm.me>2023-04-12 19:50:55 -0500
commit4a737a44777d440682699dcad35c04a23205730e (patch)
tree870f49bd313254299b175395588a7858b997e885 /honey/ecs-systems.lua
parent3c9ba50944f1b136125e1191ccbc49fda1381123 (diff)
add script system
Diffstat (limited to 'honey/ecs-systems.lua')
-rw-r--r--honey/ecs-systems.lua15
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