mirror of
https://github.com/minetest-mods/carpets.git
synced 2024-12-21 04:45:42 +01:00
Update init.lua
This commit is contained in:
parent
39d3d1a615
commit
010344e941
22
init.lua
22
init.lua
@ -5,28 +5,12 @@ local modpath = minetest.get_modpath(modname)
|
|||||||
|
|
||||||
dofile(modpath .. "/api.lua")
|
dofile(modpath .. "/api.lua")
|
||||||
|
|
||||||
local depends = (function()
|
local modutils = dofile(modpath .. "/modutils.lua")
|
||||||
local file = io.open(modpath .. "/depends.txt")
|
local depmod = modutils.get_depend_checker(modname)
|
||||||
if not file then
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
|
|
||||||
local depends = {}
|
|
||||||
for line in file:lines() do
|
|
||||||
if line:sub(-1) == "?" then
|
|
||||||
line = line:sub(1, -2)
|
|
||||||
end
|
|
||||||
depends[line] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
file:close()
|
|
||||||
|
|
||||||
return depends
|
|
||||||
end)()
|
|
||||||
|
|
||||||
local function filter(name, def)
|
local function filter(name, def)
|
||||||
-- disable carpets from loaded modules but not defined in dependency
|
-- disable carpets from loaded modules but not defined in dependency
|
||||||
if not depends[def.mod_origin] then
|
if not depmod:check_depend(def.mod_origin) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user