From b117c29325698e56a4fbd76426739dd48fa154cb Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 5 Sep 2017 01:24:02 +0200 Subject: Map config table is now passed to World rather than map name --- config/menus/host.lua | 2 +- 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) -- cgit v1.1