diff options
author | rubenwardy <rubenwardy@gmail.com> | 2016-08-01 22:39:32 +0100 |
---|---|---|
committer | rubenwardy <rubenwardy@gmail.com> | 2016-08-01 22:39:32 +0100 |
commit | 9308b951635486fdcbca3474e5f5e179be4748b1 (patch) | |
tree | 6627bb92e973d40824a9938e645e8b33932c4ef4 /sfinv.lua | |
parent | f6515c12b8f042a27763d7542656ad3be1cffb9a (diff) |
Add sfinv support
Diffstat (limited to 'sfinv.lua')
-rw-r--r-- | sfinv.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sfinv.lua b/sfinv.lua new file mode 100644 index 0000000..b2f96c2 --- /dev/null +++ b/sfinv.lua @@ -0,0 +1,23 @@ +if minetest.get_modpath("sfinv") then + sfinv.register_page("awards:awards", { + title = "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, context) + end + end + end + }) +end |