From 12586f09c7afaae92b96b4ba152b273b06743e39 Mon Sep 17 00:00:00 2001 From: MaJetiGizzle Date: Sat, 26 Jul 2025 16:47:13 -0400 Subject: [PATCH] Fixing gui/mod-manager not loading --- docs/about/Authors.rst | 1 + library/lua/script-manager.lua | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/about/Authors.rst b/docs/about/Authors.rst index e8030e881a..250620f7c6 100644 --- a/docs/about/Authors.rst +++ b/docs/about/Authors.rst @@ -120,6 +120,7 @@ Kurik Amudnil Kévin Boissonneault KABoissonneault Lethosor lethosor LordGolias LordGolias +Malik Alnakhaleh MalikMAlna Mark Nielson pseudodragon Mason11987 Mason11987 Matt Regul mattregul diff --git a/library/lua/script-manager.lua b/library/lua/script-manager.lua index 72b0aae951..36e9cabc46 100644 --- a/library/lua/script-manager.lua +++ b/library/lua/script-manager.lua @@ -214,14 +214,44 @@ function get_active_mods() local ol = df.global.world.object_loader for idx=0,#ol.object_load_order_id-1 do - local path = ol.object_load_order_src_dir[idx] + local path = nil + if ol.object_load_order_src_dir[idx] then + path = ol.object_load_order_src_dir[idx].value + end + -- If path is still nil, try to construct a fallback path + if not path then + local mod_id = ol.object_load_order_id[idx].value + if mod_id then + -- Try to find the mod path using existing functions + path = getModSourcePath(mod_id) + if not path then + -- If we can't find the path, assume it might be vanilla + -- Vanilla mods typically don't have entries in the mod path system + path = 'data/vanilla/' .. mod_id + end + else + path = 'unknown' + end + end + -- Convert path to string if it's not already + if path then + path = tostring(path) + end + -- Determine if this is a vanilla mod + -- Vanilla mods are those that don't start with installed mods path or other mod paths + local is_vanilla = false + if path then + is_vanilla = not (path:startswith(INSTALLED_MODS_PATH) or + path:startswith(MODS_PATH) or + path:startswith(WORKSHOP_MODS_PATH)) + end table.insert(mods, { id=ol.object_load_order_id[idx].value, name=ol.object_load_order_name[idx].value, version=ol.object_load_order_displayed_version[idx].value, numeric_version=ol.object_load_order_numeric_version[idx], path=path, - vanilla=path:startswith('data/vanilla/'), -- windows also uses forward slashes + vanilla=is_vanilla, }) end