From ae678e83ef0d58f153d891dda67c62f31df8e881 Mon Sep 17 00:00:00 2001 From: Coder12a <38924418+Coder12a@users.noreply.github.com> Date: Sat, 27 Oct 2018 15:40:17 -0500 Subject: [PATCH] Add small delay for hud --- factions.lua | 14 ++++---------- hud.lua | 23 ++++++++++------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/factions.lua b/factions.lua index 97ed9f8..117906a 100644 --- a/factions.lua +++ b/factions.lua @@ -1003,12 +1003,9 @@ end minetest.register_on_leaveplayer( function(player) - removeHud(player,"factionLand") local name = player:get_player_name() local faction = factions.get_player_faction(name) if faction then - removeHud(player,"factionName") - removeHud(player,"powerWatch") faction.offlineplayers[name] = 1 faction.onlineplayers[name] = nil end @@ -1060,12 +1057,9 @@ minetest.is_protected = function(pos, player) end function factionUpdate() - minetest.after(factions_config.tick_time, - function() - factions.faction_tick() - factionUpdate() - end) + factions.faction_tick() + minetest.after(factions_config.tick_time,factionUpdate) end -hudUpdateClaimInfo() -factionUpdate() \ No newline at end of file +minetest.after(1,hudUpdateClaimInfo) +minetest.after(1,factionUpdate) \ No newline at end of file diff --git a/hud.lua b/hud.lua index 8e577fa..a4815c5 100644 --- a/hud.lua +++ b/hud.lua @@ -73,18 +73,15 @@ function removeHud(player,hudname) end function hudUpdateClaimInfo() - minetest.after(3, - function() - local playerslist = minetest.get_connected_players() - for i in pairs(playerslist) do - local player = playerslist[i] - local name = player:get_player_name() - local faction = factions.get_faction_at(player:getpos()) - local id_name = name .. "factionLand" - if hud_ids[id_name] then - player:hud_change(hud_ids[id_name],"text",(faction and faction.name) or "Wilderness") - end + local playerslist = minetest.get_connected_players() + for i in pairs(playerslist) do + local player = playerslist[i] + local name = player:get_player_name() + local faction = factions.get_faction_at(player:getpos()) + local id_name = name .. "factionLand" + if hud_ids[id_name] then + player:hud_change(hud_ids[id_name],"text",(faction and faction.name) or "Wilderness") end - hudUpdateClaimInfo() - end) + end + minetest.after(3,hudUpdateClaimInfo) end \ No newline at end of file