diff --git a/api/api_fashion.lua b/api/api_fashion.lua index f0b58fe..299410d 100644 --- a/api/api_fashion.lua +++ b/api/api_fashion.lua @@ -141,6 +141,12 @@ yl_speak_up.mesh_update_textures = function(pname, textures) if(not(obj) or not(textures)) then return end + -- store the textures without added masks for cape and shield: + yl_speak_up.speak_to[pname].skins = textures + local entity = obj:get_luaentity() + if(entity) then + entity.yl_speak_up.skin = textures + end -- the skins with wielded items need some conversion, -- while simpler models may just apply the texture local mesh = yl_speak_up.get_mesh(pname) @@ -148,11 +154,6 @@ yl_speak_up.mesh_update_textures = function(pname, textures) textures = yl_speak_up.textures2skin(textures) end obj:set_properties({ textures = textures }) - yl_speak_up.speak_to[pname].skins = textures - local entity = obj:get_luaentity() - if(entity) then - entity.yl_speak_up.skin = textures - end -- scrolling through the diffrent skins updates the skin; avoid spam in the log -- yl_speak_up.log_change(pname, n_id, -- "(fashion) skin changed to "..tostring(new_skin)..".") diff --git a/interface_mobs_api.lua b/interface_mobs_api.lua index 99bddfd..cc74b9a 100644 --- a/interface_mobs_api.lua +++ b/interface_mobs_api.lua @@ -86,6 +86,34 @@ function yl_speak_up.do_mobs_after_activate(self, staticdata, def, dtime) -- load the texture/skin of the NPC if self.yl_speak_up and self.yl_speak_up.skin then local tex = self.yl_speak_up.skin + -- only use the cape as such: + if(tex[1]) then + local p = string.split(tex[1], "=") + if(#p > 1) then + tex[1] = p[#p] + end + end + -- the shield: + if(tex[3]) then + local p = string.split(tex[3], "=") + if(#p > 1) then + tex[3] = p[#p] + local start = 1 + local ende = string.len(tex[3]) + if(string.sub(tex[3], 1, 1)=="(") then + start = 2 + end + if(string.sub(tex[3], ende)==")") then + ende = ende - 1 + end + tex[3] = string.sub(tex[3], start, ende) + end + end + -- store only the basic texture names without shield and text mask: + self.yl_speak_up.skin = tex + -- add back cape and shield mask: + tex[1] = yl_speak_up.cape2texture(tex[1]) + tex[3] = yl_speak_up.shield2texture(tex[3]) self.object:set_properties({textures = {tex[1], tex[2], tex[3], tex[4]}}) end