From 4a737a44777d440682699dcad35c04a23205730e Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 12 Apr 2023 19:50:55 -0500 Subject: add script system --- honey/ecs-systems.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'honey/ecs-systems.lua') 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 -- cgit v1.2.1