Profile: add 'X' button to close the formspec
This commit is contained in:
parent
77a8e8a008
commit
2297df19c8
@ -5,6 +5,7 @@ local function get_formspec() end
|
||||
|
||||
|
||||
function block_league.show_profile(p_name)
|
||||
minetest.get_player_by_name(p_name):get_meta():set_string("bl_profile_elem_active", "")
|
||||
minetest.show_formspec(p_name, "block_league:profile", get_formspec(p_name))
|
||||
end
|
||||
|
||||
@ -187,6 +188,7 @@ function get_formspec(p_name)
|
||||
|
||||
-- parte destra
|
||||
"container[13.88,0]",
|
||||
"image_button[5.2,0;0.8,0.8;bl_gui_profile_close.png;close;;true;false;]",
|
||||
right_elem,
|
||||
"container_end[]"
|
||||
}
|
||||
@ -205,12 +207,14 @@ end
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "block_league:profile" then return end
|
||||
|
||||
if fields.quit then
|
||||
player:get_meta():set_string("bl_profile_elem_active", "")
|
||||
return end
|
||||
if fields.quit then return end
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
if fields.close then
|
||||
minetest.close_formspec(p_name, "block_league:profile")
|
||||
return end
|
||||
|
||||
if fields.weap then
|
||||
player:get_meta():set_string("bl_profile_elem_active", string.sub(block_league.get_player_weapons(p_name)[tonumber(fields.weap)], 14, -1))
|
||||
elseif fields.skill then
|
||||
|
BIN
block_league/textures/bl_gui_profile_close.png
Normal file
BIN
block_league/textures/bl_gui_profile_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 B |
Loading…
x
Reference in New Issue
Block a user