From 4570a10241752ded71aecaa705ac8a92e2526b87 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Mon, 2 May 2022 19:21:27 +0200 Subject: [PATCH] Fix bugs for ta5 heat exchanger and ta4 electronic fab --- basic_machines/electronic_fab.lua | 3 ++- basis/node_store.lua | 2 +- basis/recipe_lib.lua | 7 +++++-- fusion_reactor/heatexchanger2.lua | 8 ++++---- recipe_checker.lua | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/basic_machines/electronic_fab.lua b/basic_machines/electronic_fab.lua index 6487412..c7aadca 100644 --- a/basic_machines/electronic_fab.lua +++ b/basic_machines/electronic_fab.lua @@ -74,8 +74,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player end local function making(pos, crd, nvm, inv) + local owner = M(pos):get_string("owner") local rtype = RecipeType[crd.stage] - local recipe = recipes.get(nvm, rtype) + local recipe = recipes.get(nvm, rtype, owner) local output = ItemStack(recipe.output.name.." "..recipe.output.num) if inv:room_for_item("dst", output) then for _,item in ipairs(recipe.input) do diff --git a/basis/node_store.lua b/basis/node_store.lua index cce2e55..ec5b7dc 100644 --- a/basis/node_store.lua +++ b/basis/node_store.lua @@ -71,7 +71,7 @@ end ------------------------------------------------------------------- -- Storage scheduler ------------------------------------------------------------------- -local CYCLE_TIME = 900 -- store data every 15 min +local CYCLE_TIME = 600 -- store data every 10 min local JobQueue = {} local first = 0 local last = -1 diff --git a/basis/recipe_lib.lua b/basis/recipe_lib.lua index 8ff64e7..4d98ee7 100644 --- a/basis/recipe_lib.lua +++ b/basis/recipe_lib.lua @@ -74,9 +74,12 @@ local function input_string(recipe) return table.concat(tbl, "") end -function techage.recipes.get(nvm, rtype) +function techage.recipes.get(nvm, rtype, owner) local recipes = Recipes[rtype] or {} - return recipes[nvm.recipe_idx or 1] + if owner then + recipes = filter_recipes_based_on_points(recipes, owner) + end + return recipes[nvm.recipe_idx or 1] or recipes[1] end -- Add 4 input/output/waste recipe diff --git a/fusion_reactor/heatexchanger2.lua b/fusion_reactor/heatexchanger2.lua index 7ea1df2..88747f3 100644 --- a/fusion_reactor/heatexchanger2.lua +++ b/fusion_reactor/heatexchanger2.lua @@ -183,7 +183,7 @@ local function steam_management(pos, nvm) nvm.temperature = math.min(nvm.temperature + 10, 100) elseif resp ~= true then State:fault(pos, nvm, resp) - stop_node(pos, nvm) + State:stop(pos, nvm) return false end @@ -325,10 +325,10 @@ techage.register_node({"techage:ta5_heatexchanger2"}, { local data = power.get_network_data(pos, Cable, DOWN) return data.consumed - data.provided elseif topic == "on" then - start_node(pos, techage.get_nvm(pos)) + State:start(pos, nvm) return true elseif topic == "off" then - stop_node(pos, techage.get_nvm(pos)) + State:stop(pos, nvm) return true else return "unsupported" @@ -344,7 +344,7 @@ techage.register_node({"techage:ta5_heatexchanger2"}, { -- Attempt to restart the system as the heat exchanger goes into error state -- when parts of the storage block are unloaded. if nvm.techage_state == techage.FAULT then - start_node(pos, nvm) + State:start(pos, nvm) end end, }) diff --git a/recipe_checker.lua b/recipe_checker.lua index 95558e1..93b83fe 100644 --- a/recipe_checker.lua +++ b/recipe_checker.lua @@ -14,7 +14,7 @@ end minetest.after(1, function() for name,_ in pairs(minetest.registered_items) do local mod = string.split(name, ":")[1] - if mod == "techage" or mod == "signs_bot" then + if mod == "techage" or mod == "signs_bot" or mod == "vm16" or mod == "beduino" then local recipes = minetest.get_all_craft_recipes(name) if recipes then for _,recipe in ipairs(recipes) do