init.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. -- Unified Skins for Minetest - based modified Bags from unfied_inventory and skins from inventory_plus
  2. -- Copyright (c) 2012 cornernote, Dean Montgomery
  3. -- Rework 2017 by bell07
  4. -- License: GPLv3
  5. -- Boilerplate to support localized strings if intllib mod is installed.
  6. skins = {}
  7. skins.modpath = minetest.get_modpath(minetest.get_current_modname())
  8. skins.default = "character"
  9. dofile(skins.modpath.."/skin_meta_api.lua")
  10. dofile(skins.modpath.."/api.lua")
  11. dofile(skins.modpath.."/skinlist.lua")
  12. -- Unified inventory page/integration
  13. if minetest.get_modpath("unified_inventory") then
  14. dofile(skins.modpath.."/unified_inventory_page.lua")
  15. end
  16. if minetest.get_modpath("sfinv") then
  17. dofile(skins.modpath.."/sfinv_page.lua")
  18. end
  19. -- 3d_armor compatibility
  20. if minetest.global_exists("armor") then
  21. armor.get_player_skin = function(self, name)
  22. local skin = skins.get_player_skin(minetest.get_player_by_name(name))
  23. return skin:get_texture()
  24. end
  25. armor.get_preview = function(self, name)
  26. local skin = skins.get_player_skin(minetest.get_player_by_name(name))
  27. return skin:get_preview()
  28. end
  29. end
  30. -- Update skin on join
  31. minetest.register_on_joinplayer(function(player)
  32. skins.update_player_skin(player)
  33. end)