diff --git a/README.md b/README.md index a04eae2..54b7689 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,12 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so: ### History +**2020-07-16 V0.17** +- TA4 Reactor recipe bugfix +- TA3 furnace power bugfix (response to the pull request #12 from Thomas-S) +- Manual bugfix (Thomas-S) +- Charcoal pile doesn't start smoking after beeing unloaded (issue #9 from Skamiz) + **2020-07-06 V0.16** - Oil cracking/hydrogenation recipes added - Ethereal growlight bugfix diff --git a/basis/recipe_lib.lua b/basis/recipe_lib.lua index bee3fa8..b937988 100644 --- a/basis/recipe_lib.lua +++ b/basis/recipe_lib.lua @@ -16,7 +16,6 @@ local S = techage.S local M = minetest.get_meta local Recipes = {} -- {rtype = {ouput = {....},...}} -local RecipeList = {} -- {rtype = {,...}} local range = techage.in_range @@ -47,8 +46,7 @@ end function techage.recipes.get(nvm, rtype) local recipes = Recipes[rtype] or {} - local recipe_list = RecipeList[rtype] or {} - return recipes[recipe_list[nvm.recipe_idx or 1]] + return recipes[nvm.recipe_idx or 1] end -- Add 4 input/output/waste recipe @@ -64,9 +62,6 @@ function techage.recipes.add(rtype, recipe) if not Recipes[rtype] then Recipes[rtype] = {} end - if not RecipeList[rtype] then - RecipeList[rtype] = {} - end local name, num local item = {input = {}} @@ -84,8 +79,7 @@ function techage.recipes.add(rtype, recipe) name, num = unpack(string.split(recipe.output, " ")) item.output = {name = name or "", num = tonumber(num) or 0} item.catalyst = recipe.catalyst - Recipes[rtype][name] = item - RecipeList[rtype][#(RecipeList[rtype])+1] = name + Recipes[rtype][#Recipes[rtype]+1] = item if minetest.global_exists("unified_inventory") then unified_inventory.register_craft({ @@ -98,10 +92,9 @@ end function techage.recipes.formspec(x, y, rtype, nvm) local recipes = Recipes[rtype] or {} - local recipe_list = RecipeList[rtype] or {} - nvm.recipe_idx = range(nvm.recipe_idx or 1, 1, #recipe_list) + nvm.recipe_idx = range(nvm.recipe_idx or 1, 1, #recipes) local idx = nvm.recipe_idx - local recipe = recipes[recipe_list[idx]] or RECIPE + local recipe = recipes[idx] or RECIPE local output = recipe.output.name.." "..recipe.output.num local waste = recipe.waste.name.." "..recipe.waste.num local catalyst = recipe.catalyst and techage.item_image_small(2.05, 0, recipe.catalyst, S("Catalyst")) or "" @@ -114,7 +107,7 @@ function techage.recipes.formspec(x, y, rtype, nvm) techage.item_image(2.95, 1, waste).. "button[0,2;1,1;priv;<<]".. "button[1,2;1,1;next;>>]".. - "label[1.9,2.2;"..S("Recipe")..": "..idx.."/"..#recipe_list.."]".. + "label[1.9,2.2;"..S("Recipe")..": "..idx.."/"..#recipes.."]".. "container_end[]" end diff --git a/furnace/booster.lua b/furnace/booster.lua index 5f283ac..30ba669 100644 --- a/furnace/booster.lua +++ b/furnace/booster.lua @@ -189,6 +189,8 @@ techage.register_node({"techage:ta3_booster", "techage:ta3_booster_on"}, { if topic == "power" then return techage.get_node_lvm(pos).name == "techage:ta3_booster_on" or power.power_available(pos, Cable) + elseif topic == "running" then + return techage.get_node_lvm(pos).name == "techage:ta3_booster_on" elseif topic == "start" and not nvm.running then if power.power_available(pos, Cable) then nvm.running = true diff --git a/furnace/firebox.lua b/furnace/firebox.lua index ef035f9..401270f 100644 --- a/furnace/firebox.lua +++ b/furnace/firebox.lua @@ -228,7 +228,7 @@ techage.register_node({"techage:furnace_firebox", "techage:furnace_firebox_on"}, if topic == "fuel" then return has_fuel(pos, nvm) and booster_cmnd(pos, "power") elseif topic == "running" then - return nvm.running and booster_cmnd(pos, "power") + return nvm.running and booster_cmnd(pos, "running") elseif topic == "start" then start_firebox(pos, nvm) booster_cmnd(pos, "start") diff --git a/furnace/furnace_top.lua b/furnace/furnace_top.lua index 1f6d235..df7a146 100644 --- a/furnace/furnace_top.lua +++ b/furnace/furnace_top.lua @@ -85,9 +85,17 @@ local function firebox_cmnd(pos, cmnd) "techage:furnace_heater", "techage:furnace_heater_on"}) end +local function firebox_has_fuel(nvm, pos) + if nvm.techage_state == techage.RUNNING then + return firebox_cmnd(pos, "running") + else + return firebox_cmnd(pos, "fuel") + end +end + local function cooking(pos, crd, nvm, elapsed) if nvm.techage_state == techage.RUNNING or check_if_worth_to_wakeup(pos, nvm) then - if firebox_cmnd(pos, "fuel") then + if firebox_has_fuel(nvm, pos) then local state, err = smelting(pos, nvm, elapsed) if state == techage.RUNNING then crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS) diff --git a/init.lua b/init.lua index 1a88ed0..d87d573 100644 --- a/init.lua +++ b/init.lua @@ -13,7 +13,7 @@ techage = {} -- Version for compatibility checks, see readme.md/history -techage.version = 0.16 +techage.version = 0.17 if minetest.global_exists("tubelib") then minetest.log("error", "[techage] Techage can't be used together with the mod tubelib!") diff --git a/power/node_api.lua b/power/node_api.lua index 9d7487e..a5db533 100644 --- a/power/node_api.lua +++ b/power/node_api.lua @@ -139,7 +139,7 @@ end -- Consumer related functions -- --- check if there is a living network +-- function checks for a power grid, not for enough power function techage.power.power_available(pos, Cable) local nvm = techage.get_nvm(pos) local tlib_type = Cable.tube_type