fix #5013 make sure textures are set properly on resture

This commit is contained in:
Sokomine 2023-07-26 22:17:24 +02:00
parent b9c8e3c345
commit b8937d4ba7
2 changed files with 7 additions and 1 deletions

View File

@ -507,7 +507,10 @@ yl_speak_up.get_fs_fashion = function(pname)
local skins = yl_speak_up.mob_skins[mob_type]
local textures = yl_speak_up.speak_to[pname].textures
local skin = (textures[texture_index] or "")
local skin = ""
if(textures and textures[texture_index]) then
skin = (textures[texture_index] or "")
end
-- store the old texture so that we can go back to it
local old_texture = yl_speak_up.speak_to[pname].old_texture
if(not(old_texture)) then

View File

@ -86,6 +86,7 @@ yl_speak_up.update_npc_data = function(self, dialog, force_store)
muted = self.yl_speak_up.talk,
animation = self.yl_speak_up.animation,
skin = self.yl_speak_up.skin,
textures = self.textures,
}
-- the current object will change after deactivate; there is no point in storing
-- it over server restart
@ -238,6 +239,7 @@ yl_speak_up.command_npc_force_restore_npc = function(pname, rest)
npc_description = npc_desc,
infotext = yl_speak_up.infotext, -- will be set automaticly later
animation = data.animation,
textures = data.textures,
}
-- This is at least useful for mobs_redo. Other mob mods may require adjustments.
ent.owner = npc_owner
@ -249,6 +251,7 @@ yl_speak_up.command_npc_force_restore_npc = function(pname, rest)
end
if(data.skin and ent.object) then
ent.object:set_properties({textures = table.copy(data.skin)})
ent.yl_speak_up.textures = table.copy(data.skin)
end
-- update the NPC list
yl_speak_up.update_npc_data(ent, dialog, true)