Better skin mod support and more preview bug fixes

This commit is contained in:
stujones11 2015-03-08 18:29:17 +00:00
parent 87af6e0c68
commit 58337c0404

View File

@ -82,6 +82,14 @@ elseif minetest.get_modpath("unified_inventory") then
}) })
end end
if minetest.get_modpath("skins") then
skin_mod = "skins"
elseif minetest.get_modpath("simple_skins") then
skin_mod = "simple_skins"
elseif minetest.get_modpath("u_skins") then
skin_mod = "u_skins"
end
armor.def = { armor.def = {
state = 0, state = 0,
count = 0, count = 0,
@ -266,7 +274,7 @@ armor.get_player_skin = function(self, name)
end end
armor.get_preview = function(self, name) armor.get_preview = function(self, name)
if skin_mod == "skins" or skin_mod == "u_skins" then if skin_mod == "skins" then
return armor:get_player_skin(name).."_preview.png" return armor:get_player_skin(name).."_preview.png"
end end
end end
@ -423,20 +431,17 @@ minetest.register_on_joinplayer(function(player)
wielditem = "3d_armor_trans.png", wielditem = "3d_armor_trans.png",
preview = armor.default_skin.."_preview.png", preview = armor.default_skin.."_preview.png",
} }
if minetest.get_modpath("skins") then if skin_mod == "skins" then
skin_mod = "skins"
local skin = skins.skins[name] local skin = skins.skins[name]
if skin and skins.get_type(skin) == skins.type.MODEL then if skin and skins.get_type(skin) == skins.type.MODEL then
armor.textures[name].skin = skin..".png" armor.textures[name].skin = skin..".png"
end end
elseif minetest.get_modpath("simple_skins") then elseif skin_mod == "simple_skins" then
skin_mod = "simple_skins"
local skin = skins.skins[name] local skin = skins.skins[name]
if skin then if skin then
armor.textures[name].skin = skin..".png" armor.textures[name].skin = skin..".png"
end end
elseif minetest.get_modpath("u_skins") then elseif skin_mod == "u_skins" then
skin_mod = "u_skins"
local skin = u_skins.u_skins[name] local skin = u_skins.u_skins[name]
if skin and u_skins.get_type(skin) == u_skins.type.MODEL then if skin and u_skins.get_type(skin) == u_skins.type.MODEL then
armor.textures[name].skin = skin..".png" armor.textures[name].skin = skin..".png"