Ench. table : prevent putting tools which can't be enchanted
This commit is contained in:
parent
e0a0c607e4
commit
0246054ff8
@ -69,12 +69,14 @@ end
|
|||||||
|
|
||||||
function enchanting.put(_, listname, _, stack, _)
|
function enchanting.put(_, listname, _, stack, _)
|
||||||
local toolstack = stack:get_name()
|
local toolstack = stack:get_name()
|
||||||
|
local toolname = toolstack:match("[%w_]+:([%w_]+)")
|
||||||
local count = stack:get_count()
|
local count = stack:get_count()
|
||||||
|
local enchanted_tool = minetest.serialize(minetest.registered_tools):match("enchanted_"..toolname)
|
||||||
|
|
||||||
if listname == "mese" and
|
if listname == "mese" and toolstack ~= "default:mese_crystal" then
|
||||||
toolstack ~= "default:mese_crystal" then return 0
|
return 0
|
||||||
elseif listname == "tool" and not
|
elseif listname == "tool" and not enchanted_tool then
|
||||||
minetest.registered_tools[toolstack] then return 0
|
return 0
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user