mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-25 10:20:47 +01:00
Fix Quick Crafting bugs
This commit is contained in:
parent
187b0339bd
commit
889259ac5e
@ -178,7 +178,7 @@ local function cache_recipes(item)
|
|||||||
_recipes[#recipes + 1 - k] = v
|
_recipes[#recipes + 1 - k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
local shift = 0
|
local shift = 1
|
||||||
local size_rpl = maxn(replacements[item])
|
local size_rpl = maxn(replacements[item])
|
||||||
local size_rcp = #_recipes
|
local size_rcp = #_recipes
|
||||||
|
|
||||||
|
@ -440,16 +440,20 @@ local function craft_stack(player, data, craft_rcp)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(items) do
|
for item, v in pairs(items) do
|
||||||
inv:remove_item("main", fmt("%s %s", k, v * scrbar_val))
|
for _ = 1, v * scrbar_val do
|
||||||
end
|
inv:remove_item("main", item)
|
||||||
end
|
|
||||||
|
|
||||||
if rcp_def.replacements then
|
if rcp_def.replacements then
|
||||||
for _, pair in ipairs(rcp_def.replacements) do
|
for _, pair in ipairs(rcp_def.replacements) do
|
||||||
|
if item == pair[1] then
|
||||||
get_stack(player, ItemStack(pair[2]))
|
get_stack(player, ItemStack(pair[2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local count = stackcount * scrbar_val
|
local count = stackcount * scrbar_val
|
||||||
local iter = ceil(count / stackmax)
|
local iter = ceil(count / stackmax)
|
||||||
|
@ -1044,11 +1044,9 @@ local function get_grid_fs(fs, data, rcp, is_recipe, is_usage)
|
|||||||
local label = groups and "\nG" or ""
|
local label = groups and "\nG" or ""
|
||||||
local replace
|
local replace
|
||||||
|
|
||||||
for j = 1, #(rcp.replacements or {}) do
|
for _, replacement in ipairs(rcp.replacements or {}) do
|
||||||
local replacement = rcp.replacements[j]
|
|
||||||
if replacement[1] == name then
|
if replacement[1] == name then
|
||||||
replace = replace or {type = rcp.type, items = {}}
|
replace = replace or {type = rcp.type, items = {}}
|
||||||
|
|
||||||
local added
|
local added
|
||||||
|
|
||||||
for _, v in ipairs(replace.items) do
|
for _, v in ipairs(replace.items) do
|
||||||
@ -1087,7 +1085,12 @@ local function get_grid_fs(fs, data, rcp, is_recipe, is_usage)
|
|||||||
item:set_name(name)
|
item:set_name(name)
|
||||||
item:set_count(count)
|
item:set_count(count)
|
||||||
local itemstr = ESC(item:to_string())
|
local itemstr = ESC(item:to_string())
|
||||||
|
|
||||||
item_image_button(X, Y, btn_size, btn_size, itemstr, btn_name, label)
|
item_image_button(X, Y, btn_size, btn_size, itemstr, btn_name, label)
|
||||||
|
|
||||||
|
if item:get_stack_max() < count then
|
||||||
|
label(X + 0.95, Y + 0.95, count)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local def = reg_items[name]
|
local def = reg_items[name]
|
||||||
|
Loading…
Reference in New Issue
Block a user