From 787550eca17e6cafb6339ccff11eecbd57212d37 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Thu, 29 Apr 2021 17:06:39 +0200 Subject: [PATCH] turning edit mode on/off restarts the chat at the first dialog --- functions.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions.lua b/functions.lua index 30b399c..3c2de90 100644 --- a/functions.lua +++ b/functions.lua @@ -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