2022-08-01 11:51:14 -06:00
|
|
|
df_dependencies = {}
|
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
|
|
|
|
2022-08-03 19:22:41 -06:00
|
|
|
df_dependencies.mods_required = {}
|
2022-08-03 11:38:40 -06:00
|
|
|
|
|
|
|
df_dependencies.select_required = function(def)
|
|
|
|
local count = 0
|
|
|
|
local total = 0
|
|
|
|
local ret
|
|
|
|
for mod, item in pairs(def) do
|
|
|
|
total = total + 1
|
2022-08-03 19:22:41 -06:00
|
|
|
df_dependencies.mods_required[mod] = true
|
2022-08-03 11:38:40 -06:00
|
|
|
if minetest.get_modpath(mod) then
|
|
|
|
count = count + 1
|
|
|
|
ret = item
|
|
|
|
end
|
|
|
|
end
|
|
|
|
assert(count ~= 0, "Unable to find item for dependency set " .. dump(def))
|
|
|
|
assert(count == 1, "Found more than one item for dependency set " .. dump(def))
|
|
|
|
return ret
|
2022-08-01 11:51:14 -06:00
|
|
|
end
|
|
|
|
|
2022-08-03 11:38:40 -06:00
|
|
|
df_dependencies.select_optional = function(def)
|
2022-08-03 20:43:31 -06:00
|
|
|
local ret
|
2022-08-03 11:38:40 -06:00
|
|
|
for mod, item in pairs(def) do
|
2022-08-03 20:43:31 -06:00
|
|
|
df_dependencies.mods_required[mod] = true
|
2022-08-03 11:38:40 -06:00
|
|
|
if minetest.get_modpath(mod) then
|
2022-08-03 20:43:31 -06:00
|
|
|
ret = item
|
2022-08-01 11:51:14 -06:00
|
|
|
end
|
|
|
|
end
|
2022-08-03 20:43:31 -06:00
|
|
|
return ret
|
2022-08-01 11:51:14 -06:00
|
|
|
end
|
|
|
|
|
2022-08-15 01:45:26 -06:00
|
|
|
dofile(modpath.."/config.lua")
|
2022-08-03 11:38:40 -06:00
|
|
|
dofile(modpath.."/sounds.lua")
|
|
|
|
dofile(modpath.."/helper_functions.lua")
|
2022-08-11 13:41:51 -06:00
|
|
|
dofile(modpath.."/nodes.lua")
|
2022-08-03 11:38:40 -06:00
|
|
|
dofile(modpath.."/misc.lua")
|
2022-08-07 18:21:47 -06:00
|
|
|
dofile(modpath.."/mapgen.lua")
|
2022-08-03 11:38:40 -06:00
|
|
|
|
2022-08-15 11:50:15 -06:00
|
|
|
local list_mods_required = function()
|
|
|
|
local mods_required = ""
|
|
|
|
local mods_sorted = {}
|
|
|
|
for mod, _ in pairs(df_dependencies.mods_required) do
|
|
|
|
table.insert(mods_sorted, mod)
|
|
|
|
end
|
|
|
|
table.sort(mods_sorted)
|
|
|
|
for _, mod in ipairs(mods_sorted) do
|
|
|
|
mods_required = mods_required .. ", " .. mod
|
|
|
|
end
|
|
|
|
minetest.debug(mods_required)
|
2022-08-03 20:43:31 -06:00
|
|
|
end
|
2022-08-17 13:59:13 -06:00
|
|
|
--list_mods_required()
|
2022-08-03 11:38:40 -06:00
|
|
|
|
2022-08-01 11:51:14 -06:00
|
|
|
-- This mod is meant to only exist at initialization time. Other mods should make copies of anything it points to for their own use.
|
|
|
|
minetest.after(1, function() df_dependencies = nil end)
|