Batteries: Workaround to fix discharge (#609)
The network traversal code does still not handle connecting sides, but at least finite power is no more.
This commit is contained in:
parent
d4609f23f2
commit
6a9dfec36f
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user