Update select_item code

This commit is contained in:
Wuzzy 2018-05-17 14:47:24 +02:00
parent 6157e3cca2
commit 6552256f46

View File

@ -1101,7 +1101,7 @@ function ltool.process_form(player,formname,fields)
end
if(mod_select_item and (fields.edit_trunk or fields.edit_leaves or fields.edit_leaves2 or fields.edit_fruit)) then
ltool.save_fields(playername, formname, fields)
select_item.show_dialog(playername, function(itemstring)
select_item.show_dialog(playername, "ltool:node", function(itemstring)
if itemstring ~= "air" and minetest.registered_nodes[itemstring] ~= nil then
return true
end
@ -1307,7 +1307,9 @@ function ltool.process_form(player,formname,fields)
end
if mod_select_item then
select_item.register_on_select_item(function(playername, itemstring)
select_item.register_on_select_item(function(playername, dialogname, itemstring)
if dialogname == "ltool:node" then
if itemstring then
local f = ltool.playerinfos[playername].treeform.edit.fields
if f.edit_trunk then
f.trunk = itemstring
@ -1318,7 +1320,10 @@ if mod_select_item then
elseif f.edit_fruit then
f.fruit = itemstring
end
end
ltool.show_treeform(playername)
return false
end
end)
end