Fix doorcontroller and ta4 doser bugs
parent
43a2161d7e
commit
67507d008b
|
@ -126,6 +126,14 @@ function techage.is_primary_node(pos, dir)
|
|||
return param2 ~= 0
|
||||
end
|
||||
|
||||
function techage.is_air_like(name)
|
||||
local ndef = minetest.registered_nodes[name]
|
||||
if ndef and ndef.buildable_to then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- returns true, if node can be dug, otherwise false
|
||||
function techage.can_node_dig(node, ndef)
|
||||
if RegisteredNodesToBeDug[node.name] then
|
||||
|
|
|
@ -153,6 +153,15 @@ local State = techage.NodeStates:new({
|
|||
stop_node = stop_node,
|
||||
})
|
||||
|
||||
local function untake(recipe, pos, liquids)
|
||||
for _,item in pairs(recipe.input) do
|
||||
if item.name ~= "" then
|
||||
local outdir = liquids[item.name] or reload_liquids(pos)[item.name]
|
||||
liquid.untake(pos, outdir, item.name, item.num)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function dosing(pos, nvm, elapsed)
|
||||
-- trigger reactor (power)
|
||||
if not reactor_cmnd(pos, "power") then
|
||||
|
@ -215,6 +224,7 @@ local function dosing(pos, nvm, elapsed)
|
|||
name = recipe.output.name,
|
||||
amount = recipe.output.num})
|
||||
if not leftover or (tonumber(leftover) or 1) > 0 then
|
||||
untake(recipe, pos, liquids)
|
||||
State:blocked(pos, nvm)
|
||||
reactor_cmnd(pos, "stop")
|
||||
return
|
||||
|
@ -224,6 +234,7 @@ local function dosing(pos, nvm, elapsed)
|
|||
name = recipe.waste.name,
|
||||
amount = recipe.waste.num})
|
||||
if not leftover or (tonumber(leftover) or 1) > 0 then
|
||||
untake(recipe, pos, liquids)
|
||||
State:blocked(pos, nvm)
|
||||
reactor_cmnd(pos, "stop")
|
||||
return
|
||||
|
|
|
@ -162,7 +162,7 @@ function liquid.take(pos, outdir, name, amount, player_name)
|
|||
return taken, item_name
|
||||
end
|
||||
|
||||
function liquid.untake(pos, outdir, name, amount, player_name)
|
||||
function liquid.untake(pos, outdir, name, amount)
|
||||
for _,item in ipairs(get_network_table(pos, outdir, "tank")) do
|
||||
local liquid = LQD(item.pos)
|
||||
if liquid and liquid.untake then
|
||||
|
|
|
@ -49,13 +49,12 @@ local function swap_door_nodes(pos, open)
|
|||
if open then
|
||||
if node.name == item.name then
|
||||
minetest.remove_node(item.pos)
|
||||
item.removed = true
|
||||
else
|
||||
item.name = nil
|
||||
item.removed = false
|
||||
end
|
||||
elseif node.name == "air" then
|
||||
elseif techage.is_air_like(node.name) and item.removed then
|
||||
minetest.add_node(item.pos, {name = item.name, param2 = item.param2})
|
||||
else
|
||||
minetest.add_item(pos, item.pos, {name = item.name})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue