Fixup autocraft UI on remote.

This commit is contained in:
Mike Stump 2024-01-06 17:51:06 -08:00
parent 50aa1f2470
commit 6fdfd4698e

@ -208,6 +208,7 @@ minetest.register_on_player_receive_fields(function(user, formname, fields)
local page = toolmeta.page local page = toolmeta.page
local did_update = false local did_update = false
local update_search = false local update_search = false
local do_autocraft = false
for field, value in pairs(fields) do for field, value in pairs(fields) do
me.log("REMOTE: form "..field.." value "..value, "error") me.log("REMOTE: form "..field.." value "..value, "error")
if field == "next" then if field == "next" then
@ -255,10 +256,15 @@ minetest.register_on_player_receive_fields(function(user, formname, fields)
elseif field == "key_enter_field" and value == "autocraft" then elseif field == "key_enter_field" and value == "autocraft" then
local count = tonumber(toolmeta.autocraft) local count = tonumber(toolmeta.autocraft)
if not own_inv:get_stack("output", 1):is_empty() and count < math.pow(2,16) then if not own_inv:get_stack("output", 1):is_empty() and count < math.pow(2,16) then
do_autocraft = true
end
end
end
if do_autocraft then
local count = tonumber(toolmeta.autocraft)
me.autocraft(me.autocrafterCache, pos, net, own_inv, ctrl_inv, count) me.autocraft(me.autocrafterCache, pos, net, own_inv, ctrl_inv, count)
end end
end
end
if update_search then if update_search then
inv_name = "main" inv_name = "main"