modules/world: load the actorlist inside the world

This commit is contained in:
Kazhnuz 2019-04-07 13:35:49 +02:00
parent 5365f23c30
commit 19cdf6c3ab

View file

@ -3,12 +3,20 @@ local BaseWorld = Object:extend()
-- INIT FUNCTIONS -- INIT FUNCTIONS
-- All functions to init the world and the map -- All functions to init the world and the map
function BaseWorld:new(scene) function BaseWorld:new(scene, actorlist)
self.scene = scene self.scene = scene
self.setActorList(actorlist)
self.actors = {} self.actors = {}
end 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 -- ACTOR MANAGEMENT FUNCTIONS
-- Basic function to handle actors -- Basic function to handle actors