forked from Mirrorlandia_minetest/minetest
Fix enabling of dependencies with identical names (#12253)
This commit is contained in:
parent
6e9d31d4fb
commit
9f688bc433
@ -447,13 +447,18 @@ function pkgmgr.enable_mod(this, toset)
|
|||||||
|
|
||||||
-- Enable mods' depends after activation
|
-- 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 = {}
|
local mod_ids = {}
|
||||||
for id, mod2 in pairs(list) do
|
for id, mod2 in pairs(list) do
|
||||||
if mod2.type == "mod" and not mod2.is_modpack then
|
if mod2.type == "mod" and not mod2.is_modpack then
|
||||||
|
local prev_id = mod_ids[mod2.name]
|
||||||
|
if not prev_id or not list[prev_id].enabled then
|
||||||
mod_ids[mod2.name] = id
|
mod_ids[mod2.name] = id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- to_enable is used as a DFS stack with sp as stack pointer
|
-- to_enable is used as a DFS stack with sp as stack pointer
|
||||||
local to_enable = {}
|
local to_enable = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user