From 19cdf6c3ab6a1fa62476c824fb7ea9ff4ea7553a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 7 Apr 2019 13:35:49 +0200 Subject: [PATCH] modules/world: load the actorlist inside the world --- gamecore/modules/world/baseworld.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 1b8951a..f012eb4 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -3,12 +3,20 @@ local BaseWorld = Object:extend() -- INIT FUNCTIONS -- All functions to init the world and the map -function BaseWorld:new(scene) +function BaseWorld:new(scene, actorlist) self.scene = scene - + self.setActorList(actorlist) self.actors = {} end +function BaseWorld:setActorList(actorlist) + if actorlist == nil then + error("FATAL: You must set an actorlist to your world") + else + self.obj = require(actorlist) + end +end + -- ACTOR MANAGEMENT FUNCTIONS -- Basic function to handle actors