1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

[areas] Reduce HUD tick rate to 1s

This commit is contained in:
Wouters Dorian 2015-07-31 15:12:46 +02:00
parent ca056b9920
commit f112012747

View File

@ -2,7 +2,8 @@
areas.hud = {} areas.hud = {}
minetest.register_globalstep(function(dtime) local function tick()
minetest.after(1, tick)
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())
@ -38,7 +39,9 @@ minetest.register_globalstep(function(dtime)
hud.oldAreas = areaString hud.oldAreas = areaString
end end
end end
end) end
tick()
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
areas.hud[player:get_player_name()] = nil areas.hud[player:get_player_name()] = nil