]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Fix enabling of dependencies with identical names (#12253)
authorJude Melton-Houghton <jwmhjwmh@gmail.com>
Sun, 8 May 2022 13:14:14 +0000 (09:14 -0400)
committerGitHub <noreply@github.com>
Sun, 8 May 2022 13:14:14 +0000 (14:14 +0100)
builtin/mainmenu/pkgmgr.lua

index a95fef10bd6c2ad637bebdb48fe07d11bea11643..ce5862ec2f00c4be2f7d3bee78741519f4dd807e 100644 (file)
@@ -466,11 +466,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