mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-09-08 20:16:24 +02:00
fixed bug with target_dialog beeing nil; made back button in option edit menu work
This commit is contained in:
parent
af9edde36d
commit
1b9bfa8e14
@ -928,6 +928,9 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
if(not(target_dialog)) then
|
||||
target_dialog = "- none -"
|
||||
end
|
||||
|
||||
-- offer the correct preselection for hidden/grey/show text
|
||||
local alternate_answer_option = "3"
|
||||
@ -2073,6 +2076,37 @@ minetest.register_on_player_receive_fields(
|
||||
)
|
||||
|
||||
|
||||
minetest.register_on_player_receive_fields(
|
||||
function(player, formname, fields)
|
||||
if formname ~= "yl_speak_up:edit_option_dialog" then
|
||||
return
|
||||
end
|
||||
local pname = player:get_player_name()
|
||||
|
||||
-- Is the player working on this particular npc?
|
||||
local edit_mode = (yl_speak_up.edit_mode[pname] == yl_speak_up.speak_to[pname].n_id)
|
||||
if(not(edit_mode)) then
|
||||
return
|
||||
end
|
||||
local n_id = yl_speak_up.speak_to[pname].n_id
|
||||
local d_id = yl_speak_up.speak_to[pname].d_id
|
||||
|
||||
-- this meny is specific to an option for a dialog; if no dialog is selected, we really
|
||||
-- can't know what to do
|
||||
if(not(d_id)) then
|
||||
return
|
||||
end
|
||||
|
||||
-- back to the main dialog window?
|
||||
if(fields.show_current_dialog) then
|
||||
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, n_id, d_id))
|
||||
return
|
||||
end
|
||||
--minetest.chat_send_player(pname, "Fields: "..minetest.serialize(fields))
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
minetest.register_on_player_receive_fields(
|
||||
function(player, formname, fields)
|
||||
if formname ~= "yl_speak_up:talk" then
|
||||
|
Loading…
Reference in New Issue
Block a user