From 536ad045f613de4ddc61e5aebdaa3e822c234360 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Mon, 18 Dec 2023 04:47:53 +0100 Subject: [PATCH] renamed get_fs_ function in alternate_text because it does something diffrent from other get_fs_ functions --- .../api_alternate_text.lua | 14 +++++++------- init.lua | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename fs_alternate_text.lua => api/api_alternate_text.lua (97%) diff --git a/fs_alternate_text.lua b/api/api_alternate_text.lua similarity index 97% rename from fs_alternate_text.lua rename to api/api_alternate_text.lua index dad04b9..23c4679 100644 --- a/fs_alternate_text.lua +++ b/api/api_alternate_text.lua @@ -31,7 +31,7 @@ yl_speak_up.handle_edit_actions_alternate_text = function( yl_speak_up.speak_to[pname].edit_alternate_text_for = target_action yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, - formspec = yl_speak_up.get_fs_edit_dialog_modification( + formspec = yl_speak_up.extend_fs_edit_dialog_modification( dialog, target_action.a_on_failure, target_action.alternate_text, "if the action \""..tostring(target_action.a_id).. "\" of option \""..tostring(o_id).. @@ -61,7 +61,7 @@ yl_speak_up.handle_edit_actions_alternate_text = function( -- this only happens in edit_options_dialog; log it directly yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, - formspec = yl_speak_up.get_fs_edit_dialog_modification( + formspec = yl_speak_up.extend_fs_edit_dialog_modification( dialog, target_effect.r_value, target_effect.alternate_text, "if the action ".. "of option \""..tostring(o_id).. @@ -85,7 +85,7 @@ yl_speak_up.handle_edit_actions_alternate_text = function( yl_speak_up.speak_to[pname].edit_alternate_text_for = data yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, - formspec = yl_speak_up.get_fs_edit_dialog_modification( + formspec = yl_speak_up.extend_fs_edit_dialog_modification( dialog, failure_id, data.alternate_text, "if the action \""..tostring(x_id).. "\" of option \""..tostring(o_id).. @@ -103,7 +103,7 @@ yl_speak_up.handle_edit_actions_alternate_text = function( yl_speak_up.speak_to[pname].edit_alternate_text_for = data yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, - formspec = yl_speak_up.get_fs_edit_dialog_modification( + formspec = yl_speak_up.extend_fs_edit_dialog_modification( dialog, data.on_failure, data.alternate_text, "if the effect \""..tostring(x_id).. "\" of option \""..tostring(o_id).. @@ -125,7 +125,7 @@ yl_speak_up.handle_edit_actions_alternate_text = function( yl_speak_up.speak_to[pname].edit_alternate_text_for = "timer_on_failure" yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, - formspec = yl_speak_up.get_fs_edit_dialog_modification( + formspec = yl_speak_up.extend_fs_edit_dialog_modification( dialog, d_id, alternate_text, "if the player failed to complete the action ".. "\" of option \""..tostring(o_id).. @@ -148,7 +148,7 @@ yl_speak_up.handle_edit_actions_alternate_text = function( yl_speak_up.speak_to[pname].edit_alternate_text_for = "timer_on_success" yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, - formspec = yl_speak_up.get_fs_edit_dialog_modification( + formspec = yl_speak_up.extend_fs_edit_dialog_modification( dialog, d_id, alternate_text, "if the player has complete the action ".. "\" of option \""..tostring(o_id).. @@ -400,7 +400,7 @@ end -- this allows to edit modifications of a dialog that are applied when a given option -- is choosen - i.e. when the NPC wants to answer some questions - but those answers -- do not warrant their own dialog -yl_speak_up.get_fs_edit_dialog_modification = function(dialog, d_id, alternate_dialog_text, explanation, +yl_speak_up.extend_fs_edit_dialog_modification = function(dialog, d_id, alternate_dialog_text, explanation, forbid_turn_into_new_dialog) local nd = "button[9.0,12.3;6,0.7;turn_alternate_text_into_new_dialog;Turn this into a new dialog]" diff --git a/init.lua b/init.lua index 288c29e..d059823 100644 --- a/init.lua +++ b/init.lua @@ -183,7 +183,7 @@ yl_speak_up.reload = function(modpath, log_entry) -- create i.e. a dropdown list of player names dofile(modpath .. "formspec_helpers.lua") -- handle alternate text for dialogs - dofile(modpath .. "fs_alternate_text.lua") + dofile(modpath .. "api/api_alternate_text.lua") -- helpful for debugging the content of the created dialog structure dofile(modpath .. "fs/fs_show_what_points_to_this_dialog.lua") -- debugging - extended information about what (your own) NPC does