mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Separate optional from required mod dependencies in main menu (#4721)
* Separate optional from require dep's in main menu * Simplify modmgr mod dependency listing code
This commit is contained in:
parent
66bb295436
commit
1c570cb390
3 changed files with 38 additions and 16 deletions
|
@ -284,27 +284,32 @@ end
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
function modmgr.get_dependencies(modfolder)
|
||||
local toadd = ""
|
||||
local toadd_hard = ""
|
||||
local toadd_soft = ""
|
||||
if modfolder ~= nil then
|
||||
local filename = modfolder ..
|
||||
DIR_DELIM .. "depends.txt"
|
||||
|
||||
local hard_dependencies = {}
|
||||
local soft_dependencies = {}
|
||||
local dependencyfile = io.open(filename,"r")
|
||||
|
||||
if dependencyfile then
|
||||
local dependency = dependencyfile:read("*l")
|
||||
while dependency do
|
||||
if toadd ~= "" then
|
||||
toadd = toadd .. ","
|
||||
if string.sub(dependency, -1, -1) == "?" then
|
||||
table.insert(soft_dependencies, string.sub(dependency, 1, -2))
|
||||
else
|
||||
table.insert(hard_dependencies, dependency)
|
||||
end
|
||||
toadd = toadd .. dependency
|
||||
dependency = dependencyfile:read()
|
||||
end
|
||||
dependencyfile:close()
|
||||
end
|
||||
toadd_hard = table.concat(hard_dependencies, ",")
|
||||
toadd_soft = table.concat(soft_dependencies, ",")
|
||||
end
|
||||
|
||||
return toadd
|
||||
return toadd_hard, toadd_soft
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue