performance fix in mcl_skins

This commit is contained in:
AFCMS 2021-02-18 15:07:37 +00:00
parent c9e589b931
commit 2e2d0b49ea
1 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,8 @@ mcl_skins = {
} }
local S = minetest.get_translator("mcl_skins") local S = minetest.get_translator("mcl_skins")
local has_mcl_armor = minetest.get_modpath("mcl_armor")
local has_mcl_inventory = minetest.get_modpath("mcl_inventory")
-- load skin list and metadata -- load skin list and metadata
local id, f, data, skin = 0 local id, f, data, skin = 0
@ -105,11 +107,11 @@ mcl_skins.set_player_skin = function(player, skin_id)
mcl_skins.previews[playername] = preview mcl_skins.previews[playername] = preview
player:get_meta():set_string("mcl_skins:skin_id", tostring(skin_id)) player:get_meta():set_string("mcl_skins:skin_id", tostring(skin_id))
mcl_skins.update_player_skin(player) mcl_skins.update_player_skin(player)
if minetest.get_modpath("mcl_armor") then if has_mcl_armor then
armor.textures[playername].skin = skin_file armor.textures[playername].skin = skin_file
armor:update_player_visuals(player) armor:update_player_visuals(player)
end end
if minetest.get_modpath("mcl_inventory") then if has_mcl_inventory then
mcl_inventory.update_inventory_formspec(player) mcl_inventory.update_inventory_formspec(player)
end end
for i=1, #mcl_skins.registered_on_set_skins do for i=1, #mcl_skins.registered_on_set_skins do