From 360a8994cb57a9b4d8524c2d1012f846c04c3ba0 Mon Sep 17 00:00:00 2001 From: meex <196295011+Meex-Work@users.noreply.github.com> Date: Sat, 9 Aug 2025 07:58:43 +0200 Subject: [PATCH 1/3] fix typo in local name --- api/lava_furnace_recipe.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/lava_furnace_recipe.lua b/api/lava_furnace_recipe.lua index bc7d11f..c4e858a 100644 --- a/api/lava_furnace_recipe.lua +++ b/api/lava_furnace_recipe.lua @@ -1,5 +1,5 @@ -local lava_furance_recipes = {} +local lava_furnace_recipes = {} local NORMAL_COOK_LAVA_USAGE_PER_SEC = 2 -- in millibuckets local NORMAL_COOK_REDUCTION_FACTOR = 2 local MIN_TIME = 0.5 @@ -23,8 +23,8 @@ function logistica.register_lava_furnace_recipe(def) end local useChance = (def.additive_use_chance ~= nil and logistica.clamp(def.additive_use_chance, 0, 100)) or 100 - lava_furance_recipes[def.input] = lava_furance_recipes[def.input] or {} - table.insert(lava_furance_recipes[def.input], { + lava_furnace_recipes[def.input] = lava_furnace_recipes[def.input] or {} + table.insert(lava_furnace_recipes[def.input], { input = def.input, input_count = def.input_count or 1, output = def.output, @@ -36,7 +36,7 @@ function logistica.register_lava_furnace_recipe(def) end function logistica.get_lava_furnace_recipes_for(itemName) - local presets = lava_furance_recipes[itemName] + local presets = lava_furnace_recipes[itemName] if presets then return presets end -- else, try to adopt the real one @@ -60,5 +60,5 @@ end -- returns a copy_pointed_thing of internal the internal recipes - for reference function logistica.get_lava_furnace_internal_recipes() - return table.copy(lava_furance_recipes) + return table.copy(lava_furnace_recipes) end \ No newline at end of file From 5c1ef9c799b46ae24c8eaa427110826751da7be2 Mon Sep 17 00:00:00 2001 From: meex <196295011+Meex-Work@users.noreply.github.com> Date: Sat, 9 Aug 2025 07:59:26 +0200 Subject: [PATCH 2/3] add regular furnace recipe to the lava furnace recipes presets table when searching for lava furnace recipes --- api/lava_furnace_recipe.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/lava_furnace_recipe.lua b/api/lava_furnace_recipe.lua index c4e858a..d97480b 100644 --- a/api/lava_furnace_recipe.lua +++ b/api/lava_furnace_recipe.lua @@ -37,23 +37,24 @@ end function logistica.get_lava_furnace_recipes_for(itemName) local presets = lava_furnace_recipes[itemName] - if presets then return presets end - -- else, try to adopt the real one + -- also look for regular furnace recipe local output, decrOut = minetest.get_craft_result({ method = "cooking", width = 1, items = { ItemStack(itemName) } }) if output.time > 0 and decrOut.items[1]:is_empty() then local lavaTime = math.max(MIN_TIME, output.time / NORMAL_COOK_REDUCTION_FACTOR) - return {{ + table.insert(presets, { input_count = 1, output = output.item:to_string(), lava = lavaTime * NORMAL_COOK_LAVA_USAGE_PER_SEC, time = lavaTime - }} + }) end + if presets then return presets end + -- nothing found return nil end From 6d317df36fdc43cc8112a0e8a57c6423b8e53d1e Mon Sep 17 00:00:00 2001 From: meex <196295011+Meex-Work@users.noreply.github.com> Date: Sat, 9 Aug 2025 08:36:47 +0200 Subject: [PATCH 3/3] fix trying to insert into none existing table --- api/lava_furnace_recipe.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api/lava_furnace_recipe.lua b/api/lava_furnace_recipe.lua index d97480b..3c56573 100644 --- a/api/lava_furnace_recipe.lua +++ b/api/lava_furnace_recipe.lua @@ -45,18 +45,20 @@ function logistica.get_lava_furnace_recipes_for(itemName) if output.time > 0 and decrOut.items[1]:is_empty() then local lavaTime = math.max(MIN_TIME, output.time / NORMAL_COOK_REDUCTION_FACTOR) - table.insert(presets, { + local regularRecipe = { input_count = 1, output = output.item:to_string(), lava = lavaTime * NORMAL_COOK_LAVA_USAGE_PER_SEC, time = lavaTime - }) - end + } - if presets then return presets end + if presets then table.insert(presets, regularRecipe) + else presets = {regularRecipe} + end + end - -- nothing found - return nil + -- returns nil for no matching recipes + return presets end -- returns a copy_pointed_thing of internal the internal recipes - for reference