Fix bugs for ta5 heat exchanger and ta4 electronic fab

This commit is contained in:
Joachim Stolberg 2022-05-02 19:21:27 +02:00
parent 192d46c682
commit 4570a10241
5 changed files with 13 additions and 9 deletions

View File

@ -74,8 +74,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
end end
local function making(pos, crd, nvm, inv) local function making(pos, crd, nvm, inv)
local owner = M(pos):get_string("owner")
local rtype = RecipeType[crd.stage] 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) local output = ItemStack(recipe.output.name.." "..recipe.output.num)
if inv:room_for_item("dst", output) then if inv:room_for_item("dst", output) then
for _,item in ipairs(recipe.input) do for _,item in ipairs(recipe.input) do

View File

@ -71,7 +71,7 @@ end
------------------------------------------------------------------- -------------------------------------------------------------------
-- Storage scheduler -- Storage scheduler
------------------------------------------------------------------- -------------------------------------------------------------------
local CYCLE_TIME = 900 -- store data every 15 min local CYCLE_TIME = 600 -- store data every 10 min
local JobQueue = {} local JobQueue = {}
local first = 0 local first = 0
local last = -1 local last = -1

View File

@ -74,9 +74,12 @@ local function input_string(recipe)
return table.concat(tbl, "") return table.concat(tbl, "")
end end
function techage.recipes.get(nvm, rtype) function techage.recipes.get(nvm, rtype, owner)
local recipes = Recipes[rtype] or {} 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 end
-- Add 4 input/output/waste recipe -- Add 4 input/output/waste recipe

View File

@ -183,7 +183,7 @@ local function steam_management(pos, nvm)
nvm.temperature = math.min(nvm.temperature + 10, 100) nvm.temperature = math.min(nvm.temperature + 10, 100)
elseif resp ~= true then elseif resp ~= true then
State:fault(pos, nvm, resp) State:fault(pos, nvm, resp)
stop_node(pos, nvm) State:stop(pos, nvm)
return false return false
end end
@ -325,10 +325,10 @@ techage.register_node({"techage:ta5_heatexchanger2"}, {
local data = power.get_network_data(pos, Cable, DOWN) local data = power.get_network_data(pos, Cable, DOWN)
return data.consumed - data.provided return data.consumed - data.provided
elseif topic == "on" then elseif topic == "on" then
start_node(pos, techage.get_nvm(pos)) State:start(pos, nvm)
return true return true
elseif topic == "off" then elseif topic == "off" then
stop_node(pos, techage.get_nvm(pos)) State:stop(pos, nvm)
return true return true
else else
return "unsupported" 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 -- Attempt to restart the system as the heat exchanger goes into error state
-- when parts of the storage block are unloaded. -- when parts of the storage block are unloaded.
if nvm.techage_state == techage.FAULT then if nvm.techage_state == techage.FAULT then
start_node(pos, nvm) State:start(pos, nvm)
end end
end, end,
}) })

View File

@ -14,7 +14,7 @@ end
minetest.after(1, function() minetest.after(1, function()
for name,_ in pairs(minetest.registered_items) do for name,_ in pairs(minetest.registered_items) do
local mod = string.split(name, ":")[1] 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) local recipes = minetest.get_all_craft_recipes(name)
if recipes then if recipes then
for _,recipe in ipairs(recipes) do for _,recipe in ipairs(recipes) do