Skip to content

Commit

Permalink
remove laggy switching stations from active index
Browse files Browse the repository at this point in the history
laggy switching stations won't work well in unloaded areas this way
  • Loading branch information
BuckarooBanzay committed Jun 18, 2020
1 parent 7b24a74 commit 4a6d6f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions technic/machines/switching_station_globalstep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a6d6f6

Please sign in to comment.