Merge pull request #25 from indriApollo/master

Add support for wardrobe mod
This commit is contained in:
stujones11 2015-04-25 15:53:35 +01:00
commit 1d1534b416

View File

@ -88,6 +88,8 @@ elseif minetest.get_modpath("simple_skins") then
skin_mod = "simple_skins" skin_mod = "simple_skins"
elseif minetest.get_modpath("u_skins") then elseif minetest.get_modpath("u_skins") then
skin_mod = "u_skins" skin_mod = "u_skins"
elseif minetest.get_modpath("wardrobe") then
skin_mod = "wardrobe"
end end
armor.def = { armor.def = {
@ -246,6 +248,8 @@ armor.get_player_skin = function(self, name)
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]
elseif skin_mod == "wardrobe" then
skin = string.gsub(wardrobe.playerSkins[name], '\.png$','')
end end
return skin or armor.default_skin return skin or armor.default_skin
end end
@ -342,6 +346,7 @@ default.player_register_model("3d_armor_character.b3d", {
-- Register Callbacks -- Register Callbacks
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = armor:get_valid_player(player, "[on_player_receive_fields]") local name = armor:get_valid_player(player, "[on_player_receive_fields]")
if not name then if not name then
return return
@ -444,6 +449,11 @@ minetest.register_on_joinplayer(function(player)
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"
end end
elseif skin_mod == "wardrobe" then
local skin = wardrobe.playerSkins[name]
if skin then
armor.textures[name].skin = skin
end
end end
if minetest.get_modpath("player_textures") then if minetest.get_modpath("player_textures") then
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name local filename = minetest.get_modpath("player_textures").."/textures/player_"..name