Prepare for lib 'networks'
This commit is contained in:
parent
6699fea14c
commit
f6ec65bd9a
@ -32,17 +32,16 @@ local Cable = tubelib2.Tube:new({
|
|||||||
"techage:power_pole2", "techage:powerswitch_box", "techage:powerswitch_box_on"},
|
"techage:power_pole2", "techage:powerswitch_box", "techage:powerswitch_box_on"},
|
||||||
secondary_node_names = {},
|
secondary_node_names = {},
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
||||||
if networks.node_to_be_replaced(pos, param2, tube_type, num_tubes) then
|
local name = minetest.get_node(pos).name
|
||||||
-- Handle "power line" nodes
|
if name == "techage:powerswitch_box" or name == "techage:powerswitch_box_on" or name == "techage:powerswitch_box_off" then
|
||||||
local name = minetest.get_node(pos).name
|
minetest.swap_node(pos, {name = name, param2 = param2 % 32})
|
||||||
if name == "techage:powerswitch_box" or name == "techage:powerswitch_box_on" or name == "techage:powerswitch_box_off" then
|
elseif name == "techage:power_line" or name == "techage:power_lineS" or name == "techage:power_lineA" then
|
||||||
minetest.swap_node(pos, {name = name, param2 = param2 % 32})
|
minetest.swap_node(pos, {name = "techage:power_line"..tube_type, param2 = param2 % 32})
|
||||||
elseif name == "techage:power_line" or name == "techage:power_lineS" or name == "techage:power_lineA" then
|
elseif not networks.hidden_name(pos) then
|
||||||
minetest.swap_node(pos, {name = "techage:power_line"..tube_type, param2 = param2 % 32})
|
minetest.swap_node(pos, {name = "techage:electric_cable"..tube_type, param2 = param2 % 32})
|
||||||
else
|
|
||||||
minetest.swap_node(pos, {name = "techage:electric_cable"..tube_type, param2 = param2 % 32})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
print("param2", name, param2)
|
||||||
|
M(pos):set_int("netw_param2", param2)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -77,10 +76,7 @@ minetest.register_node("techage:electric_cableS", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
Cable:after_dig_tube(pos, oldnode, oldmetadata)
|
||||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
|
||||||
Cable:after_dig_tube(pos, oldnode)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
paramtype2 = "facedir", -- important!
|
paramtype2 = "facedir", -- important!
|
||||||
@ -113,10 +109,7 @@ minetest.register_node("techage:electric_cableA", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
Cable:after_dig_tube(pos, oldnode, oldmetadata)
|
||||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
|
||||||
Cable:after_dig_tube(pos, oldnode)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
paramtype2 = "facedir", -- important!
|
paramtype2 = "facedir", -- important!
|
||||||
|
Loading…
Reference in New Issue
Block a user