Improve pumkin hud a bit
This commit is contained in:
parent
91ae3208bd
commit
ec542a142a
|
@ -124,8 +124,7 @@ pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png
|
||||||
if minetest.get_modpath("mcl_armor") then
|
if minetest.get_modpath("mcl_armor") then
|
||||||
local pumpkin_hud = {}
|
local pumpkin_hud = {}
|
||||||
local function add_pumpkin_hud(player)
|
local function add_pumpkin_hud(player)
|
||||||
local name = player:get_player_name()
|
pumpkin_hud[player] = {
|
||||||
pumpkin_hud[name] = {
|
|
||||||
pumpkin_blur = player:hud_add({
|
pumpkin_blur = player:hud_add({
|
||||||
hud_elem_type = "image",
|
hud_elem_type = "image",
|
||||||
position = {x = 0.5, y = 0.5},
|
position = {x = 0.5, y = 0.5},
|
||||||
|
@ -145,11 +144,10 @@ if minetest.get_modpath("mcl_armor") then
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
local function remove_pumpkin_hud(player)
|
local function remove_pumpkin_hud(player)
|
||||||
local name = player:get_player_name()
|
if pumpkin_hud[player] then
|
||||||
if pumpkin_hud[name] then
|
player:hud_remove(pumpkin_hud[player].pumpkin_blur)
|
||||||
player:hud_remove(pumpkin_hud[name].pumpkin_blur)
|
player:hud_remove(pumpkin_hud[player].fake_crosshair)
|
||||||
player:hud_remove(pumpkin_hud[name].fake_crosshair)
|
pumpkin_hud[player] = nil
|
||||||
pumpkin_hud[name] = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,7 +164,7 @@ if minetest.get_modpath("mcl_armor") then
|
||||||
remove_pumpkin_hud(player)
|
remove_pumpkin_hud(player)
|
||||||
end)
|
end)
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
remove_pumpkin_hud(player)
|
pumpkin_hud[player] = nil
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user