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 -- This is inspired by the landrush mod by Bremaweb
areas.hud = {} areas.hud = {}
areas.hud.refresh = 0
minetest.register_globalstep(function(dtime) 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 for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local pos = vector.round(player:getpos()) local pos = vector.round(player:getpos())

View File

@ -40,3 +40,6 @@ setting("number", "self_protection_max_areas_high", 32)
-- legacy_table (owner_defs) compatibility. Untested and has known issues. -- legacy_table (owner_defs) compatibility. Untested and has known issues.
setting("boolean", "legacy_table", false) setting("boolean", "legacy_table", false)
-- configure the refresh delay for the name displays in the HUD
setting("number", "tick", 0.5)