diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index 86f340f..6fe5574 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -192,10 +192,10 @@ function technic.register_battery_box(data) end local run = function(pos, node) - local below = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) - local meta = minetest.get_meta(pos) + local meta = minetest.get_meta(pos) + local network_id = tonumber(meta:get_string(tier.."_network"), 16) - if not technic.is_tier_cable(below.name, tier) then + if not technic.networks[network_id] then meta:set_string("infotext", S("%s Battery Box Has No Network"):format(tier)) return end diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index b0a94d1..139a395 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -69,7 +69,7 @@ local function clear_networks(pos) elseif technic.machines[tier][node.name] then -- Found a machine local eu_type = technic.machines[tier][node.name] - meta:set_string(tier.."_network", minetest.pos_to_string(sw_pos)) + meta:set_string(tier.."_network", string.format("%X", network_id)) if eu_type == technic.producer then table.insert(network.PR_nodes, pos) elseif eu_type == technic.receiver then diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 84d9a43..907a6d1 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -133,7 +133,8 @@ local check_node_subp = function(network, pos, machines, sw_pos, from_below, net --dprint(name.." is a "..machines[name]) local meta = minetest.get_meta(pos) - meta:set_string(network.tier.."_network", minetest.pos_to_string(sw_pos)) + -- Normal tostring() does not have enough precision, neither does meta:set_int() + meta:set_string(network.tier.."_network", string.format("%X", network_id)) if eu_type == technic.producer then add_network_node(network.PR_nodes, pos, network_id)