fixed bug in changing owner

This commit is contained in:
Sokomine 2021-12-28 05:06:47 +01:00
parent e61baf7ab5
commit b33ba52d00

View File

@ -131,6 +131,7 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
"Owner changed from "..tostring(yl_speak_up.npc_owner[ n_id ])..
" to "..tostring(fields.n_owner).." for "..
"NPC name: \""..tostring(fields.n_npc))
-- the owner will actually be changed further down, at the end of this function
yl_speak_up.npc_owner[ n_id ] = fields.n_owner
end
@ -158,7 +159,8 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
"NPC name: \""..tostring(fields.n_npc)..
"\" Description: \""..tostring(fields.n_description).."\".")
-- just change name and description
else
elseif((fields.n_npc and fields.n_npc ~= "")
or (fields.n_description and fields.n_description ~= "")) then
dialog = yl_speak_up.speak_to[pname].dialog
dialog.n_npc = fields.n_npc
dialog.n_description = fields.n_description
@ -181,7 +183,7 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
if ent ~= nil then
ent.yl_speak_up.npc_name = dialog.n_npc
ent.yl_speak_up.npc_description = dialog.n_description
ent.owner = dialog.npc_owner
ent.owner = yl_speak_up.npc_owner[ n_id ] or dialog.npc_owner
local i_text = dialog.n_npc .. "\n" ..
dialog.n_description .. "\n" ..
yl_speak_up.infotext
@ -190,7 +192,7 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
end
end
if(not(save_initial_config)) then
if(not(fields.save_initial_config)) then
yl_speak_up.show_fs(player, "initial_config",
{n_id = n_id, d_id = yl_speak_up.speak_to[pname].d_id, false})
return