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)
|
function(player)
|
||||||
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)
|
||||||
|
local id_name1 = name .. "factionLand"
|
||||||
|
if hud_ids[id_name1] then
|
||||||
|
hud_ids[id_name1] = nil
|
||||||
|
end
|
||||||
if faction then
|
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.offlineplayers[name] = 1
|
||||||
faction.onlineplayers[name] = nil
|
faction.onlineplayers[name] = nil
|
||||||
end
|
end
|
||||||
|
21
hud.lua
21
hud.lua
@ -2,15 +2,18 @@ hud_ids = {}
|
|||||||
|
|
||||||
function createHudfactionLand(player)
|
function createHudfactionLand(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
hud_ids[name .. "factionLand"] = player:hud_add({
|
local id_name = name .. "factionLand"
|
||||||
hud_elem_type = "text",
|
if not hud_ids[id_name] then
|
||||||
name = "factionLand",
|
hud_ids[id_name] = player:hud_add({
|
||||||
number = 0xFFFFFF,
|
hud_elem_type = "text",
|
||||||
position = {x=0.1, y = .98},
|
name = "factionLand",
|
||||||
text = "Wilderness",
|
number = 0xFFFFFF,
|
||||||
scale = {x=1, y=1},
|
position = {x=0.1, y = .98},
|
||||||
alignment = {x=0, y=0},
|
text = "Wilderness",
|
||||||
})
|
scale = {x=1, y=1},
|
||||||
|
alignment = {x=0, y=0},
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function createHudFactionName(player,factionname)
|
function createHudFactionName(player,factionname)
|
||||||
|
Loading…
Reference in New Issue
Block a user