turning edit mode on/off restarts the chat at the first dialog

This commit is contained in:
Sokomine 2021-04-29 17:06:39 +02:00
parent a9259ed3ba
commit 787550eca1

View File

@ -1679,15 +1679,15 @@ minetest.register_on_player_receive_fields(
-- enter edit mode with that particular NPC
yl_speak_up.edit_mode[pname] = yl_speak_up.speak_to[pname].n_id
-- start a new chat - but this time in edit mode
-- TODO: this continues where the last chat was and does not start from the beginning
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id))
yl_speak_up.speak_to[pname].d_id = nil
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id, nil))
return
-- end edit mode (does not require the priv; will only switch back to normal behaviour)
elseif fields.button_end_edit_mode then
yl_speak_up.edit_mode[pname] = nil
-- start a new chat - but this time in normal mode
-- TODO: this continues where the last chat was and does not start from the beginning
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id))
yl_speak_up.speak_to[pname].d_id = nil
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id, nil))
return
end