Wardrobe's skins : add support for 3d_armor

This commit is contained in:
kilbith 2015-05-03 18:43:18 +02:00
parent 2f9efc2807
commit 9f66f0fc33

View File

@ -60,12 +60,24 @@ homedecor.register("wardrobe", {
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local skins = {"male1", "male2", "male3", "male4", "male5"} local skins = {"male1", "male2", "male3", "male4", "male5"}
local playerName = sender:get_player_name()
local armor_mod = minetest.get_modpath("3d_armor")
for i = 1,5 do for i = 1,5 do
if fields[skins[i]] then if fields[skins[i]] then
if armor_mod then -- if 3D_armor's installed, let it set the skin
armor.textures[playerName].skin = skins[i]..".png"
armor:update_player_visuals(sender)
break
end
default.player_set_textures(sender, { skins[i]..".png" }) default.player_set_textures(sender, { skins[i]..".png" })
break break
elseif fields["fe"..skins[i]] then elseif fields["fe"..skins[i]] then
if armor_mod then
armor.textures[playerName].skin = "fe"..skins[i]..".png"
armor:update_player_visuals(sender)
break
end
default.player_set_textures(sender, { skin = "fe"..skins[i]..".png" }) default.player_set_textures(sender, { skin = "fe"..skins[i]..".png" })
break break
end end