diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/maps/205.lua | 1 | ||||
-rw-r--r-- | config/maps/404.lua | 1 | ||||
-rw-r--r-- | config/maps/aiguillon.lua | 1 | ||||
-rw-r--r-- | config/maps/alpha.lua | 1 | ||||
-rw-r--r-- | config/maps/default.lua | 1 | ||||
-rw-r--r-- | config/maps/ribbit.lua | 1 | ||||
-rw-r--r-- | config/maps/rill.lua | 1 | ||||
-rw-r--r-- | config/maps/sorona.lua | 1 | ||||
-rw-r--r-- | config/maps/starstorm.lua | 1 | ||||
-rw-r--r-- | config/menus/host.lua | 25 | ||||
-rw-r--r-- | config/menus/select.lua | 25 |
11 files changed, 53 insertions, 6 deletions
diff --git a/config/maps/205.lua b/config/maps/205.lua index a20fe0a..ec58836 100644 --- a/config/maps/205.lua +++ b/config/maps/205.lua @@ -3,6 +3,7 @@ return name = "AI Station 205", theme = "sorona.ogg", portrait = "assets/maps/205.png", + available = false, center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/404.lua b/config/maps/404.lua index 6a5b218..3e47f90 100644 --- a/config/maps/404.lua +++ b/config/maps/404.lua @@ -3,6 +3,7 @@ return name = "AI Station 404", theme = "404.ogg", portrait = "assets/maps/404.png", + available = true, center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/aiguillon.lua b/config/maps/aiguillon.lua index e79449f..90bfbb2 100644 --- a/config/maps/aiguillon.lua +++ b/config/maps/aiguillon.lua @@ -3,6 +3,7 @@ return name = "Aiguillon", theme = "aiguillon.ogg", portrait = "assets/maps/aiguillon.png", + available = true, center = {x = 0, y = 10}, width = 370, height = 290, diff --git a/config/maps/alpha.lua b/config/maps/alpha.lua index 3942dde..43c12ee 100644 --- a/config/maps/alpha.lua +++ b/config/maps/alpha.lua @@ -3,6 +3,7 @@ return name = "Alpha Abyss", theme = "alpha.ogg", portrait = "assets/maps/alpha.png", + available = true, center = {x = 0, y = -80}, width = 360, height = 240, diff --git a/config/maps/default.lua b/config/maps/default.lua index 76cd9d3..3c2bd03 100644 --- a/config/maps/default.lua +++ b/config/maps/default.lua @@ -3,6 +3,7 @@ return name = "default", theme = "default.ogg", portrait = "assets/maps/default.png", + available = true, center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/ribbit.lua b/config/maps/ribbit.lua index f5e267e..7757e13 100644 --- a/config/maps/ribbit.lua +++ b/config/maps/ribbit.lua @@ -3,6 +3,7 @@ return name = "Ribbit IV", theme = "ribbit.ogg", portrait = "assets/maps/ribbit.png", + available = true, center = {x = 0, y = 50}, width = 360, height = 240, diff --git a/config/maps/rill.lua b/config/maps/rill.lua index 4644ecc..17e9f37 100644 --- a/config/maps/rill.lua +++ b/config/maps/rill.lua @@ -3,6 +3,7 @@ return name = "Rill", theme = "rill.ogg", portrait = "assets/maps/rill.png", + available = true, center = {x = 0, y = 75}, width = 400, height = 260, diff --git a/config/maps/sorona.lua b/config/maps/sorona.lua index 54543c2..99a92b2 100644 --- a/config/maps/sorona.lua +++ b/config/maps/sorona.lua @@ -3,6 +3,7 @@ return name = "Sorona", theme = "sorona.ogg", portrait = "assets/maps/sorona.png", + available = true, center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/starstorm.lua b/config/maps/starstorm.lua index bb35a08..3062b54 100644 --- a/config/maps/starstorm.lua +++ b/config/maps/starstorm.lua @@ -3,6 +3,7 @@ return name = "Starstorm", theme = "starstorm.ogg", portrait = "assets/maps/starstorm.png", + available = true, center = {x = 0, y = -20}, width = 400, height = 260, diff --git a/config/menus/host.lua b/config/menus/host.lua index ce67047..2b5fac5 100644 --- a/config/menus/host.lua +++ b/config/menus/host.lua @@ -10,7 +10,23 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: loadConfigs is duplicated in menus/select and menus/host. +-- TODO: loadConfigs and isAvailable are duplicated in menus/select and menus/host. +local +function isAvailable (item) + if item then + if debug then + return true + end + local at = type(item.available) + if at == "boolean" then + return item.available + end + if at == "string" then + return false + end + end +end + local function loadConfigs (dir, process) local items, icons = {}, {} @@ -18,7 +34,10 @@ function loadConfigs (dir, process) local path = string.format("%s/%s", dir, file) if love.filesystem.isFile(path) and file ~= "readme.md" then local item = love.filesystem.load(path)() - if item and process(item, file, path) then + if isAvailable(item) then + if process then + process(item, file, path) + end table.insert(icons, love.graphics.newImage(item.portrait)) table.insert(items, item) end @@ -28,7 +47,7 @@ function loadConfigs (dir, process) end -- TODO: This is temporary solution for generating available maps list and portraits for them to pass to Selector. -local maps, icons = loadConfigs("config/maps", function (map, _, path) map.filename = path; return true end) +local maps, icons = loadConfigs("config/maps", function (map, _, path) map.filename = path end) local mapSelector = Selector(maps, nil, menu) return { diff --git a/config/menus/select.lua b/config/menus/select.lua index d101472..9f0ed9b 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -14,7 +14,23 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: loadConfigs is duplicated in menus/select and menus/host. +-- TODO: loadConfigs and isAvailable are duplicated in menus/select and menus/host. +local +function isAvailable (item) + if item then + if debug then + return true + end + local at = type(item.available) + if at == "boolean" then + return item.available + end + if at == "string" then + return false + end + end +end + local function loadConfigs (dir, process) local items, icons = {}, {} @@ -22,7 +38,10 @@ function loadConfigs (dir, process) local path = string.format("%s/%s", dir, file) if love.filesystem.isFile(path) and file ~= "readme.md" then local item = love.filesystem.load(path)() - if item and process(item) then + if isAvailable(item) then + if process then + process(item, file, path) + end table.insert(icons, love.graphics.newImage(item.portrait)) table.insert(items, item) end @@ -34,7 +53,7 @@ end -- TODO: Clean-up menus/select, menus/host and Hero after portraits split. local group, get do - local nauts, icons = loadConfigs("config/nauts", function (naut) return naut.available or debug end) + local nauts, icons = loadConfigs("config/nauts") -- TODO: Find a better way to add empty and random entries to naut Selector. table.insert(icons, 1, false) |