1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

Merge branch 'master' into 'master'

bugfix wardrobe save/restore skins for skinsdb

See merge request VanessaE/homedecor_modpack!2
This commit is contained in:
Vanessa Dannenberg 2018-12-16 20:42:15 +00:00
commit ac71c0f189

View File

@ -45,17 +45,16 @@ function homedecor.get_player_skin(player)
end end
function homedecor.set_player_skin(player, skin, save) function homedecor.set_player_skin(player, skin, save)
skin = skin or default_skin
if skinsdb_mod_path then if skinsdb_mod_path then
skins.set_player_skin(player, skin) skins.set_player_skin(player, skin or skins.default)
elseif armor_mod_path then -- if 3D_armor's installed, let it set the skin elseif armor_mod_path then -- if 3D_armor's installed, let it set the skin
armor.textures[player:get_player_name()].skin = skin armor.textures[player:get_player_name()].skin = skin or default_skin
armor:update_player_visuals(player) armor:update_player_visuals(player)
else else
set_player_textures(player, { skin }) set_player_textures(player, { skin or default_skin})
end end
if save then if save and not skinsdb_mod_path then
if skin == default_skin then if skin == default_skin then
skin = "default" skin = "default"
player:set_attribute("homedecor:player_skin", "") player:set_attribute("homedecor:player_skin", "")
@ -133,7 +132,8 @@ homedecor.register("wardrobe", {
minetest.register_alias("homedecor:wardrobe_bottom", "homedecor:wardrobe") minetest.register_alias("homedecor:wardrobe_bottom", "homedecor:wardrobe")
minetest.register_alias("homedecor:wardrobe_top", "air") minetest.register_alias("homedecor:wardrobe_top", "air")
minetest.register_on_joinplayer(function(player) if not skinsdb_mod_path then -- If not managed by skinsdb
minetest.register_on_joinplayer(function(player)
local skin = player:get_attribute("homedecor:player_skin") local skin = player:get_attribute("homedecor:player_skin")
if skin and skin ~= "" then if skin and skin ~= "" then
@ -142,4 +142,5 @@ minetest.register_on_joinplayer(function(player)
homedecor.set_player_skin(player, skin) homedecor.set_player_skin(player, skin)
end, player, skin) end, player, skin)
end end
end) end)
end