Soft-depending mods
Something that could be useful for lots of mods would be a softdepends.txt file in the mod folder: mods that are listed in it are loaded before the mod if they exist, but else, they are ignored.
FOSS gamedev and creative worlds
https://forums.minetest.org/
if minetest.get_modpath("streets") then
print("Streets is installed")
else
print("Streets isn't installed")
end
webdesigner97 wrote:You can use lua to check wheter a certain mod is installed and change your script's behaviour:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if minetest.get_modpath("streets") then
print("Streets is installed")
else
print("Streets isn't installed")
end
I don't think that a softdepend.txt is needed.
---- Mod A
A = {}
function A.foo(...) ... end
---- Mod B (automatic soft depend on mod B)
A.foo(...)
---- Mod A
A = {}
function A.foo(...) ... end
---- Mod B
local function aCallback(param)
A.foo(...)
end
minetest.register_on_mod_loaded("A", aCallback, param)
---- Mod B
minetest.register_on_mod_loaded("A", function(param) A.foo(...) end, param)