diff options
-rw-r--r-- | config/menus/host.lua | 2 | ||||
-rw-r--r-- | not/World.lua | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/config/menus/host.lua b/config/menus/host.lua index 8054942..1ac4b0f 100644 --- a/config/menus/host.lua +++ b/config/menus/host.lua @@ -44,7 +44,7 @@ return { return mapSelector:getLocked() end) :set("active", function (self) - MAP = mapSelector:getSelected().name -- TODO: It uses map name for compatibility with old code. + MAP = mapSelector:getSelected() self.parent:open("select") end) , diff --git a/not/World.lua b/not/World.lua index c3fec11..b2dc0e7 100644 --- a/not/World.lua +++ b/not/World.lua @@ -25,12 +25,13 @@ function World:new (map, nauts) self.Effects = {} self.Decorations = {} self.Rays = {} - -- Map and misc. - -- TODO: `map` could be table from config file rather than just string. - local map = map or "default" - self:loadMap(map) + + self.map = map + self:buildMap() self:spawnNauts(nauts) + self.camera = Camera:new(self) + musicPlayer:setTrack(self.map.theme) musicPlayer:play() end @@ -46,11 +47,8 @@ function World:delete () self.world:destroy() end ---- Loads table from selected map config file located in `config/maps/` directory. -function World:loadMap (name) - local map = string.format("config/maps/%s.lua", name or "default") - self.map = love.filesystem.load(map)() - +--- Builds map using one of tables frin config files located in `config/maps/` directory. +function World:buildMap () for _,op in pairs(self.map.create) do if op.platform then local path = string.format("config/platforms/%s.lua", op.platform) |