From 4a6d6f664410157458bb4038730cb42e413a838b Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Thu, 18 Jun 2020 10:56:16 +0200 Subject: [PATCH] remove laggy switching stations from active index laggy switching stations won't work well in unloaded areas this way --- technic/machines/switching_station_globalstep.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/technic/machines/switching_station_globalstep.lua b/technic/machines/switching_station_globalstep.lua index cfb57e4..8c72520 100644 --- a/technic/machines/switching_station_globalstep.lua +++ b/technic/machines/switching_station_globalstep.lua @@ -115,9 +115,15 @@ minetest.register_globalstep(function(dtime) end if switch.skip > 0 then + -- calculate efficiency in percent and display it local efficiency = math.floor(1/switch.skip*100) meta:set_string("infotext", "Polyfuse triggered, current efficiency: " .. efficiency .. "% generated lag : " .. math.floor(switch_diff/1000) .. " ms") + + -- remove laggy switching station from active index + -- it will be reactivated when a player is near it + -- laggy switching stations won't work well in unloaded areas this way + switches[hash] = nil end else