apply textures2skin for skins with wielded items

This commit is contained in:
Sokomine 2022-07-21 20:04:27 +02:00
parent 927adfb627
commit 57e8bc7352
2 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,8 @@ yl_speak_up.mesh_data["mobs_character.b3d"] = {
can_show_wielded_items = false,
-- which function can be used to draw the skin?
skin_preview = yl_speak_up.skin_preview_normal,
-- textures are applied directly
textures_to_skin = false,
}
yl_speak_up.mesh_data["skinsdb_3d_armor_character_5.b3d"] = {
-- the second texture is the skin
@ -46,6 +48,8 @@ yl_speak_up.mesh_data["skinsdb_3d_armor_character_5.b3d"] = {
can_show_wielded_items = true,
-- this model needs its own preview function
skin_preview = yl_speak_up.skin_preview_skinsdb_3d_armor_character_5,
-- call textures2skin in order to convert the textures (wielded items)
textures_to_skin = true,
}

View File

@ -392,6 +392,12 @@ yl_speak_up.input_fashion = function(player, formname, fields)
-- actually make sure that the NPC updates its texture
local obj = yl_speak_up.speak_to[pname].obj
if(obj) then
-- the skins with wielded items need some conversion,
-- while simpler models may just apply the texture
local mesh = yl_speak_up.get_mesh(pname)
if(mesh and yl_speak_up.mesh_data[mesh].textures_to_skin) then
textures = textures2skin(textures)
end
obj:set_properties({ textures = textures })
end
-- scrolling through the diffrent skins updates the skin; avoid spam in the log