mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-18 00:51:06 +01:00
25 lines
784 B
Lua
25 lines
784 B
Lua
if minetest.get_modpath("sfinv") then
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
sfinv.register_page("awards:awards", {
|
|
title = S("Awards"),
|
|
on_enter = function(self, player, context)
|
|
context.awards_idx = 1
|
|
end,
|
|
get = function(self, player, context)
|
|
local name = player:get_player_name()
|
|
return sfinv.make_formspec(player, context,
|
|
awards.getFormspec(name, name, context.awards_idx or 1),
|
|
false, "size[11,5]")
|
|
end,
|
|
on_player_receive_fields = function(self, player, context, fields)
|
|
if fields.awards then
|
|
local event = minetest.explode_textlist_event(fields.awards)
|
|
if event.type == "CHG" then
|
|
context.awards_idx = event.index
|
|
sfinv.set_player_inventory_formspec(player, context)
|
|
end
|
|
end
|
|
end
|
|
})
|
|
end
|