fallback if no skins are defined for an npc

This commit is contained in:
Sokomine 2022-07-21 00:47:05 +02:00
parent 42e16d0e8b
commit 72c68fd261

View File

@ -339,7 +339,12 @@ yl_speak_up.input_fashion = function(player, formname, fields)
local mob_type = yl_speak_up.get_mob_type(pname)
local skins = yl_speak_up.mob_skins[mob_type]
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 "")
local skin_index = table.indexof(skins, skin)
if(skin_index == -1) then
@ -555,6 +560,10 @@ yl_speak_up.get_fs_fashion = function(pname)
yl_speak_up.speak_to[pname].old_texture = skin
old_texture = skin
end
-- fallback if something went wrong
if(not(skins)) then
skins = {old_texture}
end
local button_cancel = "Cancel"
-- is this player editing this particular NPC? then rename the button