summaryrefslogtreecommitdiff
path: root/builtin/mainmenu/pkgmgr.lua
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-05-08 09:14:14 -0400
committersfan5 <sfan5@live.de>2022-05-14 18:33:42 +0200
commit9f688bc4336338d438017f9911783cf8944cda21 (patch)
tree91128af821a9dee41be25361685463508f075b23 /builtin/mainmenu/pkgmgr.lua
parent6e9d31d4fbce1d0e6d02ef5aa5740d6128e93ade (diff)
downloadminetest-9f688bc4336338d438017f9911783cf8944cda21.tar.gz
minetest-9f688bc4336338d438017f9911783cf8944cda21.tar.bz2
minetest-9f688bc4336338d438017f9911783cf8944cda21.zip
Fix enabling of dependencies with identical names (#12253)
Diffstat (limited to 'builtin/mainmenu/pkgmgr.lua')
-rw-r--r--builtin/mainmenu/pkgmgr.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index 44f39ca60..1f61d90d9 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -447,11 +447,16 @@ function pkgmgr.enable_mod(this, toset)
-- Enable mods' depends after activation
- -- Make a list of mod ids indexed by their names
+ -- Make a list of mod ids indexed by their names. Among mods with the
+ -- same name, enabled mods take precedence, after which game mods take
+ -- precedence, being last in the mod list.
local mod_ids = {}
for id, mod2 in pairs(list) do
if mod2.type == "mod" and not mod2.is_modpack then
- mod_ids[mod2.name] = id
+ local prev_id = mod_ids[mod2.name]
+ if not prev_id or not list[prev_id].enabled then
+ mod_ids[mod2.name] = id
+ end
end
end