forked from mtcontrib/factions
Add small delay for hud
This commit is contained in:
parent
a7c9d15282
commit
ae678e83ef
14
factions.lua
14
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()
|
||||
minetest.after(1,hudUpdateClaimInfo)
|
||||
minetest.after(1,factionUpdate)
|
23
hud.lua
23
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
|
Loading…
Reference in New Issue
Block a user