remove laggy switching stations from active index

laggy switching stations won't work well in unloaded areas this way
This commit is contained in:
BuckarooBanzay
2020-06-18 10:56:16 +02:00
parent 7b24a74e41
commit 4a6d6f6644

View File

@ -115,9 +115,15 @@ minetest.register_globalstep(function(dtime)
end end
if switch.skip > 0 then if switch.skip > 0 then
-- calculate efficiency in percent and display it
local efficiency = math.floor(1/switch.skip*100) local efficiency = math.floor(1/switch.skip*100)
meta:set_string("infotext", "Polyfuse triggered, current efficiency: " .. meta:set_string("infotext", "Polyfuse triggered, current efficiency: " ..
efficiency .. "% generated lag : " .. math.floor(switch_diff/1000) .. " ms") 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 end
else else