From cea42b18a0f5ff94bbcef1132e90bdc2eb4e2479 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Mon, 1 Apr 2019 09:07:06 +0200 Subject: [PATCH] add technic.switch_max_range setting --- technic/machines/switching_station.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index ff4665e..3ee0527 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -4,6 +4,8 @@ technic.networks = {} technic.cables = {} technic.redundant_warn = {} +local switch_max_range = tonumber(minetest.settings:get("technic.switch_max_range") or "64") + local has_monitoring = minetest.get_modpath("monitoring") local metric_abm_count local metric_abm_latency @@ -130,6 +132,13 @@ end -- Generic function to add found connected nodes to the right classification array local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below, network_id, queue) + + local distance_to_switch = vector.distance(pos, sw_pos) + if distance_to_switch > switch_max_range then + -- max range exceeded + return + end + technic.get_or_load_node(pos) local meta = minetest.get_meta(pos) local name = minetest.get_node(pos).name