forked from mtcontrib/factions
Delay for 5 seconds on all hud.
This commit is contained in:
parent
146df88de2
commit
615c9464cc
@ -978,12 +978,12 @@ end
|
|||||||
minetest.register_on_joinplayer(
|
minetest.register_on_joinplayer(
|
||||||
function(player)
|
function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
minetest.after(5,function(player)createHudfactionLand(player)end,player)
|
minetest.after(5,createHudfactionLand,player)
|
||||||
local faction = factions.get_player_faction(name)
|
local faction = factions.get_player_faction(name)
|
||||||
if faction then
|
if faction then
|
||||||
faction.last_logon = os.time()
|
faction.last_logon = os.time()
|
||||||
createHudFactionName(player,faction.name)
|
minetest.after(5,createHudFactionName,player,faction.name)
|
||||||
createHudPower(player,faction)
|
minetest.after(5,createHudPower,player,faction)
|
||||||
faction.offlineplayers[name] = nil
|
faction.offlineplayers[name] = nil
|
||||||
faction.onlineplayers[name] = 1
|
faction.onlineplayers[name] = 1
|
||||||
if faction.no_parcel ~= -1 then
|
if faction.no_parcel ~= -1 then
|
||||||
|
82
hud.lua
82
hud.lua
@ -1,52 +1,58 @@
|
|||||||
hud_ids = {}
|
hud_ids = {}
|
||||||
|
|
||||||
function createHudfactionLand(player)
|
function createHudfactionLand(player)
|
||||||
local name = player:get_player_name()
|
if player then
|
||||||
local id_name = name .. "factionLand"
|
local name = player:get_player_name()
|
||||||
if not hud_ids[id_name] then
|
local id_name = name .. "factionLand"
|
||||||
hud_ids[id_name] = player:hud_add({
|
if not hud_ids[id_name] then
|
||||||
hud_elem_type = "text",
|
hud_ids[id_name] = player:hud_add({
|
||||||
name = "factionLand",
|
hud_elem_type = "text",
|
||||||
number = 0xFFFFFF,
|
name = "factionLand",
|
||||||
position = {x=0.1, y = .98},
|
number = 0xFFFFFF,
|
||||||
text = "Wilderness",
|
position = {x=0.1, y = .98},
|
||||||
scale = {x=1, y=1},
|
text = "Wilderness",
|
||||||
alignment = {x=0, y=0},
|
scale = {x=1, y=1},
|
||||||
})
|
alignment = {x=0, y=0},
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function createHudFactionName(player,factionname)
|
function createHudFactionName(player,factionname)
|
||||||
local name = player:get_player_name()
|
if player and factionname then
|
||||||
local id_name = name .. "factionName"
|
local name = player:get_player_name()
|
||||||
if not hud_ids[id_name] then
|
local id_name = name .. "factionName"
|
||||||
hud_ids[id_name] = player:hud_add({
|
if not hud_ids[id_name] then
|
||||||
hud_elem_type = "text",
|
hud_ids[id_name] = player:hud_add({
|
||||||
name = "factionName",
|
hud_elem_type = "text",
|
||||||
number = 0xFFFFFF,
|
name = "factionName",
|
||||||
position = {x=1, y = 0},
|
number = 0xFFFFFF,
|
||||||
text = "Faction "..factionname,
|
position = {x=1, y = 0},
|
||||||
scale = {x=1, y=1},
|
text = "Faction "..factionname,
|
||||||
alignment = {x=-1, y=0},
|
scale = {x=1, y=1},
|
||||||
offset = {x = -20, y = 20}
|
alignment = {x=-1, y=0},
|
||||||
})
|
offset = {x = -20, y = 20}
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function createHudPower(player,faction)
|
function createHudPower(player,faction)
|
||||||
local name = player:get_player_name()
|
if player and faction then
|
||||||
local id_name = name .. "powerWatch"
|
local name = player:get_player_name()
|
||||||
if not hud_ids[id_name] then
|
local id_name = name .. "powerWatch"
|
||||||
hud_ids[id_name] = player:hud_add({
|
if not hud_ids[id_name] then
|
||||||
hud_elem_type = "text",
|
hud_ids[id_name] = player:hud_add({
|
||||||
name = "powerWatch",
|
hud_elem_type = "text",
|
||||||
number = 0xFFFFFF,
|
name = "powerWatch",
|
||||||
position = {x=0.9, y = .98},
|
number = 0xFFFFFF,
|
||||||
text = "Power "..faction.power.."/".. faction.usedpower .."/"..faction.maxpower,
|
position = {x=0.9, y = .98},
|
||||||
scale = {x=1, y=1},
|
text = "Power "..faction.power.."/".. faction.usedpower .."/"..faction.maxpower,
|
||||||
alignment = {x=-1, y=0},
|
scale = {x=1, y=1},
|
||||||
offset = {x = 0, y = 0}
|
alignment = {x=-1, y=0},
|
||||||
})
|
offset = {x = 0, y = 0}
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user