init.lua 565 B

12345678910111213141516171819202122
  1. -- support for i18n
  2. local S = armor_i18n.gettext
  3. if not minetest.global_exists("sfinv") then
  4. minetest.log("warning", S("3d_armor_sfinv: Mod loaded but unused."))
  5. return
  6. end
  7. sfinv.register_page("3d_armor:armor", {
  8. title = S("Armor"),
  9. get = function(self, player, context)
  10. local name = player:get_player_name()
  11. local formspec = armor:get_armor_formspec(name, true)
  12. return sfinv.make_formspec(player, context, formspec, false)
  13. end
  14. })
  15. armor:register_on_update(function(player)
  16. if sfinv.enabled then
  17. sfinv.set_player_inventory_formspec(player)
  18. end
  19. end)