From a6a2b3f566bd39d6dab4019351b432dd10e73632 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Mon, 31 May 2021 22:09:42 +0200 Subject: [PATCH] moved setdialog to yl_speak_up.show_fs --- functions.lua | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/functions.lua b/functions.lua index 30dce5a..c62fe14 100644 --- a/functions.lua +++ b/functions.lua @@ -1800,6 +1800,15 @@ yl_speak_up.show_fs = function(player, fs_name, param) local pname = player:get_player_name() if(fs_name == "TODO") then + elseif(fs_name == "setdialog") then + if(not(param)) then + param = {} + end + minetest.show_formspec(pname, "yl_speak_up:setdialog", + get_fs_setdialog(player, param.n_id, param.d_id)) + + -- "confirm_save" does not have its own option here; doesn't have a get_fs_-function either + elseif(fs_name == "edit_option_dialog") then if(not(param)) then param = {} @@ -1892,7 +1901,7 @@ yl_speak_up.input_optiondialog = function(player, formname, fields) yl_speak_up.speak_to[pname].n_id = n_id yl_speak_up.speak_to[pname].d_id = d_id - minetest.show_formspec(pname, "yl_speak_up:setdialog", get_fs_setdialog(player, n_id, d_id)) + yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = d_id}) return end @@ -2099,7 +2108,7 @@ yl_speak_up.input_setdialog = function(player, formname, fields) end end - minetest.show_formspec(pname, "yl_speak_up:setdialog", get_fs_setdialog(player, n_id, d_id)) + yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = d_id}) return end @@ -2107,11 +2116,7 @@ yl_speak_up.input_setdialog = function(player, formname, fields) if fields.button_delete and fields.d_id then delete_dialog(n_id, fields.d_id) yl_speak_up.speak_to[pname].d_id = yl_speak_up.text_new_dialog_id - minetest.show_formspec( - pname, - "yl_speak_up:setdialog", - get_fs_setdialog(player, n_id, yl_speak_up.text_new_dialog_id) - ) + yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = yl_speak_up.text_new_dialog_id}) yl_speak_up.log_change(pname, n_id, "(staff) Deleted dialog "..tostring(fields.d_id)..".") end @@ -2119,7 +2124,7 @@ yl_speak_up.input_setdialog = function(player, formname, fields) -- Change in Dropdown List: Show dialog formspec again with different dialog selected if fields.d_id then yl_speak_up.speak_to[pname].d_id = fields.d_id - minetest.show_formspec(pname, "yl_speak_up:setdialog", get_fs_setdialog(player, n_id, fields.d_id)) + yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = fields.d_id}) end end @@ -3292,11 +3297,7 @@ function yl_speak_up.config(clicker, npc) -- find out who owns the npc while we still have easy access to the luaentity yl_speak_up.npc_owner[ n_id ] = npc:get_luaentity().owner - minetest.show_formspec( - pname, - "yl_speak_up:setdialog", - get_fs_setdialog(clicker, n_id, yl_speak_up.text_new_dialog_id) - ) + yl_speak_up.show_fs(clicker, "setdialog", {n_id = n_id, d_id = yl_speak_up.text_new_dialog_id}) end --###