mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-05-11 05:10:22 +02:00
return right away if there is a chached craft
gives us more horizontal space to work with
This commit is contained in:
parent
d05c21700d
commit
001cd5824b
@ -65,13 +65,13 @@ end
|
|||||||
local function get_craft(pos, inventory, hash)
|
local function get_craft(pos, inventory, hash)
|
||||||
local hash = hash or minetest.hash_node_position(pos)
|
local hash = hash or minetest.hash_node_position(pos)
|
||||||
local craft = autocrafterCache[hash]
|
local craft = autocrafterCache[hash]
|
||||||
if not craft then
|
|
||||||
local example_recipe = inventory:get_list("recipe")
|
local example_recipe = inventory:get_list("recipe")
|
||||||
local output, decremented_input = minetest.get_craft_result({method = "normal", width = 3, items = example_recipe})
|
local output, decremented_input = minetest.get_craft_result({method = "normal", width = 3, items = example_recipe})
|
||||||
local recipe = example_recipe
|
local recipe = example_recipe
|
||||||
if output and not output.item:is_empty() then
|
if output and not output.item:is_empty() then
|
||||||
recipe = minetest.get_craft_recipe(output.item:get_name()).items or example_recipe
|
recipe = minetest.get_craft_recipe(output.item:get_name()).items or example_recipe
|
||||||
end
|
end
|
||||||
|
if craft then return craft end
|
||||||
|
|
||||||
craft = {recipe = recipe, consumption=count_index(recipe), output = output, decremented_input = decremented_input}
|
craft = {recipe = recipe, consumption=count_index(recipe), output = output, decremented_input = decremented_input}
|
||||||
autocrafterCache[hash] = craft
|
autocrafterCache[hash] = craft
|
||||||
|
Loading…
x
Reference in New Issue
Block a user