[antum_overrides] crafting.lua: Add some logging output to clearing

craft methods. Load 'crafting/dye.lua' if 'dye' mod is found.
This commit is contained in:
AntumDeluge 2016-09-01 19:56:47 -07:00
parent 01a8a97a4d
commit 2c96b8bbfc

View File

@ -26,29 +26,48 @@
antum.clearCraftOutput = function(o) antum.clearCraftOutput = function(o)
minetest.log('warning', '[' .. antum.overrides.modname .. '] Clearing craft by output: ' .. o)
minetest.clear_craft({ minetest.clear_craft({
output = o, output = o
}) })
end end
antum.clearCraftRecipe = function(r) antum.clearCraftRecipe = function(r)
local recipe_string = ''
local icount = 0
for I in pairs(r) do
icount = icount + 1
end
for I in pairs(r) do
if I == icount then
recipe_string = recipe_string .. ' ' .. r[I]
elseif I > 1 then
recipe_string = recipe_string .. ' + ' .. r[I]
else
recipe_string = r[I]
end
end
minetest.log('warning', '[' .. antum.overrides.modname .. '] Clearing craft by recipe: ' .. recipe_string)
minetest.clear_craft({ minetest.clear_craft({
recipe = r, recipe = {r}
}) })
end end
local craftdir = antum.overrides.modpath .. "/crafting" local craftdir = antum.overrides.modpath .. '/crafting'
local modoverrides = { local modoverrides = {
"coloredwood", 'coloredwood',
"craftguide", 'craftguide',
"farming", 'dye',
"helicopter", 'farming',
} 'helicopter',
}
for I in pairs(modoverrides) do for I in pairs(modoverrides) do
local modname = modoverrides[I] local modname = modoverrides[I]
if minetest.get_modpath(modname) then if minetest.get_modpath(modname) then
dofile(craftdir .. "/" .. modname .. ".lua") dofile(craftdir .. '/' .. modname .. '.lua')
end end
end end