1
0
mirror of https://gitlab.com/rubenwardy/awards.git synced 2024-11-10 20:50:18 +01:00
awards/sfinv.lua

32 lines
875 B
Lua
Raw Normal View History

2016-08-01 23:39:32 +02:00
if minetest.get_modpath("sfinv") then
local S
if (intllib) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
2016-08-01 23:39:32 +02:00
sfinv.register_page("awards:awards", {
title = S("Awards"),
2016-08-01 23:39:32 +02:00
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, context)
end
end
end
})
end