sfinv_page.lua 714 B

12345678910111213141516171819202122
  1. local S = minetest.get_translator("skinsdb")
  2. -- generate the current formspec
  3. local function get_formspec(player, context)
  4. local skin = skins.get_player_skin(player)
  5. local formspec = skins.get_skin_info_formspec(skin)
  6. formspec = formspec..skins.get_skin_selection_formspec(player, context, 4)
  7. return formspec
  8. end
  9. sfinv.register_page("skins:overview", {
  10. title = S("Skins"),
  11. get = function(self, player, context)
  12. -- collect skins data
  13. return sfinv.make_formspec(player, context, get_formspec(player, context))
  14. end,
  15. on_player_receive_fields = function(self, player, context, fields)
  16. skins.on_skin_selection_receive_fields(player, context, fields)
  17. sfinv.set_player_inventory_formspec(player)
  18. end
  19. })