summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2017-05-17 19:31:57 +0200
committerGitHub <noreply@github.com>2017-05-17 19:31:57 +0200
commit9b5effffbb0599f85014b53c3fd025b6a8222e02 (patch)
tree861b8b64a74af0e5da6bc90a00d3423d466d7f56 /builtin
parent0443620c5e699b02f8521ff8da7cff2e89ce4c5a (diff)
downloadminetest-9b5effffbb0599f85014b53c3fd025b6a8222e02.tar.gz
minetest-9b5effffbb0599f85014b53c3fd025b6a8222e02.tar.bz2
minetest-9b5effffbb0599f85014b53c3fd025b6a8222e02.zip
Builtin: Fix subgame mod selection (#5367)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/common/filterlist.lua3
-rw-r--r--builtin/mainmenu/modmgr.lua18
2 files changed, 12 insertions, 9 deletions
diff --git a/builtin/common/filterlist.lua b/builtin/common/filterlist.lua
index 2a62362e3..562231192 100644
--- a/builtin/common/filterlist.lua
+++ b/builtin/common/filterlist.lua
@@ -289,6 +289,9 @@ function sort_mod_list(self)
table.sort(self.m_processed_list, function(a, b)
-- Show game mods at bottom
if a.typ ~= b.typ then
+ if b.typ == "game" then
+ return a.typ ~= "game_mod"
+ end
return b.typ == "game_mod"
end
-- If in same or no modpack, sort by name
diff --git a/builtin/mainmenu/modmgr.lua b/builtin/mainmenu/modmgr.lua
index 0fbfa3e6b..14d29272e 100644
--- a/builtin/mainmenu/modmgr.lua
+++ b/builtin/mainmenu/modmgr.lua
@@ -238,15 +238,7 @@ function modmgr.render_modlist(render_list)
local list = render_list:get_list()
local last_modpack = nil
local retval = {}
- local in_game_mods = false
for i, v in ipairs(list) do
- if v.typ == "game_mod" and not in_game_mods then
- in_game_mods = true
- retval[#retval + 1] = mt_color_blue
- retval[#retval + 1] = "0"
- retval[#retval + 1] = fgettext("Subgame Mods")
- end
-
local color = ""
if v.is_modpack then
local rawlist = render_list:get_raw_list()
@@ -260,7 +252,7 @@ function modmgr.render_modlist(render_list)
break
end
end
- elseif v.typ == "game_mod" then
+ elseif v.typ == "game_mod" or v.typ == "game" then
color = mt_color_blue
elseif v.enabled then
color = mt_color_green
@@ -421,6 +413,14 @@ function modmgr.preparemodlist(data)
local gamespec = gamemgr.find_by_gameid(data.gameid)
gamemgr.get_game_mods(gamespec, game_mods)
+ if #game_mods > 0 then
+ -- Add title
+ retval[#retval + 1] = {
+ typ = "game",
+ name = fgettext("Subgame Mods")
+ }
+ end
+
for i=1,#game_mods,1 do
game_mods[i].typ = "game_mod"
retval[#retval + 1] = game_mods[i]