added some checks to fs_fashion.lua

This commit is contained in:
Sokomine 2022-07-21 19:47:30 +02:00
parent 5432064ae0
commit 927adfb627

View File

@ -327,6 +327,9 @@ yl_speak_up.input_fashion = function(player, formname, fields)
-- this depends on the model!
local mesh = yl_speak_up.get_mesh(pname)
local texture_index = yl_speak_up.mesh_data[mesh].texture_index
if(not(texture_index)) then
texture_index = 1
end
-- show extra formspec with wielded item configuration and cape setup
if(fields.button_config_wielded_items
@ -341,17 +344,18 @@ yl_speak_up.input_fashion = function(player, formname, fields)
local textures = yl_speak_up.speak_to[pname].textures
-- fallback if something went wrong (i.e. unkown NPC)
if(not(skins)) then
skins = {textures[texture_index]}
end
local skin = (textures[texture_index] or "")
if(not(skins)) then
skins = {skin}
end
local skin_index = table.indexof(skins, skin)
if(skin_index == -1) then
skin_index = 1
end
local new_skin = skin
-- swithc back to the stored old skin
-- switch back to the stored old skin
if(fields.button_old_skin) then
local old_texture = yl_speak_up.speak_to[pname].old_texture
if(old_texture) then
@ -547,6 +551,9 @@ yl_speak_up.get_fs_fashion = function(pname)
-- this depends on the model!
local mesh = yl_speak_up.get_mesh(pname)
local texture_index = yl_speak_up.mesh_data[mesh].texture_index
if(not(texture_index)) then
texture_index = 1
end
-- which skins are available? this depends on mob_type
local mob_type = yl_speak_up.get_mob_type(pname)