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