1
0
Fork 0

Fix broken skin init

This commit is contained in:
Wuzzy 2019-03-06 07:49:14 +01:00
parent cfac33a94f
commit 05e3a616b4
1 changed files with 8 additions and 9 deletions

View File

@ -137,19 +137,18 @@ minetest.register_on_joinplayer(function(player)
local skin_id = player:get_meta():get_string("mcl_skins:skin_id") local skin_id = player:get_meta():get_string("mcl_skins:skin_id")
local set_skin local set_skin
-- do we already have a skin in player attributes? -- do we already have a skin in player attributes?
if skin_id then if skin_id ~= nil and skin_id ~= "" then
set_skin = tonumber(skin_id) set_skin = tonumber(skin_id)
-- otherwise use random skin if not set -- otherwise use random skin if not set
else end
if not set_skin then
set_skin = math.random(0, mcl_skins.skin_count) set_skin = math.random(0, mcl_skins.skin_count)
end end
if set_skin then local ok = mcl_skins.set_player_skin(player, set_skin)
local ok = mcl_skins.set_player_skin(player, set_skin) if not ok then
if not ok then set_skin = math.random(0, mcl_skins.skin_count)
set_skin = math.random(0, mcl_skins.skin_count) minetest.log("warning", "[mcl_skins] Player skin for "..name.." not found, falling back to skin #"..set_skin)
minetest.log("warning", "[mcl_skins] Player skin for "..name.." not found, falling back to skin #"..set_skin) mcl_skins.set_player_skin(player, set_skin)
mcl_skins.set_player_skin(player, set_skin)
end
end end
end) end)