Update select_item code
This commit is contained in:
parent
6157e3cca2
commit
6552256f46
29
init.lua
29
init.lua
@ -1101,7 +1101,7 @@ function ltool.process_form(player,formname,fields)
|
|||||||
end
|
end
|
||||||
if(mod_select_item and (fields.edit_trunk or fields.edit_leaves or fields.edit_leaves2 or fields.edit_fruit)) then
|
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)
|
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
|
if itemstring ~= "air" and minetest.registered_nodes[itemstring] ~= nil then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -1307,18 +1307,23 @@ function ltool.process_form(player,formname,fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if mod_select_item then
|
if mod_select_item then
|
||||||
select_item.register_on_select_item(function(playername, itemstring)
|
select_item.register_on_select_item(function(playername, dialogname, itemstring)
|
||||||
local f = ltool.playerinfos[playername].treeform.edit.fields
|
if dialogname == "ltool:node" then
|
||||||
if f.edit_trunk then
|
if itemstring then
|
||||||
f.trunk = itemstring
|
local f = ltool.playerinfos[playername].treeform.edit.fields
|
||||||
elseif f.edit_leaves then
|
if f.edit_trunk then
|
||||||
f.leaves = itemstring
|
f.trunk = itemstring
|
||||||
elseif f.edit_leaves2 then
|
elseif f.edit_leaves then
|
||||||
f.leaves2 = itemstring
|
f.leaves = itemstring
|
||||||
elseif f.edit_fruit then
|
elseif f.edit_leaves2 then
|
||||||
f.fruit = itemstring
|
f.leaves2 = itemstring
|
||||||
|
elseif f.edit_fruit then
|
||||||
|
f.fruit = itemstring
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ltool.show_treeform(playername)
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
ltool.show_treeform(playername)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user