improved skinsdb compatibility and fix on skins

This commit is contained in:
Alexsandro Percy 2022-04-09 12:29:47 -03:00
parent 07e2cf36fa
commit 9899cdd2d9
3 changed files with 18 additions and 21 deletions

View File

@ -30,15 +30,15 @@ function airutils.set_player_skin(player, skin)
texture = texture[1] texture = texture[1]
if skinsdb_mod_path then if skinsdb_mod_path then
local skdb_skin = skins.get_player_skin(player) local skdb_skin = skins.get_player_skin(player)
texture = "[combine:64x32:0,0="..skdb_skin._texture..":0,0="..skin.."]" texture = "[combine:64x32:0,0="..skdb_skin._texture --..":0,0="..skin
else end
--backup current texture --backup current texture
if player:get_attribute(backup) == nil or player:get_attribute(backup) == "" then if player:get_attribute(backup) == nil or player:get_attribute(backup) == "" then
player:set_attribute(backup, texture) --texture backup player:set_attribute(backup, texture) --texture backup
else else
texture = player:get_attribute(backup) texture = player:get_attribute(backup)
end end
end
--combine the texture --combine the texture
texture = texture.."^"..skin texture = texture.."^"..skin
@ -53,9 +53,9 @@ function airutils.set_player_skin(player, skin)
textures = {texture}, textures = {texture},
}) })
else else
set_player_textures(player, { texture }) set_player_textures(player, {texture})
player:set_attribute(curr_skin, texture)
end end
player:set_attribute(curr_skin, texture)
end end
else else
--remove texture --remove texture
@ -124,9 +124,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end) end)
if not skinsdb_mod_path then -- If not managed by skinsdb minetest.register_on_joinplayer(function(player)
minetest.register_on_joinplayer(function(player)
local skin = player:get_attribute(curr_skin) local skin = player:get_attribute(curr_skin)
if skin and skin ~= "" and skin ~= nil then if skin and skin ~= "" and skin ~= nil then
@ -136,5 +134,4 @@ if not skinsdb_mod_path then -- If not managed by skinsdb
airutils.set_player_skin(player1, skin1) airutils.set_player_skin(player1, skin1)
end, player, skin) end, player, skin)
end end
end) end)
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB