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

return the png suffix in get_player_skin for complete texture definition to support more complex textures

Note the armor.get_player_skin() could be redefined in other mods to privide the more complex textures
This commit is contained in:
Alexander Weber 2017-06-18 22:13:48 +02:00 committed by stujones11
parent 9577fb773e
commit 2150fcea8d
2 changed files with 9 additions and 10 deletions

View File

@ -376,18 +376,17 @@ armor.damage = function(self, player, index, stack, use)
end
armor.get_player_skin = function(self, name)
local skin = nil
if self.skin_mod == "skins" or self.skin_mod == "simple_skins" then
skin = skins.skins[name]
elseif self.skin_mod == "u_skins" then
skin = u_skins.u_skins[name]
if self.skin_mod == "skins" or self.skin_mod == "simple_skins" and skins.skins[name] then
return skins.skins[name]..".png"
elseif self.skin_mod == "u_skins" and u_skins.u_skins[name] then
return u_skins.u_skins[name]..".png"
elseif self.skin_mod == "wardrobe" then
local skins = wardrobe.playerSkins or {}
if skins[name] then
skin = string.gsub(skins[name], "%.png$","")
return skins[name]
end
end
return skin or armor.default_skin
return armor.default_skin..".png"
end
armor.add_preview = function(self, preview)
@ -395,7 +394,7 @@ armor.add_preview = function(self, preview)
end
armor.get_preview = function(self, name)
local preview = armor:get_player_skin(name).."_preview.png"
local preview = string.gsub(armor:get_player_skin(name), ".png", "_preview.png")
if skin_previews[preview] then
return preview
end

View File

@ -177,7 +177,7 @@ local function init_player_armor(player)
end
local skin = armor:get_player_skin(name)
armor.textures[name] = {
skin = skin..".png",
skin = skin,
armor = "3d_armor_trans.png",
wielditem = "3d_armor_trans.png",
preview = armor.default_skin.."_preview.png",
@ -224,7 +224,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if string.find(field, "skins_set") then
minetest.after(0, function(player)
local skin = armor:get_player_skin(name)
armor.textures[name].skin = skin..".png"
armor.textures[name].skin = skin
armor:set_player_armor(player)
end, player)
end