forked from mtcontrib/factions
Add small delay for hud
This commit is contained in:
parent
a7c9d15282
commit
ae678e83ef
12
factions.lua
12
factions.lua
@ -1003,12 +1003,9 @@ end
|
|||||||
|
|
||||||
minetest.register_on_leaveplayer(
|
minetest.register_on_leaveplayer(
|
||||||
function(player)
|
function(player)
|
||||||
removeHud(player,"factionLand")
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local faction = factions.get_player_faction(name)
|
local faction = factions.get_player_faction(name)
|
||||||
if faction then
|
if faction then
|
||||||
removeHud(player,"factionName")
|
|
||||||
removeHud(player,"powerWatch")
|
|
||||||
faction.offlineplayers[name] = 1
|
faction.offlineplayers[name] = 1
|
||||||
faction.onlineplayers[name] = nil
|
faction.onlineplayers[name] = nil
|
||||||
end
|
end
|
||||||
@ -1060,12 +1057,9 @@ minetest.is_protected = function(pos, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function factionUpdate()
|
function factionUpdate()
|
||||||
minetest.after(factions_config.tick_time,
|
|
||||||
function()
|
|
||||||
factions.faction_tick()
|
factions.faction_tick()
|
||||||
factionUpdate()
|
minetest.after(factions_config.tick_time,factionUpdate)
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
hudUpdateClaimInfo()
|
minetest.after(1,hudUpdateClaimInfo)
|
||||||
factionUpdate()
|
minetest.after(1,factionUpdate)
|
5
hud.lua
5
hud.lua
@ -73,8 +73,6 @@ function removeHud(player,hudname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function hudUpdateClaimInfo()
|
function hudUpdateClaimInfo()
|
||||||
minetest.after(3,
|
|
||||||
function()
|
|
||||||
local playerslist = minetest.get_connected_players()
|
local playerslist = minetest.get_connected_players()
|
||||||
for i in pairs(playerslist) do
|
for i in pairs(playerslist) do
|
||||||
local player = playerslist[i]
|
local player = playerslist[i]
|
||||||
@ -85,6 +83,5 @@ function hudUpdateClaimInfo()
|
|||||||
player:hud_change(hud_ids[id_name],"text",(faction and faction.name) or "Wilderness")
|
player:hud_change(hud_ids[id_name],"text",(faction and faction.name) or "Wilderness")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
hudUpdateClaimInfo()
|
minetest.after(3,hudUpdateClaimInfo)
|
||||||
end)
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user