Limit recalculations.

Setting based - limit area recalculation and allow tuning of the
interval.
This commit is contained in:
Tai Kedzierski
2019-04-01 21:21:31 -07:00
committed by Auke Kok
parent 1bbb997c7a
commit 7b51f84404
2 changed files with 12 additions and 0 deletions

View File

@ -1,8 +1,17 @@
-- This is inspired by the landrush mod by Bremaweb
areas.hud = {}
areas.hud.refresh = 0
minetest.register_globalstep(function(dtime)
areas.hud.refresh = areas.hud.refresh + dtime
if areas.hud.refresh > areas.config["tick"] then
areas.hud.refresh = 0
else
return
end
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local pos = vector.round(player:getpos())