Fix the visual junction connection bug, remove EOL blanks

master
Joachim Stolberg 2022-01-05 21:23:57 +01:00
parent b21bc24522
commit 494976eb4b
12 changed files with 129 additions and 101 deletions

View File

@ -7,7 +7,7 @@
AGPL v3
See LICENSE.txt for more information
Control API to control other network nodes which have a control interface
]]--
@ -40,13 +40,13 @@ end
-- }
function networks.control.register_nodes(names, control_callbacks)
assert(type(control_callbacks) == "table")
for _, name in ipairs(names) do
minetest.override_item(name, {control = control_callbacks})
end
end
-- Send a message with 'topic' string and any 'payload 'to all 'tlib2' network
-- Send a message with 'topic' string and any 'payload 'to all 'tlib2' network
-- nodes of type 'node_type'.
-- Function returns the number of nodes the message was sent to.
function networks.control.send(pos, tlib2, outdir, node_type, topic, payload)
@ -63,7 +63,7 @@ function networks.control.send(pos, tlib2, outdir, node_type, topic, payload)
return cnt
end
-- Send a request with 'topic' string to all 'tlib2' network
-- Send a request with 'topic' string to all 'tlib2' network
-- nodes of type 'node_type'.
-- Function returns a list with all responses.
function networks.control.request(pos, tlib2, outdir, node_type, topic)

View File

@ -95,7 +95,7 @@ function networks.hide_node(pos, node, placer)
local inv = placer:get_inventory()
local stack = inv:get_stack("main", 1)
local taken = stack:take_item(1)
if taken:get_count() == 1 and tFillingMaterial[taken:get_name()] then
local meta = M(pos)
meta:set_string("netw_name", node.name)

View File

@ -36,4 +36,4 @@ if minetest.settings:get_bool("networks_test_enabled") == true then
local Cable = dofile(MP .. "/test/test_power.lua")
assert(loadfile(MP .. "/test/test_control.lua"))(Cable)
dofile(MP .. "/test/test_tool.lua")
end
end

View File

@ -16,13 +16,13 @@ end
-- Typical call: if hasbit(x, bit(3)) then ...
local function hasbit(x, p)
return x % (p + p) >= p
return x % (p + p) >= p
end
local function setbit(x, p)
return hasbit(x, p) and x or x + p
end
local function get_node_box(val, size, boxes)
local fixed = {{-size, -size, -size, size, size, size}}
for i = 1,6 do
@ -107,10 +107,13 @@ function networks.junction_type(pos, network, default_side, param2)
if connected(network, pos, dir) then
val = setbit(val, bit(dir2))
elseif network:is_secondary_node(pos, dir) then
val = setbit(val, bit(dir2))
local node = network:get_secondary_node(pos, dir)
if network:is_valid_dir(node, networks.Flip[dir]) then
val = setbit(val, bit(dir2))
end
end
end
end
return val
end
end

View File

@ -7,7 +7,7 @@
AGPL v3
See LICENSE.txt for more information
Liquid API for liquid pumping and storing nodes
]]--
@ -42,8 +42,8 @@ end
-- capa = CAPACITY,
-- peek = function(pos, indir), -- returns: liquid name
-- put = function(pos, indir, name, amount), -- returns: liquid leftover or 0
-- take = function(pos, indir, name, amount), -- returns: taken, name
-- untake = function(pos, indir, name, amount), -- returns: leftover
-- take = function(pos, indir, name, amount), -- returns: taken, name
-- untake = function(pos, indir, name, amount), -- returns: leftover
-- }
function networks.liquid.register_nodes(names, tlib2, node_type, valid_sides, liquid_callbacks)
if node_type == "pump" then
@ -57,14 +57,14 @@ function networks.liquid.register_nodes(names, tlib2, node_type, valid_sides, li
else
error("parameter error")
end
if node_type == "tank" then
assert(type(liquid_callbacks) == "table")
end
tlib2:add_secondary_node_names(names)
networks.registered_networks.liquid[tlib2.tube_type] = tlib2
for _, name in ipairs(names) do
local ndef = minetest.registered_nodes[name]
local tbl = ndef.networks or {}
@ -136,7 +136,7 @@ function networks.liquid.take(pos, tlib2, outdir, name, amount, show_debug_cube)
end
taken, name = liq.take(item.pos, item.indir, name, amount)
if taken and name and taken > 0 then
break
break
end
end
end
@ -188,7 +188,7 @@ function networks.liquid.srv_put(nvm, name, amount, capa)
assert(name)
assert(amount and amount >= 0)
assert(capa and capa > 0)
nvm.liquid = nvm.liquid or {}
amount = amount or 0
if not nvm.liquid.name then
@ -211,7 +211,7 @@ end
function networks.liquid.srv_take(nvm, name, amount)
assert(amount and amount >= 0)
nvm.liquid = nvm.liquid or {}
amount = amount or 0
if not name or nvm.liquid.name == name then
@ -220,7 +220,7 @@ function networks.liquid.srv_take(nvm, name, amount)
if nvm.liquid.amount > amount then
nvm.liquid.amount = nvm.liquid.amount - amount
return amount, name
else
else
local rest = nvm.liquid.amount
local name = nvm.liquid.name
nvm.liquid.amount = 0

View File

@ -48,7 +48,7 @@ local function netw_num(netID)
end
return DbgNetIDs[netID]
end
local function network_nodes(netID, network)
local tbl = {}
for node_type,table in pairs(network or {}) do
@ -99,7 +99,7 @@ minetest.register_entity("networks:marker_cube", {
-- Helper
-------------------------------------------------------------------------------
-- return the networks table from the node definition
local function net_def(pos, netw_type)
local function net_def(pos, netw_type)
local ndef = minetest.registered_nodes[get_nodename(pos)]
if ndef and ndef.networks then
return ndef.networks[netw_type]
@ -107,12 +107,12 @@ local function net_def(pos, netw_type)
error("Node " .. get_nodename(pos) .. " at ".. P2S(pos) .. " has no 'ndef.networks'")
end
local function net_def2(pos, node_name, netw_type)
local function net_def2(pos, node_name, netw_type)
local ndef = minetest.registered_nodes[node_name]
if ndef and ndef.networks then
return ndef.networks[netw_type]
end
return net_def(pos, netw_type)
return net_def(pos, netw_type)
end
-- Don't allow direct connections between to nodes of the same type
@ -255,7 +255,7 @@ local function collect_network_nodes(pos, tlib2, outdir)
local t = minetest.get_us_time()
Route = {}
NumNodes = 0
pos_already_reached(pos)
pos_already_reached(pos)
local netw = {}
local node = N(pos)
local netw_type = tlib2.tube_type
@ -341,7 +341,7 @@ local function set_netID(pos, outdir, netID)
local hash = minetest.hash_node_position(pos)
NetIDs[hash] = NetIDs[hash] or {}
NetIDs[hash][outdir] = netID
end
end
local function get_netID(pos, outdir)
local hash = minetest.hash_node_position(pos)
@ -410,7 +410,7 @@ networks.Flip = tubelib2.Turn180Deg
-- networks.net_def(pos, netw_type)
networks.net_def = net_def
-- sides: outdir:
-- sides: outdir:
-- U
-- | B
-- | / 6 (N)
@ -445,9 +445,9 @@ networks.network_nodes = network_nodes
networks.get_network = get_network
-- return the networks table from the node definition
-- networks.net_def(pos, netw_type)
-- networks.net_def(pos, netw_type)
networks.net_def = net_def
-- Function returns {outdir} or all node dirs with connections
-- networks.get_outdirs(pos, tlib2, outdir)
networks.get_outdirs = get_outdirs
@ -472,11 +472,11 @@ function networks.determine_netID(pos, tlib2, outdir)
assert(outdir)
local netID = get_netID(pos, outdir)
if netID and Networks[tlib2.tube_type] and Networks[tlib2.tube_type][netID] then
return netID
return netID
elseif netID == 0 then
return -- no network available
end
local netw = collect_network_nodes(pos, tlib2, outdir)
if netw.num_nodes > 1 then
netID = determine_netID(netw)

View File

@ -29,4 +29,4 @@ function networks.node_observer(tag, pos, tbl1, tbl2)
print("##### Node_observer (" .. (minetest.get_gametime() % 100) .. "): '" .. N(pos).name .. "' - " .. tag)
print("tbl1", dump(tbl1), "\ntbl2", dump(tbl2))
end
end
end

View File

@ -7,7 +7,7 @@
AGPL v3
See LICENSE.txt for more information
Power API for power consuming and generating nodes
]]--
@ -26,8 +26,8 @@ networks.registered_networks.power = {}
local DEFAULT_DATA = {
curr_load = 0, -- network storage value
max_capa = 0, -- network storage capacity
consumed = 0, -- consumed power by consumers
provided = 0, -- provided power by generators
consumed = 0, -- consumed power by consumers
provided = 0, -- provided power by generators
available = 0, -- max. available generator power
netw_num = 0, -- network number
}
@ -75,7 +75,7 @@ local function get_power_data(pos, tlib2, outdir, netID)
max_perf = max_perf, -- max. available power
consumed = 0, -- consumed power
provided = 0, -- provided power
available = 0, -- available power
available = 0, -- available power
num_nodes = netw.num_nodes,
}
return Power[netID]
@ -101,10 +101,10 @@ function networks.power.register_nodes(names, tlib2, node_type, valid_sides)
else
error("parameter error")
end
tlib2:add_secondary_node_names(names)
networks.registered_networks.power[tlib2.tube_type] = tlib2
for _, name in ipairs(names) do
local ndef = minetest.registered_nodes[name]
local tbl = ndef.networks or {}
@ -193,12 +193,12 @@ function networks.power.provide_power(pos, tlib2, outdir, amount, cp1, cp2)
local pwr = Power[netID] or get_power_data(pos, tlib2, outdir, netID)
local x = pwr.curr_load / pwr.max_capa
OBS("provide_power", pos, {outdir = outdir, amount = amount}, pwr)
pwr.available = pwr.available + amount
amount = math.min(amount, pwr.max_capa - pwr.curr_load)
cp1 = cp1 or 0.8
cp2 = cp2 or 1.0
if x < cp1 then -- charge with full power
pwr.curr_load = pwr.curr_load + amount
pwr.provided = pwr.provided + amount
@ -273,7 +273,7 @@ function networks.power.transfer_duplex(pos, netw1, outdir1, netw2, outdir2, amo
local pwr2 = Power[netID2] or get_power_data(pos, netw2, outdir2, netID2)
local lvl = pwr1.curr_load / pwr1.max_capa - pwr2.curr_load / pwr2.max_capa
local moved
pwr2.available = pwr2.available + amount
pwr1.available = pwr1.available + amount
if lvl > 0 then
@ -294,13 +294,13 @@ function networks.power.transfer_duplex(pos, netw1, outdir1, netw2, outdir2, amo
pwr1.provided = (pwr1.provided or 0) + moved
else
moved = 0
end
end
OBS("transfer_duplex", pos, pwr1, pwr2)
return {
curr_load1 = pwr1.curr_load,
curr_load2 = pwr2.curr_load,
max_capa1 = pwr1.max_capa,
max_capa2 = pwr2.max_capa,
curr_load1 = pwr1.curr_load,
curr_load2 = pwr2.curr_load,
max_capa1 = pwr1.max_capa,
max_capa2 = pwr2.max_capa,
moved = moved}
end
end
@ -317,7 +317,7 @@ function networks.power.transfer_simplex(pos, netw1, outdir1, netw2, outdir2, am
local pwr2 = Power[netID2] or get_power_data(pos, netw2, outdir2, netID2)
local lvl = pwr1.curr_load / pwr1.max_capa - pwr2.curr_load / pwr2.max_capa
local moved
pwr2.available = pwr2.available + amount
if lvl > 0 then
-- transfer from netw1 to netw2
@ -329,13 +329,13 @@ function networks.power.transfer_simplex(pos, netw1, outdir1, netw2, outdir2, am
pwr2.provided = (pwr2.provided or 0) + moved
else
moved = 0
end
end
OBS("transfer_simplex", pos, pwr1, pwr2)
return {
curr_load1 = pwr1.curr_load,
curr_load2 = pwr2.curr_load,
max_capa1 = pwr1.max_capa,
max_capa2 = pwr2.max_capa,
curr_load1 = pwr1.curr_load,
curr_load2 = pwr2.curr_load,
max_capa1 = pwr1.max_capa,
max_capa2 = pwr2.max_capa,
moved = moved}
end
end
@ -347,7 +347,7 @@ function networks.power.turn_switch_on(pos, tlib2, name_off, name_on)
local node = N(pos)
local meta = M(pos)
local changed = false
if node.name == name_off then
node.name = name_on
changed = true
@ -356,14 +356,14 @@ function networks.power.turn_switch_on(pos, tlib2, name_off, name_on)
else
return false
end
if meta:contains("netw_param2") then
meta:set_int("netw_param2", meta:get_int("netw_param2_copy"))
else
else
node.param2 = meta:get_int("netw_param2_copy")
end
meta:set_int("netw_param2_copy", 0)
if changed then
minetest.swap_node(pos, node)
end
@ -376,7 +376,7 @@ function networks.power.turn_switch_off(pos, tlib2, name_off, name_on)
local node = N(pos)
local meta = M(pos)
local changed = false
if node.name == name_on then
node.name = name_off
changed = true
@ -385,18 +385,18 @@ function networks.power.turn_switch_off(pos, tlib2, name_off, name_on)
else
return false
end
if meta:contains("netw_param2") then
meta:set_int("netw_param2_copy", meta:get_int("netw_param2"))
--meta:set_int("netw_param2", 0)
else
else
meta:set_int("netw_param2_copy", node.param2)
end
if changed then
minetest.swap_node(pos, node)
end
if meta:contains("netw_param2") then
node.param2 = meta:get_int("netw_param2")
end
@ -426,8 +426,8 @@ function networks.power.get_network_data(pos, tlib2, outdir)
local res = {
curr_load = pwr.curr_load, -- network storage value
max_capa = pwr.max_capa, -- network storage capacity
consumed = consumed, -- consumed power by consumers
provided = provided, -- provided power by generators
consumed = consumed, -- consumed power by consumers
provided = provided, -- provided power by generators
available = available, -- max. available generator power
netw_num = networks.netw_num(netID), -- network number
}

View File

@ -37,7 +37,7 @@ minetest.register_node("networks:client", {
local outdir = networks.side_to_outdir(pos, "F")
M(pos):set_int("outdir", outdir)
M(pos):set_string("infotext", "off")
Cable:after_place_node(pos, {outdir})
Cable:after_place_node(pos, {outdir})
tubelib2.init_mem(pos)
end,
after_dig_node = function(pos, oldnode, oldmetadata)
@ -89,7 +89,7 @@ minetest.register_node("networks:server_off", {
"networks_sto.png^[colorize:#F05100:60",
},
after_place_node = function(pos)
Cable:after_place_node(pos)
Cable:after_place_node(pos)
end,
after_dig_node = function(pos)
Cable:after_dig_node(pos)
@ -108,13 +108,13 @@ minetest.register_node("networks:server_on", {
"networks_sto.png^[colorize:#F05100:60",
},
after_place_node = function(pos)
Cable:after_place_node(pos)
Cable:after_place_node(pos)
end,
after_dig_node = function(pos)
Cable:after_dig_node(pos)
end,
paramtype = "light",
light_source = 8,
light_source = 8,
paramtype2 = "facedir",
drop = "networks:server_off",
groups = {crumbly = 2, cracky = 2, snappy = 2, not_in_creative_inventory = 1},

View File

@ -26,9 +26,9 @@ local liquid = networks.liquid
-------------------------------------------------------------------------------
local Pipe = tubelib2.Tube:new({
dirs_to_check = {1,2,3,4,5,6},
max_tube_length = 100,
max_tube_length = 100,
tube_type = "liq",
primary_node_names = {"networks:pipeS", "networks:pipeA", "networks:valve_on"},
primary_node_names = {"networks:pipeS", "networks:pipeA", "networks:valve_on"},
secondary_node_names = {}, -- Names will be added via 'liquids.register_nodes'
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
local name = minetest.get_node(pos).name
@ -212,7 +212,7 @@ end
local function after_place_node(pos)
local outdir = networks.side_to_outdir(pos, "B")
M(pos):set_int("outdir", outdir)
Pipe:after_place_node(pos, {outdir})
Pipe:after_place_node(pos, {outdir})
M(pos):set_string("infotext", "off")
tubelib2.init_mem(pos)
end
@ -261,7 +261,7 @@ minetest.register_node("networks:pump_on", {
on_timer = pumping,
on_rightclick = on_rightclick,
paramtype = "light",
light_source = 8,
light_source = 8,
paramtype2 = "facedir",
diggable = false,
drop = "",
@ -289,7 +289,7 @@ local function register_tank(name, description, liquid_name, liquid_amount)
'networks_tank.png^[colorize:#007577:60',
},
after_place_node = function(pos)
Pipe:after_place_node(pos)
Pipe:after_place_node(pos)
local mem = tubelib2.init_mem(pos)
mem.liquid = {}
mem.liquid.name = liquid_name
@ -319,7 +319,7 @@ register_tank("networks:tank1", "Water Tank", "water", STORAGE_CAPA)
register_tank("networks:tank2", "Milk Tank", "milk", STORAGE_CAPA)
register_tank("networks:tank3", "Empty Tank", nil, 0)
liquid.register_nodes({"networks:tank1", "networks:tank2", "networks:tank3"},
liquid.register_nodes({"networks:tank1", "networks:tank2", "networks:tank3"},
Pipe, "tank", nil, {
capa = STORAGE_CAPA,
peek = function(pos, indir)
@ -375,7 +375,7 @@ minetest.register_node("networks:valve_on", {
on_rightclick = function(pos, node, clicker)
if liquid.turn_valve_off(pos, Pipe, "networks:valve_off", "networks:valve_on") then
minetest.sound_play("doors_glass_door_open", {
pos = pos,
pos = pos,
gain = 1,
max_hear_distance = 5})
end
@ -409,7 +409,7 @@ minetest.register_node("networks:valve_off", {
on_rightclick = function(pos, node, clicker)
if liquid.turn_valve_on(pos, Pipe, "networks:valve_off", "networks:valve_on") then
minetest.sound_play("doors_glass_door_open", {
pos = pos,
pos = pos,
gain = 1,
max_hear_distance = 5})
end

View File

@ -38,9 +38,9 @@ local power = networks.power
-------------------------------------------------------------------------------
local Cable = tubelib2.Tube:new({
dirs_to_check = {1,2,3,4,5,6},
max_tube_length = 100,
max_tube_length = 100,
tube_type = "pwr",
primary_node_names = {"networks:cableS", "networks:cableA", "networks:switch_on"},
primary_node_names = {"networks:cableS", "networks:cableA", "networks:switch_on"},
secondary_node_names = {}, -- Names will be added via 'power.register_nodes'
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
local name = minetest.get_node(pos).name
@ -85,7 +85,7 @@ if HIDDEN then
"default:mese",
"default:diamondblock",
})
end
end
-- Use global callback instead of node related functions
Cable:register_on_tube_update2(function(pos, outdir, tlib2, node)
@ -215,7 +215,7 @@ minetest.register_node("networks:generator", {
after_place_node = function(pos)
local outdir = networks.side_to_outdir(pos, "F")
M(pos):set_int("outdir", outdir)
Cable:after_place_node(pos, {outdir})
Cable:after_place_node(pos, {outdir})
M(pos):set_string("infotext", "off")
tubelib2.init_mem(pos)
end,
@ -251,7 +251,7 @@ minetest.register_node("networks:generator", {
local mem = tubelib2.get_mem(pos)
if mem.running then
-- generator storage capa = 2 * performance
return {level = (mem.load or 0) / GEN_MAX, perf = GEN_MAX, capa = GEN_MAX * 2}
return {level = (mem.load or 0) / GEN_MAX, perf = GEN_MAX, capa = GEN_MAX * 2}
end
end,
paramtype2 = "facedir",
@ -281,7 +281,7 @@ minetest.register_node("networks:storage", {
after_place_node = function(pos)
local outdir = networks.side_to_outdir(pos, "F")
M(pos):set_int("outdir", outdir)
Cable:after_place_node(pos, {outdir})
Cable:after_place_node(pos, {outdir})
tubelib2.init_mem(pos)
M(pos):set_string("infotext", "off")
end,
@ -384,7 +384,7 @@ end
minetest.register_node("networks:consumer", {
description = "Consumer",
tiles = {'networks_con.png^[colorize:#000000:50'},
on_timer = function(pos, elapsed)
local consumed = power.consume_power(pos, Cable, nil, CON_MAX)
if consumed == CON_MAX then
@ -418,7 +418,7 @@ minetest.register_node("networks:consumer_on", {
after_place_node = after_place_node,
after_dig_node = after_dig_node,
paramtype = "light",
light_source = minetest.LIGHT_MAX,
light_source = minetest.LIGHT_MAX,
paramtype2 = "facedir",
diggable = false,
drop = "",
@ -464,7 +464,7 @@ minetest.register_node("networks:switch_on", {
on_rightclick = function(pos, node, clicker)
if power.turn_switch_off(pos, Cable, "networks:switch_off", "networks:switch_on") then
minetest.sound_play("doors_glass_door_open", {
pos = pos,
pos = pos,
gain = 1,
max_hear_distance = 5})
end
@ -498,7 +498,7 @@ minetest.register_node("networks:switch_off", {
on_rightclick = function(pos, node, clicker)
if power.turn_switch_on(pos, Cable, "networks:switch_off", "networks:switch_on") then
minetest.sound_play("doors_glass_door_open", {
pos = pos,
pos = pos,
gain = 1,
max_hear_distance = 5})
end
@ -538,7 +538,7 @@ local function replace_node(itemstack, placer, pointed_thing)
end
if res then
minetest.sound_play("default_dig_snappy", {
pos = pos,
pos = pos,
gain = 1,
max_hear_distance = 5})
elseif placer and placer.get_player_name then
@ -571,15 +571,15 @@ minetest.register_chatcommand("power_data", {
local data = power.get_network_data(pos, Cable)
if data then
local s = string.format("Netw %u: generated = %u/%u, consumed = %u, storage load = %u/%u",
data.netw_num, round(data.provided),
data.available, round(data.consumed),
data.netw_num, round(data.provided),
data.available, round(data.consumed),
round(data.curr_load), round(data.max_capa))
return true, s
end
return false, "No valid node position!"
end
})
return Cable

View File

@ -61,11 +61,11 @@ local function print_power_network_data(pos, api, netw, netw_type)
print("- Number of generators: " .. #(netw.gen or {}))
print("- Number of consumers: " .. #(netw.con or {}))
print("- Number of storage systems: " .. #(netw.sto or {}))
end
end
if data then
local s = string.format("- Netw %u: generated = %u/%u, consumed = %u, storage load = %u/%u",
data.netw_num, round(data.provided),
data.available, round(data.consumed),
data.netw_num, round(data.provided),
data.available, round(data.consumed),
round(data.curr_load), round(data.max_capa))
print(s)
else
@ -73,6 +73,16 @@ local function print_power_network_data(pos, api, netw, netw_type)
end
end
local function print_liquid_network_data(pos, api, netw_type, outdir)
local tlib2 = networks.registered_networks[api][netw_type]
local netw = networks.get_network_table(pos, tlib2, outdir)
if netw then
print(" - Number of network nodes: " .. (netw.num_nodes or 0))
print(" - Number of pumps: " .. #(netw.pump or {}))
print(" - Number of tanks: " .. #(netw.tank or {}))
end
end
local function print_netID(pos, api, netw_type)
local tlib2 = networks.registered_networks[api][netw_type]
for _,outdir in ipairs(networks.get_outdirs(pos, tlib2)) do
@ -80,9 +90,12 @@ local function print_netID(pos, api, netw_type)
local s = tubelib2.dir_to_string(outdir)
if netID then
print("- " .. s .. ": netwNum for '" .. netw_type .. "': " .. networks.netw_num(netID))
if api == "liquid" then
print_liquid_network_data(pos, api, netw_type, outdir)
end
else
print("- " .. s .. ": Node has no '" .. netw_type .. "' netID!!!")
end
end
end
end
@ -105,36 +118,48 @@ local function print_valid_sides(name, api, netw_type)
end
end
local function print_connected_nodes(pos, api, netw_type)
local tlib2 = networks.registered_networks[api][netw_type]
for outdir = 1,6 do
local destpos, indir = tlib2:get_connected_node_pos(pos, outdir)
if destpos and tlib2:connected(destpos) then
local s1 = tubelib2.dir_to_string(outdir)
local s2 = tubelib2.dir_to_string(indir)
local node = minetest.get_node(destpos)
print("- " .. s1 .. ": Node connected to " .. node.name .. " at " .. P2S(destpos) .. " from " .. s2)
end
end
end
-- debug print of node related data
local function debug_print(pos)
local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name]
if not NetwTypes then
collect_netw_types()
end
if not ndef.networks then
print("No networks node!!!")
return
end
print("########## " .. node.name .. " ###########")
for netw_type,api in pairs(NetwTypes) do
if ndef.networks[netw_type] then
print_sides(pos, api, netw_type)
if api == "power" then
print_power_network_data(pos, api, ndef.networks, netw_type)
elseif api == "liquid" then
--print_liquid_network_data(pos, api, netw_type)
end
print_netID(pos, api, netw_type)
print_secondary_node(pos, api, netw_type)
print_valid_sides(node.name, api, netw_type)
print_connected_nodes(pos, api, netw_type)
end
end
print("#####################")
end