mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
improved skindb compatibility
This commit is contained in:
parent
b639722326
commit
07e2cf36fa
1 changed files with 14 additions and 9 deletions
|
@ -26,20 +26,24 @@ function airutils.set_player_skin(player, skin)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if texture then
|
if texture then
|
||||||
if skin then
|
if skin then
|
||||||
|
--get current texture
|
||||||
texture = texture[1]
|
texture = texture[1]
|
||||||
if skinsdb_mod_path then
|
if skinsdb_mod_path then
|
||||||
texture = "character.png"
|
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 = texture.."^"..skdb_skin._texture
|
else
|
||||||
|
--backup current texture
|
||||||
|
if player:get_attribute(backup) == nil or player:get_attribute(backup) == "" then
|
||||||
|
player:set_attribute(backup, texture) --texture backup
|
||||||
|
else
|
||||||
|
texture = player:get_attribute(backup)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if player:get_attribute(backup) == nil or player:get_attribute(backup) == "" then
|
--combine the texture
|
||||||
player:set_attribute(backup, texture) --texture backup
|
|
||||||
--minetest.chat_send_all(dump(player:get_attribute(backup)))
|
|
||||||
else
|
|
||||||
texture = player:get_attribute(backup)
|
|
||||||
end
|
|
||||||
texture = texture.."^"..skin
|
texture = texture.."^"..skin
|
||||||
|
|
||||||
|
--sets the combined texture
|
||||||
if texture ~= nil and texture ~= "" then
|
if texture ~= nil and texture ~= "" then
|
||||||
if skinsdb_mod_path then
|
if skinsdb_mod_path then
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
|
@ -54,6 +58,7 @@ function airutils.set_player_skin(player, skin)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
--remove texture
|
||||||
local old_texture = player:get_attribute(backup)
|
local old_texture = player:get_attribute(backup)
|
||||||
if set_skin then
|
if set_skin then
|
||||||
if player:get_attribute("set_skin:player_skin") ~= nil and player:get_attribute("set_skin:player_skin") ~= "" then
|
if player:get_attribute("set_skin:player_skin") ~= nil and player:get_attribute("set_skin:player_skin") ~= "" then
|
||||||
|
|
Loading…
Add table
Reference in a new issue