forked from mtcontrib/factions
Hud update.
This commit is contained in:
parent
ae678e83ef
commit
ee23ba96f8
12
factions.lua
12
factions.lua
|
@ -1005,7 +1005,19 @@ minetest.register_on_leaveplayer(
|
|||
function(player)
|
||||
local name = player:get_player_name()
|
||||
local faction = factions.get_player_faction(name)
|
||||
local id_name1 = name .. "factionLand"
|
||||
if hud_ids[id_name1] then
|
||||
hud_ids[id_name1] = nil
|
||||
end
|
||||
if faction then
|
||||
local id_name2 = name .. "factionName"
|
||||
local id_name3 = name .. "powerWatch"
|
||||
if hud_ids[id_name2] then
|
||||
hud_ids[id_name2] = nil
|
||||
end
|
||||
if hud_ids[id_name3] then
|
||||
hud_ids[id_name3] = nil
|
||||
end
|
||||
faction.offlineplayers[name] = 1
|
||||
faction.onlineplayers[name] = nil
|
||||
end
|
||||
|
|
21
hud.lua
21
hud.lua
|
@ -2,15 +2,18 @@ hud_ids = {}
|
|||
|
||||
function createHudfactionLand(player)
|
||||
local name = player:get_player_name()
|
||||
hud_ids[name .. "factionLand"] = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "factionLand",
|
||||
number = 0xFFFFFF,
|
||||
position = {x=0.1, y = .98},
|
||||
text = "Wilderness",
|
||||
scale = {x=1, y=1},
|
||||
alignment = {x=0, y=0},
|
||||
})
|
||||
local id_name = name .. "factionLand"
|
||||
if not hud_ids[id_name] then
|
||||
hud_ids[id_name] = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "factionLand",
|
||||
number = 0xFFFFFF,
|
||||
position = {x=0.1, y = .98},
|
||||
text = "Wilderness",
|
||||
scale = {x=1, y=1},
|
||||
alignment = {x=0, y=0},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function createHudFactionName(player,factionname)
|
||||
|
|
Loading…
Reference in New Issue
Block a user