mirror of
https://github.com/minetest-mods/technic.git
synced 2025-07-02 08:10:36 +02:00
Fixes for network calculation issues
This fixes several issues: * More than one switching station could become active on large networks - Switching stations now semi-permanently become disabled if another is present - Power monitors have been added to replace the function of "slave" switching stations, to discourage overuse of switching stations * Networks did not reliably "split" when cutting a cable - I "may" have caused this issue, but I believe it is solved by this * Machines did not run without a player near the switching station - Active switching stations now forceload themselves, and free the forceloaded block if disabled, dug, or disconnected - Machines are only loaded to run them (as before), so only one mapblock (or two if the bottom edge of the switching station is a mapblock boundary) is loaded - Cables are still only loaded during a full network recalculation
This commit is contained in:
@ -20,8 +20,13 @@ local function clear_networks(pos)
|
||||
{x=pos.x, y=pos.y, z=pos.z+1},
|
||||
{x=pos.x, y=pos.y, z=pos.z-1}}
|
||||
for _,connected_pos in pairs(positions) do
|
||||
if technic.cables[minetest.hash_node_position(connected_pos)] then
|
||||
technic.networks[technic.cables[minetest.hash_node_position(connected_pos)]] = nil
|
||||
local net = technic.cables[minetest.hash_node_position(connected_pos)]
|
||||
if net and technic.networks[net] then
|
||||
for _,v in pairs(technic.networks[net].all_nodes) do
|
||||
local pos1 = minetest.hash_node_position(v)
|
||||
technic.cables[pos1] = nil
|
||||
end
|
||||
technic.networks[net] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user