@@ -31,8 +31,6 @@ local function get_formspec(data)
3131 " label[0.5,0;" .. fgettext (" World:" ) .. " ]" ..
3232 " label[1.75,0;" .. data .worldspec .name .. " ]"
3333
34- local hard_deps , soft_deps = pkgmgr .get_dependencies (mod .path )
35-
3634 if mod .is_modpack or mod .type == " game" then
3735 local info = minetest .formspec_escape (
3836 core .get_content_info (mod .path ).description )
@@ -46,15 +44,46 @@ local function get_formspec(data)
4644 retval = retval ..
4745 " textarea[0.25,0.7;5.75,7.2;;" .. info .. " ;]"
4846 else
47+ local hard_deps , soft_deps = pkgmgr .get_dependencies (mod .path )
48+ local hard_deps_str = table.concat (hard_deps , " ," )
49+ local soft_deps_str = table.concat (soft_deps , " ," )
50+
4951 retval = retval ..
5052 " label[0,0.7;" .. fgettext (" Mod:" ) .. " ]" ..
51- " label[0.75,0.7;" .. mod .name .. " ]" ..
52- " label[0,1.25;" .. fgettext (" Dependencies:" ) .. " ]" ..
53- " textlist[0,1.75;5,2.125;world_config_depends;" .. hard_deps ..
54- " ;0]" ..
55- " label[0,3.875;" .. fgettext (" Optional dependencies:" ) .. " ]" ..
56- " textlist[0,4.375;5,1.8;world_config_optdepends;" ..
57- soft_deps .. " ;0]"
53+ " label[0.75,0.7;" .. mod .name .. " ]"
54+
55+ if hard_deps_str == " " then
56+ if soft_deps_str == " " then
57+ retval = retval ..
58+ " label[0,1.25;" ..
59+ fgettext (" No (optional) dependencies" ) .. " ]"
60+ else
61+ retval = retval ..
62+ " label[0,1.25;" .. fgettext (" No hard dependencies" ) ..
63+ " ]" ..
64+ " label[0,1.75;" .. fgettext (" Optional dependencies:" ) ..
65+ " ]" ..
66+ " textlist[0,2.25;5,4;world_config_optdepends;" ..
67+ soft_deps_str .. " ;0]"
68+ end
69+ else
70+ if soft_deps_str == " " then
71+ retval = retval ..
72+ " label[0,1.25;" .. fgettext (" Dependencies:" ) .. " ]" ..
73+ " textlist[0,1.75;5,4;world_config_depends;" ..
74+ hard_deps_str .. " ;0]" ..
75+ " label[0,6;" .. fgettext (" No optional dependencies" ) .. " ]"
76+ else
77+ retval = retval ..
78+ " label[0,1.25;" .. fgettext (" Dependencies:" ) .. " ]" ..
79+ " textlist[0,1.75;5,2.125;world_config_depends;" ..
80+ hard_deps_str .. " ;0]" ..
81+ " label[0,3.9;" .. fgettext (" Optional dependencies:" ) ..
82+ " ]" ..
83+ " textlist[0,4.375;5,1.8;world_config_optdepends;" ..
84+ soft_deps_str .. " ;0]"
85+ end
86+ end
5887 end
5988 retval = retval ..
6089 " button[3.25,7;2.5,0.5;btn_config_world_save;" ..
0 commit comments