1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2024-12-28 11:40:36 +01:00

Fix missing preview image when using simple_skins mod

This commit is contained in:
stujones11 2015-03-08 15:21:37 +00:00
parent 70d353bb6c
commit 87af6e0c68

View File

@ -124,7 +124,7 @@ armor.set_player_armor = function(self, player)
local textures = {} local textures = {}
local physics_o = {speed=1,gravity=1,jump=1} local physics_o = {speed=1,gravity=1,jump=1}
local material = {type=nil, count=1} local material = {type=nil, count=1}
local preview = armor:get_player_skin(name).."_preview.png" local preview = armor:get_preview(name) or "character_preview.png"
for _,v in ipairs(self.elements) do for _,v in ipairs(self.elements) do
elements[v] = false elements[v] = false
end end
@ -257,7 +257,7 @@ end
armor.get_player_skin = function(self, name) armor.get_player_skin = function(self, name)
local skin = nil local skin = nil
if skin_mod == "skins" then if skin_mod == "skins" or skin_mod == "simple_skins" then
skin = skins.skins[name] skin = skins.skins[name]
elseif skin_mod == "u_skins" then elseif skin_mod == "u_skins" then
skin = u_skins.u_skins[name] skin = u_skins.u_skins[name]
@ -265,6 +265,12 @@ armor.get_player_skin = function(self, name)
return skin or armor.default_skin return skin or armor.default_skin
end end
armor.get_preview = function(self, name)
if skin_mod == "skins" or skin_mod == "u_skins" then
return armor:get_player_skin(name).."_preview.png"
end
end
armor.get_armor_formspec = function(self, name) armor.get_armor_formspec = function(self, name)
if not name then if not name then
minetest.log("error", "3d_armor: Player name is nil [get_armor_formspec]") minetest.log("error", "3d_armor: Player name is nil [get_armor_formspec]")
@ -424,7 +430,7 @@ minetest.register_on_joinplayer(function(player)
armor.textures[name].skin = skin..".png" armor.textures[name].skin = skin..".png"
end end
elseif minetest.get_modpath("simple_skins") then elseif minetest.get_modpath("simple_skins") then
skin_mod = "skins" 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"