1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-05-11 21:30:22 +02:00

use get_matching_craft to get best craft

this line was buggy anyhow
This commit is contained in:
Luke aka SwissalpS 2023-06-15 03:35:11 +02:00
parent 149491a06b
commit 1aaeb9e287

View File

@ -65,7 +65,6 @@ 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]
recipe = minetest.get_craft_recipe(output.item:get_name()).items or example_recipe
if craft then return craft 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}
@ -76,6 +75,7 @@ local function get_craft(pos, inventory, hash)
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 = get_matching_craft(output.item:get_name(), example_recipe)
end end
autocrafterCache[hash] = craft autocrafterCache[hash] = craft
return craft return craft