fixed bug with saving when quitting

This commit is contained in:
Sokomine 2021-06-28 00:38:12 +02:00
parent 885c19831e
commit 4a4ffefb85
2 changed files with 10 additions and 5 deletions

View File

@ -113,9 +113,9 @@ yl_speak_up.get_fs_save_or_discard_changes = function(player, param)
minetest.formspec_escape(d_id)..":]"..
"hypertext[0.2,1;13.5,4;list_of_changes;<normal>"..
minetest.formspec_escape(text) .. "\n</normal>".."]"..
"button[1.2,5.2;3,0.9;discard_dialog_changes;Discard changes]"..
"button_exit[1.2,5.2;3,0.9;discard_dialog_changes;Discard changes]"..
"button[5.7,5.2;3,0.9;back_to_dialog_changes;Back]"..
"button[10.2,5.2;3,0.9;save_dialog_changes;Save changes]"..
"button_exit[10.2,5.2;3,0.9;save_dialog_changes;Save changes]"..
"tooltip[save_dialog_changes;Save all changes to this dialog and "..target_name..".]"..
"tooltip[discard_dialog_changes;Undo all changes and "..target_name..".]"..
"tooltip[back_to_dialog_changes;Go back to dialog "..

View File

@ -82,6 +82,9 @@ yl_speak_up.show_fs = function(player, fs_name, param)
return
end
local pname = player:get_player_name()
if(not(yl_speak_up.speak_to[pname])) then
return
end
local last_fs = yl_speak_up.speak_to[pname].last_fs
-- show the save or discard changes dialog
@ -98,6 +101,11 @@ yl_speak_up.show_fs = function(player, fs_name, param)
yl_speak_up.speak_to[pname].next_fs_param = nil
yl_speak_up.speak_to[pname].last_fs = fs_name
yl_speak_up.speak_to[pname].last_fs_param = param
if(not(fs_name) or fs_name == "quit") then
yl_speak_up.speak_to[pname] = nil
yl_speak_up.edit_mode[pname] = nil
return
end
-- the player clicked on "back" in the above dialog
elseif(fs_name and fs_name == "show_last_fs") then
@ -156,9 +164,6 @@ yl_speak_up.show_fs = function(player, fs_name, param)
yl_speak_up.speak_to[pname].last_fs = fs_name
-- and its parameter
yl_speak_up.speak_to[pname].last_fs_param = param
elseif(fs_name == "quit") then
-- player wanted to quit
return
end
-- this is here mostly to fascilitate debugging - so that really all calls to