summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-05 01:24:02 +0200
committerAki <nthirtyone@gmail.com>2017-09-05 01:24:02 +0200
commitb117c29325698e56a4fbd76426739dd48fa154cb (patch)
tree02f08cea1b5c002d9ebb298b55f3202e3d04f47f
parentfc16ad592a45648c7df7cc18c2b6cd153af238e3 (diff)
downloadroflnauts-b117c29325698e56a4fbd76426739dd48fa154cb.zip
roflnauts-b117c29325698e56a4fbd76426739dd48fa154cb.tar.gz
roflnauts-b117c29325698e56a4fbd76426739dd48fa154cb.tar.bz2
Map config table is now passed to World rather than map name
-rw-r--r--config/menus/host.lua2
-rw-r--r--not/World.lua16
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)