Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/about/Authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 32 additions & 2 deletions library/lua/script-manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src_dir is a vector<path> in 52.02 and so its elements do not have the .value metamethod. This code will not work with 52.02, or against develop

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

Expand Down