Fix bug: Tubes do not recognize when TA2 nodes are added/removed
This commit is contained in:
parent
976dd379ca
commit
b5bc1751b5
@ -180,10 +180,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
|||||||
if (meta:contains("node_number")) then
|
if (meta:contains("node_number")) then
|
||||||
meta:set_string("node_number", "")
|
meta:set_string("node_number", "")
|
||||||
end
|
end
|
||||||
local number = "-"
|
local number = techage.add_node(pos, name_pas, stage == 2)
|
||||||
if stage > 2 then
|
|
||||||
number = techage.add_node(pos, name_pas)
|
|
||||||
end
|
|
||||||
if crd.power_netw then
|
if crd.power_netw then
|
||||||
crd.power_netw:after_place_node(pos)
|
crd.power_netw:after_place_node(pos)
|
||||||
end
|
end
|
||||||
|
@ -207,10 +207,15 @@ end
|
|||||||
-- Add node to the techage lists.
|
-- Add node to the techage lists.
|
||||||
-- Function determines and returns the node position number,
|
-- Function determines and returns the node position number,
|
||||||
-- needed for message communication.
|
-- needed for message communication.
|
||||||
function techage.add_node(pos, name)
|
-- If TA2 node, return '-' instead of a real number, because
|
||||||
|
-- TA2 nodes should not support number based commands.
|
||||||
|
function techage.add_node(pos, name, is_ta2)
|
||||||
if item_handling_node(name) then
|
if item_handling_node(name) then
|
||||||
Tube:after_place_node(pos)
|
Tube:after_place_node(pos)
|
||||||
end
|
end
|
||||||
|
if is_ta2 then
|
||||||
|
return "-"
|
||||||
|
end
|
||||||
local key = minetest.hash_node_position(pos)
|
local key = minetest.hash_node_position(pos)
|
||||||
return NumbersToBeRecycled[key] or get_number(pos, true)
|
return NumbersToBeRecycled[key] or get_number(pos, true)
|
||||||
end
|
end
|
||||||
@ -222,13 +227,10 @@ function techage.remove_node(pos, oldnode, oldmetadata)
|
|||||||
if number and tonumber(number) then
|
if number and tonumber(number) then
|
||||||
local key = minetest.hash_node_position(pos)
|
local key = minetest.hash_node_position(pos)
|
||||||
NumbersToBeRecycled[key] = number
|
NumbersToBeRecycled[key] = number
|
||||||
local ninfo = NodeInfoCache[number] or update_nodeinfo(number)
|
NodeInfoCache[number] = nil
|
||||||
if ninfo then
|
end
|
||||||
NodeInfoCache[number] = nil
|
if oldnode and item_handling_node(oldnode.name) then
|
||||||
if item_handling_node(ninfo.name) then
|
Tube:after_dig_node(pos)
|
||||||
Tube:after_dig_node(pos)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user