mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-06-25 08:38:03 +02:00
catch some error conditions
This commit is contained in:
parent
786ca77c7f
commit
a8c9321672
@ -830,6 +830,16 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
|
|||||||
local n_dialog = dialog.n_dialogs[d_id]
|
local n_dialog = dialog.n_dialogs[d_id]
|
||||||
local d_option = n_dialog.d_options[o_id]
|
local d_option = n_dialog.d_options[o_id]
|
||||||
|
|
||||||
|
-- currently no trade running (we're editing options)
|
||||||
|
yl_speak_up.trade[pname] = nil
|
||||||
|
yl_speak_up.speak_to[pname].trade_id = nil
|
||||||
|
|
||||||
|
if(not(d_option)) then
|
||||||
|
return "size[6,2]"..
|
||||||
|
"label[0.2,0.5;Ups! Option "..minetest.formspec_escape(tostring(o_id))..
|
||||||
|
" does not exist.]"..
|
||||||
|
"button_exit[2,1.5;1,0.9;exit;Exit]"
|
||||||
|
end
|
||||||
-- are there any preconditions?
|
-- are there any preconditions?
|
||||||
local list_of_preconditions = ""
|
local list_of_preconditions = ""
|
||||||
local prereq = d_option.o_prerequisites
|
local prereq = d_option.o_prerequisites
|
||||||
@ -1088,6 +1098,10 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id)
|
|||||||
return get_error_message()
|
return get_error_message()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- currently no trade running (we're editing options)
|
||||||
|
yl_speak_up.trade[pname] = nil
|
||||||
|
yl_speak_up.speak_to[pname].trade_id = nil
|
||||||
|
|
||||||
--[[ If we have an explicit call for a certain d_id, we grab it from parameters.
|
--[[ If we have an explicit call for a certain d_id, we grab it from parameters.
|
||||||
If not, we grab in from context.
|
If not, we grab in from context.
|
||||||
When neither are present, we grab it from d_sort
|
When neither are present, we grab it from d_sort
|
||||||
@ -1826,6 +1840,7 @@ yl_speak_up.show_fs = function(player, fs_name, param)
|
|||||||
-- "confirm_save" does not have its own option here; doesn't have a get_fs_-function either
|
-- "confirm_save" does not have its own option here; doesn't have a get_fs_-function either
|
||||||
|
|
||||||
elseif(fs_name == "edit_option_dialog") then
|
elseif(fs_name == "edit_option_dialog") then
|
||||||
|
-- the optional "caller" parameter can be used for debugging
|
||||||
if(not(param)) then
|
if(not(param)) then
|
||||||
param = {}
|
param = {}
|
||||||
end
|
end
|
||||||
@ -2751,7 +2766,8 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
|
|||||||
-- if a new option was added or the target dialog of this one changed, display the right new option
|
-- if a new option was added or the target dialog of this one changed, display the right new option
|
||||||
if(result and result["show_next_option"] and n_dialog.d_options[result["show_next_option"]]) then
|
if(result and result["show_next_option"] and n_dialog.d_options[result["show_next_option"]]) then
|
||||||
yl_speak_up.show_fs(player, "edit_option_dialog",
|
yl_speak_up.show_fs(player, "edit_option_dialog",
|
||||||
{n_id = n_id, d_id = d_id, o_id = result["show_next_option"]})
|
{n_id = n_id, d_id = d_id, o_id = result["show_next_option"],
|
||||||
|
caller="show_next_option"})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2784,7 +2800,7 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
-- show that dialog; fallback: show the same (o_id) again
|
-- show that dialog; fallback: show the same (o_id) again
|
||||||
yl_speak_up.show_fs(player, "edit_option_dialog",
|
yl_speak_up.show_fs(player, "edit_option_dialog",
|
||||||
{n_id = n_id, d_id = d_id, o_id = o_found})
|
{n_id = n_id, d_id = d_id, o_id = o_found, caller="prev option"})
|
||||||
return
|
return
|
||||||
|
|
||||||
-- the player wants to see the next option/answer
|
-- the player wants to see the next option/answer
|
||||||
@ -2799,7 +2815,7 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
-- show that dialog; fallback: show the same (o_id) again
|
-- show that dialog; fallback: show the same (o_id) again
|
||||||
yl_speak_up.show_fs(player, "edit_option_dialog",
|
yl_speak_up.show_fs(player, "edit_option_dialog",
|
||||||
{n_id = n_id, d_id = d_id, o_id = o_found})
|
{n_id = n_id, d_id = d_id, o_id = o_found, caller="next option"})
|
||||||
return
|
return
|
||||||
|
|
||||||
-- show the trade associated with this dialog and option
|
-- show the trade associated with this dialog and option
|
||||||
@ -3080,7 +3096,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
or fields["effects_"..o_id]) then
|
or fields["effects_"..o_id]) then
|
||||||
yl_speak_up.show_fs(player, "edit_option_dialog",
|
yl_speak_up.show_fs(player, "edit_option_dialog",
|
||||||
{n_id = yl_speak_up.speak_to[pname].n_id,
|
{n_id = yl_speak_up.speak_to[pname].n_id,
|
||||||
d_id = d_id, o_id = o_found})
|
d_id = d_id, o_id = o_id, caller="button"})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user