Add achievements button

This commit is contained in:
Wuzzy 2017-03-04 01:57:10 +01:00
parent e840fcbe5e
commit 193193ec2b
5 changed files with 16 additions and 1 deletions

View file

@ -211,7 +211,10 @@ crafting.set_creative_formspec = function(player, start_i, pagenum, show, page,
if name == "inv" then if name == "inv" then
-- Survival inventory slots -- Survival inventory slots
main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]".. main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]"..
"list[current_player;main;0,3.75;9,3;9]" "list[current_player;main;0,3.75;9,3;9]"..
-- achievements button
"image_button[9,2;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
"tooltip[__mcl_achievements;Achievements]"
else else
inv_bg = inv_bg .. "^crafting_inventory_creative_scroll.png" inv_bg = inv_bg .. "^crafting_inventory_creative_scroll.png"
-- Creative inventory slots -- Creative inventory slots

View file

@ -81,6 +81,9 @@ local function set_inventory(player)
-- crafting guide button -- crafting guide button
"image_button[8,0;1,1;craftguide_book.png;__mcl_craftguide;]".. "image_button[8,0;1,1;craftguide_book.png;__mcl_craftguide;]"..
"tooltip[__mcl_craftguide;Show crafting recipes]".. "tooltip[__mcl_craftguide;Show crafting recipes]"..
-- achievements button
"image_button[8,1;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
"tooltip[__mcl_achievements;Achievements]"..
-- for shortcuts -- for shortcuts
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_player;craft]".. "listring[current_player;craft]"..

View file

@ -0,0 +1 @@
License of this mod (including textures and other data): WTFPL

View file

@ -200,3 +200,11 @@ awards.register_achievement("mcl:f_placeRails", {
} }
}) })
-- Show achievements formspec when the button was pressed
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.__mcl_achievements then
local name = player:get_player_name()
awards.show_to(name, name, nil, false)
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B