From af84935c2b71de127d3737af5b6ee1ef4d7d5dc8 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Thu, 27 Jul 2023 13:20:52 +0200 Subject: [PATCH] moved staff based_based_editing and tools (staffs) into yl_npc because they're deprecated --- README.md | 33 +- config.lua | 5 - init.lua | 14 - staff_based_editing.lua | 767 ------------------ textures/yl_speak_up_staff_of_dawai_dawai.png | Bin 264 -> 0 bytes textures/yl_speak_up_staff_of_fashion.png | Bin 1240 -> 0 bytes textures/yl_speak_up_staff_of_game_over.png | Bin 1216 -> 0 bytes textures/yl_speak_up_staff_of_i_said_so.png | Bin 263 -> 0 bytes textures/yl_speak_up_staff_of_shut_up.png | Bin 1214 -> 0 bytes tools.lua | 126 --- 10 files changed, 8 insertions(+), 937 deletions(-) delete mode 100644 staff_based_editing.lua delete mode 100644 textures/yl_speak_up_staff_of_dawai_dawai.png delete mode 100644 textures/yl_speak_up_staff_of_fashion.png delete mode 100644 textures/yl_speak_up_staff_of_game_over.png delete mode 100644 textures/yl_speak_up_staff_of_i_said_so.png delete mode 100644 textures/yl_speak_up_staff_of_shut_up.png delete mode 100644 tools.lua diff --git a/README.md b/README.md index 3286b11..96b0af3 100644 --- a/README.md +++ b/README.md @@ -140,12 +140,8 @@ special meaning: ### 5. How to configure NPC and add dialogs -There are two ways: -1. Just talk to them and click on the "I am your owner"-Dialog. This opens up - a menu where you can edit most things. -2. Use /giveme to get the staff you want, wield the staff and point it at the - NPC you want to change. This is much more powerful. Lua code can be - entered and later executed by the NPC. +Just talk to them and click on the "I am your owner"-Dialog. This opens up +a menu where you can edit most things. hint: The command `/npc_talk debug ` allows you to get debug information regarding preconditions and effects. You can turn it @@ -157,11 +153,9 @@ hint: The command `/npc_talk debug ` allows you to get debug `npc_talk_owner` will allow players to edit their *own* NPC by talking to them. - Does *not* include usage of the staffs! Ought to be given to all players. `npc_talk_master` allows players to edit *any* NPC supported by this mod. - Does *not* include usage of the staffs! Ought to be given to selected trusted players who want to help others with their NPC configuration and/or support NPCs owned by the server. @@ -173,7 +167,7 @@ hint: The command `/npc_talk debug ` allows you to get debug the prefix "server". `npc_master` allows players to edit *any* NPC supported by this mod. - *Does* include usage of the staffs. + *Does* include usage of the staffs (now part of `yl_npc`). This is very powerful and allows to enter and execute lua code without restrictions. Only grant this to staff members you really trust. @@ -198,17 +192,8 @@ NPC can have privs as well. The NPC... ### 7. Tools -There are diffrent staffs for diffrent functionality: -Staff of.. does: -..I-said-so edit what the NPC says (extremly powerful) -..shut-up mute the NPC -..dawai-dawai un-mute the NPC -..game-over remove the NPC (but not its data) -..fashion change skin etc. - -Be careful: With the staffs, you can add more than one result of the type -"dialog" - which will confuse the NPC and lead to unexpected results. Use -the staffs only with care! +There are no more tools (=staffs) provided. You can do all you could do +with them by just talking to the NPC. ### 8. Mute @@ -217,9 +202,9 @@ the staffs only with care! When you edit an NPC, you might want to stop it from talking to other players and spoiling unifinished texts/options to the player. -For this case, the NPC can be muted. This works either with the staff or by -selecting the appropriate option in the talk menu after having started edit -mode by claiming to be the NPC's owner. +For this case, the NPC can be muted. This works by selecting the appropriate +option in the talk menu after having started edit mode by claiming to be the +NPC's owner. ### 9. Skin @@ -271,8 +256,6 @@ Trades can either be attached to dialog options (and show up as results there) via the edit options dialog or just be trades that are shown in a trade list. The trade list can be accessed from the NPC's inventory. -Trades cannot be added with the staffs. - If there are trades that ought to show up in the general trade list (i.e. not only be attached to dialog options), then a button "Let's trade" will be shown as option for the first dialog. diff --git a/config.lua b/config.lua index 39ce289..c452e89 100644 --- a/config.lua +++ b/config.lua @@ -9,11 +9,6 @@ -- -- So please use a seperate config mod! --- enable/disable the original staff-based editing --- Note: The staffs can only edit part of what the NPC can do. They can even break the NPC. --- Set this only if you need to force-mute an NPC or something like that. -yl_speak_up.enable_staff_based_editing = true - -- Do the NPCs talk right after they spawned? yl_speak_up.talk_after_spawn = true diff --git a/init.lua b/init.lua index 1a3c45d..580d644 100644 --- a/init.lua +++ b/init.lua @@ -264,17 +264,3 @@ yl_speak_up_execute_if_file_exists("startup") -- load all those files that can also be reloaded without a server restart -- load here for the first time: yl_speak_up.reload(modpath, "loaded") - - --- these functions here mostly cannot be reloaded without a server restart --- because they register tools and entities --- --- the staffs (requires npc_master priv) -if(yl_speak_up.enable_staff_based_editing) then - -- editing the npc with the staff: - dofile(modpath .. "staff_based_editing.lua") - -- defining the staffs: - dofile(modpath .. "tools.lua") -end - -minetest.log("action","[MOD] yl_speak_up loaded tools and mobs") diff --git a/staff_based_editing.lua b/staff_based_editing.lua deleted file mode 100644 index 8ba0dea..0000000 --- a/staff_based_editing.lua +++ /dev/null @@ -1,767 +0,0 @@ ------------------------------------------------------------------------------ --- these functions are used/needed for staff based editing ------------------------------------------------------------------------------ --- this was created by AliasAlreadyTaken and the original edit mechanism - -local function options_to_dialog(pname) - local dialog = yl_speak_up.speak_to[pname].dialog - - local n_id = yl_speak_up.speak_to[pname].n_id - local d_id = yl_speak_up.speak_to[pname].d_id - local o_id = yl_speak_up.speak_to[pname].o_id - local p_id = yl_speak_up.speak_to[pname].p_id - local r_id = yl_speak_up.speak_to[pname].r_id - - if yl_speak_up.speak_to[pname].d_text then - dialog.n_dialogs[d_id].d_text = yl_speak_up.speak_to[pname].d_text - end - - --Find the o_id to save to - local future_o_id = "" - if yl_speak_up.speak_to[pname].o_id ~= nil and yl_speak_up.speak_to[pname].o_id ~= yl_speak_up.text_new_option_id then - future_o_id = yl_speak_up.speak_to[pname].o_id - else - future_o_id = "o_" .. yl_speak_up.find_next_id(dialog.n_dialogs[d_id].d_options) - - if dialog.n_dialogs[d_id].d_options == nil then - dialog.n_dialogs[d_id].d_options = {} - end - - dialog.n_dialogs[d_id].d_options[future_o_id] = {} - end - - --Find the p_id to save to - local future_p_id = "" - if - yl_speak_up.speak_to[pname].p_id ~= nil and - yl_speak_up.speak_to[pname].p_id ~= yl_speak_up.text_new_prerequisite_id - then - future_p_id = yl_speak_up.speak_to[pname].p_id - else - future_p_id = "p_" .. yl_speak_up.find_next_id(dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites) - if future_p_id == "p_1" then - dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites = {} - end - dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites[future_p_id] = {} - end - - --Find the r_id to save to - local future_r_id = "" - if yl_speak_up.speak_to[pname].r_id ~= nil and yl_speak_up.speak_to[pname].r_id ~= yl_speak_up.text_new_result_id then - future_r_id = yl_speak_up.speak_to[pname].r_id - else - future_r_id = yl_speak_up.add_new_result(dialog, d_id, future_o_id) - end - - --Edit options - dialog.n_dialogs[d_id].d_options[future_o_id].o_id = future_o_id - dialog.n_dialogs[d_id].d_options[future_o_id].o_hide_when_prerequisites_not_met = - yl_speak_up.speak_to[pname].o_hide or "false" - dialog.n_dialogs[d_id].d_options[future_o_id].o_grey_when_prerequisites_not_met = - yl_speak_up.speak_to[pname].o_grey or "false" - local s = yl_speak_up.sanitize_sort(dialog.n_dialogs[d_id].d_options, yl_speak_up.speak_to[pname].o_sort) - dialog.n_dialogs[d_id].d_options[future_o_id].o_sort = s - dialog.n_dialogs[d_id].d_options[future_o_id].o_text_when_prerequisites_not_met = - yl_speak_up.speak_to[pname].o_not_met or "" - dialog.n_dialogs[d_id].d_options[future_o_id].o_text_when_prerequisites_met = - yl_speak_up.speak_to[pname].o_met or "" - - --Edit prerequisites - - --Do we delete the prerequisite? - if - yl_speak_up.speak_to[pname].p_type == "delete" and yl_speak_up.speak_to[pname].p_id ~= nil and - yl_speak_up.speak_to[pname].p_id ~= yl_speak_up.text_new_prerequisite_id - then - dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites[future_p_id] = nil - else - if yl_speak_up.speak_to[pname].p_value ~= nil and yl_speak_up.speak_to[pname].p_value ~= "" then - dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites[future_p_id].p_id = future_p_id - dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites[future_p_id].p_type = - yl_speak_up.speak_to[pname].p_type - dialog.n_dialogs[d_id].d_options[future_o_id].o_prerequisites[future_p_id].p_value = - yl_speak_up.speak_to[pname].p_value - end - end - - --Do we delete the result? - if - yl_speak_up.speak_to[pname].r_type == "delete" and yl_speak_up.speak_to[pname].r_id ~= nil and - yl_speak_up.speak_to[pname].r_id ~= yl_speak_up.text_new_result_id - then - dialog.n_dialogs[d_id].d_options[future_o_id].o_results[future_r_id] = nil - else - if yl_speak_up.speak_to[pname].r_value ~= nil and yl_speak_up.speak_to[pname].r_value ~= "" then - dialog.n_dialogs[d_id].d_options[future_o_id].o_results[future_r_id].r_id = future_r_id - dialog.n_dialogs[d_id].d_options[future_o_id].o_results[future_r_id].r_type = - yl_speak_up.speak_to[pname].r_type - dialog.n_dialogs[d_id].d_options[future_o_id].o_results[future_r_id].r_value = - yl_speak_up.speak_to[pname].r_value - end - end - - return dialog -end - ---### --- Helpers ---### - -local function get_prerequisite_types() - --local t_gpt = {"item", "quest", "function", "auto", "delete"} - local t_gpt = {"item", "function", "delete"} - local s_gpt = "" - for _, v in pairs(t_gpt) do - s_gpt = s_gpt .. v .. "," - end - - s_gpt = s_gpt:sub(1, -2) -- cut last comma - - return s_gpt, t_gpt -end - -local function get_result_types() - --local t_grt = {"dialog", "give_item", "quest", "function", "auto", "delete"} - local t_grt = {"dialog","give_item","take_item","move","function","trade","delete"} - local s_grt = "" - for _, v in pairs(t_grt) do - s_grt = s_grt .. v .. "," - end - - s_grt = s_grt:sub(1, -2) -- cut last comma - - return s_grt, t_grt -end - - -local function delete_option(n_id, d_id, o_id) - if d_id == yl_speak_up.text_new_dialog_id then - return false - end -- We don't delete "New dialog" Also, something might have gone wrong here. - if o_id == yl_speak_up.text_new_option_id then - return false - end -- We don't delete "New option" - - local dialog = yl_speak_up.load_dialog(n_id, false) - - dialog.n_dialogs[d_id].d_options[o_id] = nil - - yl_speak_up.save_dialog(n_id, dialog) -end - - ---### ---Formspecs ---### - --- get formspecs - --- dialog - -yl_speak_up.get_fs_setdialog = function(clicker, n_id, d_id) - local dialog = yl_speak_up.load_dialog(n_id, false) - - local items = yl_speak_up.text_new_dialog_id - local count = 1 - local d_sort = "" - local text = "" - - if next(dialog) == nil then -- file does not exist - dialog.n_id = n_id - dialog.n_npc = "" - dialog.n_description = "" - elseif dialog.n_dialogs == nil then -- file does exist, but no dialogs are set - dialog.n_id = n_id - text = "" - else -- file exists and there's already content - local n = 1 - for k, v in pairs(dialog.n_dialogs) do - n = n + 1 - if k == d_id then - count = n - d_sort = v.d_sort or "" - text = v.d_text or "" - end - items = items .. "," .. v.d_id - end - - text = minetest.formspec_escape(text) - end - - local formspec = { - "size[13.4,8.5]", - "label[0.2,0.35;", - dialog.n_id, - "]", - "field[1.3,0.1;3.7,0.5;n_npc;;", - dialog.n_npc, - "]", - "field[5.2,0.1;8,0.5;n_description;;", - dialog.n_description, - "]", - "dropdown[5.2,0.75;5,0.75;d_id;", - items, - ";", - count, - "]", - -- allow to change the owner of the npc - "label[0.2,1;Owner]", - "field[1.3,0.75;3.7,0.5;npc_owner;;", - (yl_speak_up.npc_owner[ n_id ] or "- nobody -"), - "]", - "label[10.9,1;Sort]", - "field[11.7,0.75;1.5,0.5;d_sort;;", - d_sort, - "]", - "textarea[0.2,1.6;13,6;d_text;;", - text, - "]", - "button_exit[0.2,7.7;3,0.75;button_cancel;Cancel]", - "button[4,7.7;3,0.75;button_delete;Delete]", - "button[7.1,7.7;3,0.75;button_option;Options]", - "button[10.2,7.7;3,0.75;button_save;Save]", - -- tooltips - - "tooltip[npc_owner;npc_owner: The name of the owner of the NPC - who can edit dialogs of this NPC if he has the npc_talk_owner priv;#FFFFFF;#000000]", - "tooltip[n_npc;n_npc: The name of the NPC;#FFFFFF;#000000]", - "tooltip[n_description;n_description: A description for the NPC;#FFFFFF;#000000]", - "tooltip[d_sort;d_sort: Make this 0 on your dialog if you want it to be shown the first time a player talks to the NPC\nNegative values are ignored\n;#FFFFFF;#000000]", - "tooltip[5.2,0.75;5,0.75;d_id: Dialog Id;#FFFFFF;#000000]", - "tooltip[d_text;d_text: Dialog text. What the NPC says to you;#FFFFFF;#000000]" - } - - return table.concat(formspec, "") -end - --- options - -yl_speak_up.get_fs_optiondialog = function(player, n_id, d_id, o_id, p_id, r_id) - local dialog = yl_speak_up.load_dialog(n_id, false) - local pname = player:get_player_name() - - if next(dialog) == nil or d_id == yl_speak_up.text_new_dialog_id or dialog.n_dialogs == nil then -- file does not exist or the user sent the New dialog - return yl_speak_up.get_error_message(n_id) - end - - -- default values - local out = {} - - -- npc - out.n_id = n_id - - -- dialog - out.d_id = yl_speak_up.text_new_dialog_id - out.d_text = "Dialog Text" - - -- option - out.o_id_items = yl_speak_up.text_new_option_id - out.o_id_count = 1 - out.o_hide = "false" - out.o_grey = "false" - out.o_sort = "" - out.o_met = "Text when conditions are met" - out.o_not_met = "Text when conditions are not met" - - -- prerequisite - out.p_id_items = yl_speak_up.text_new_prerequisite_id - out.p_id_count = 1 - out.p_type_items, out.p_type_items_table = get_prerequisite_types() - out.p_type_count = 1 - out.p_value = "" - - -- result - out.r_id_items = yl_speak_up.text_new_result_id - out.r_id_count = 1 - out.r_type_items = get_result_types() - out.r_type_count = 1 - out.r_value = "" - - --dialogs - for k, v in pairs(dialog.n_dialogs) do - if k == d_id then - out.d_id = v.d_id - out.d_text = minetest.formspec_escape(v.d_text):trim() - end - end - - --options - if dialog.n_dialogs[d_id].d_options ~= nil then - local o_n = 1 - for o_k, o_v in pairs(dialog.n_dialogs[d_id].d_options) do - o_n = o_n + 1 - if o_k == o_id then - out.o_id_count = o_n - end - out.o_id_items = out.o_id_items .. "," .. o_v.o_id - end - if dialog.n_dialogs[d_id].d_options[o_id] then - if dialog.n_dialogs[d_id].d_options[o_id].o_hide_when_prerequisites_not_met then - out.o_hide = dialog.n_dialogs[d_id].d_options[o_id].o_hide_when_prerequisites_not_met - end - if dialog.n_dialogs[d_id].d_options[o_id].o_grey_when_prerequisites_not_met then - out.o_grey = dialog.n_dialogs[d_id].d_options[o_id].o_grey_when_prerequisites_not_met - end - if dialog.n_dialogs[d_id].d_options[o_id].o_sort then - out.o_sort = dialog.n_dialogs[d_id].d_options[o_id].o_sort - end - if dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_met then - out.o_met = - minetest.formspec_escape(dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_met):trim( - - ) - end - if dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_not_met then - out.o_not_met = - minetest.formspec_escape(dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_not_met):trim( - - ) - end - - -- prerequisite - - --if dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites ~= nil and p_id == yl_speak_up.text_new_prerequisite_id then -- new prerequisite - --end - if dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites ~= nil then - local p_n = 1 - for p_k, p_v in pairs(dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites) do - p_n = p_n + 1 - if p_k == p_id then - out.p_id_count = p_n - end - out.p_id_items = out.p_id_items .. "," .. p_v.p_id - end - - out.p_type_items, out.p_type_items_table = get_prerequisite_types() - - if - dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites[p_id] ~= nil and - dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites[p_id].p_type ~= nil - then - local p_type_n = 1 - for _, p_type_v in pairs(out.p_type_items_table) do - if p_type_v == dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites[p_id].p_type then - out.p_type_count = p_type_n - end - p_type_n = p_type_n + 1 - end - - out.p_value = - minetest.formspec_escape(dialog.n_dialogs[d_id].d_options[o_id].o_prerequisites[p_id].p_value):trim( - - ) - end - end - - -- result - if dialog.n_dialogs[d_id].d_options[o_id].o_results ~= nil then - local r_n = 1 - for r_k, r_v in pairs(dialog.n_dialogs[d_id].d_options[o_id].o_results) do - r_n = r_n + 1 - if r_k == r_id then - out.r_id_count = r_n - end - out.r_id_items = out.r_id_items .. "," .. r_v.r_id - end - - out.r_type_items, out.r_type_items_table = get_result_types() - - if - dialog.n_dialogs[d_id].d_options[o_id].o_results[r_id] ~= nil and - dialog.n_dialogs[d_id].d_options[o_id].o_results[r_id].r_type ~= nil - then - local r_type_n = 1 - for _, r_type_v in pairs(out.r_type_items_table) do - if r_type_v == dialog.n_dialogs[d_id].d_options[o_id].o_results[r_id].r_type then - out.r_type_count = r_type_n - end - r_type_n = r_type_n + 1 - end - - out.r_value = - minetest.formspec_escape(dialog.n_dialogs[d_id].d_options[o_id].o_results[r_id].r_value):trim() - end - end - end - end - - local formspec = { - "size[13.4,8.5]", - -- npc - "field[-10,-10;4,0.5;n_id;;", - out.n_id, - "]", - -- dialog - "field[-10,-10;4,0.5;d_id;;", - out.d_id, - "]", - "label[0.2,0.35;", - out.d_id, - "]", - "field[1,0.1;12.2,0.5;d_text;;", - out.d_text, - "]", - -- option - "dropdown[0.2,0.75;2,0.75;o_id;", - out.o_id_items, - ";", - out.o_id_count, - "]", - "checkbox[0.2,1.85;o_hide;Hide;", - out.o_hide, - "]", - "checkbox[0.2,2.35;o_grey;Grey;", - out.o_grey, - "]", - "field[1.6,2.05;0.75,0.5;o_sort;Sort;", - out.o_sort, - "]", - "textarea[2.4,0.75;10.8,0.95;o_met;;", - out.o_met, - "]", - "textarea[2.4,1.75;10.8,0.95;o_not_met;;", - out.o_not_met, - "]", - -- prerequisite - "dropdown[0.2,2.8;3,0.75;p_id;", - out.p_id_items, - ";", - out.p_id_count, - "]", - "dropdown[0.2,3.8;3,0.75;p_type;", - out.p_type_items, - ";", - out.p_type_count, - "]", - "textarea[3.4,2.8;9.8,2.1;p_value;;", - out.p_value, - "]", - -- result - "dropdown[0.2,5;3,0.75;r_id;", - out.r_id_items, - ";", - out.r_id_count, - "]", - "dropdown[0.2,6;3,0.75;r_type;", - out.r_type_items, - ";", - out.r_type_count, - "]", - "textarea[3.4,5;9.8,2.1;r_value;;", - out.r_value, - "]", - -- buttons - "button[0.2,7.7;3,0.75;button_back;Back]", - "button[7.1,7.7;3,0.75;button_delete;Delete OPTION]", - "button[10.2,7.7;3,0.75;button_save;Save]", - -- tooltips - - "tooltip[d_text;d_text: Dialog text. What the NPC says to you\n\n", - out.d_text, - ";#FFFFFF;#000000]", - "tooltip[0.2,0.75;2,0.75;o_id: Option Id;#FFFFFF;#000000]", - "tooltip[o_met;o_met: Option text when prerequisites are met\n(What you say to the NPC)\n\n", - out.o_met, - ";#FFFFFF;#000000]", - "tooltip[o_not_met;o_not_met: Option text when prerequisites are not met\n(What you say to the NPC instead)\n\n", - out.o_not_met, - ";#FFFFFF;#000000]", - "tooltip[o_hide;o_hide: If checked, this option is hidden when prerequistes are not met;#FFFFFF;#000000]", - "tooltip[o_grey;o_grey: If checked, this option is shown when prerequistes are not met, but grey and not selectable;#FFFFFF;#000000]", - "tooltip[o_sort;o_sort: The lower the number, the higher up in the list this option goes\nNegative values are ignored;#FFFFFF;#000000]", - "tooltip[0.2,2.8;3,0.75;p_id: Prerequisite Id;#FFFFFF;#000000]", - "tooltip[0.2,3.8;3,0.75;p_type: Defines what the p_value stands for.\n\n", - "item: requires the user to have this item in the inventory\n", - "quest: requires the user to have completed a quest with this id\n", - "function: executes the given LUA function which must return true or false. true = prerequisite met\n", - "auto: ???\n", - "delete: Deletes the chosen prerequiste when the dialog is saved", - ";#FFFFFF;#000000]", - "tooltip[p_value;p_value: This is evaluated to decide whether the prerequisites are met or not;#FFFFFF;#000000]", - "tooltip[0.2,5;3,0.75;r_id: Result Id;#FFFFFF;#000000]", - "tooltip[0.2,6;3,0.75;r_type: Defines what the r_value stands for.\n\n", - "dialog: forwards the user to the given dialog d_id\n", - "item: places this item in the inventory of the user\n", - "quest: starts a quest with this id for the user\n", - "function: executes the given LUA function\n", - "auto: automatically forwards the user to the given dialog d_id after a given time\n", - "delete: Deletes the chosen prerequiste when the dialog is saved", - ";#FFFFFF;#000000]", - "tooltip[r_value;r_value: This is what happens when the user chooses this option;#FFFFFF;#000000]" - } - - return table.concat(formspec, "") -end - - --- receive fields - --- options - - -yl_speak_up.input_optiondialog = function(player, formname, fields) - if formname ~= "yl_speak_up:optiondialog" then - return - end - if(not(minetest.check_player_privs(player, {npc_master=true}))) then - return - end - - local pname = player:get_player_name() - local n_id = yl_speak_up.speak_to[pname].n_id - local d_id = yl_speak_up.speak_to[pname].d_id - local dialog = yl_speak_up.speak_to[pname].dialog - - if fields then - -- Button Cancel: Exit the form - if fields.button_back or fields.quit then - local temp_dialog = yl_speak_up.speak_to[pname].dialog - - yl_speak_up.speak_to[pname] = {} - - yl_speak_up.speak_to[pname].dialog = temp_dialog - yl_speak_up.speak_to[pname].n_id = n_id - yl_speak_up.speak_to[pname].d_id = d_id - - yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = d_id}) - return - end - - -- Button Delete Option: Delete option dialog, but do not exit - if fields.button_delete and fields.d_id and fields.o_id ~= yl_speak_up.text_new_option_id then - local temp_dialog = yl_speak_up.speak_to[pname].dialog - - yl_speak_up.speak_to[pname] = {} - - yl_speak_up.speak_to[pname].dialog = temp_dialog - yl_speak_up.speak_to[pname].n_id = n_id - yl_speak_up.speak_to[pname].d_id = d_id - - yl_speak_up.speak_to[pname].o_id = yl_speak_up.text_new_option_id - yl_speak_up.speak_to[pname].p_id = yl_speak_up.text_new_prerequisite_id - yl_speak_up.speak_to[pname].r_id = yl_speak_up.text_new_result_id - - local o_id = yl_speak_up.text_new_option_id - local p_id = yl_speak_up.text_new_prerequisite_id - local r_id = yl_speak_up.text_new_result_id - - delete_option(fields.n_id, fields.d_id, fields.o_id) - yl_speak_up.log_change(pname, n_id, - "(staff) Deleted option "..tostring(fields.o_id).." in dialog "..tostring(fields.d_id)..".") - yl_speak_up.show_fs(player, "optiondialog", - {n_id = n_id, d_id = d_id, o_id = o_id, p_id = p_id, r_id = r_id}) - return - end - - if fields.d_text then - yl_speak_up.speak_to[pname].d_text = fields.d_text - end - if fields.d_type then - yl_speak_up.speak_to[pname].d_type = fields.d_type - end - - -- When a new o_id is chosen, then all the other stuff is invalidated and we need to take values from the dialog or even default values - if fields.o_id ~= nil and fields.o_id ~= yl_speak_up.speak_to[pname].o_id then - local o_id = fields.o_id - yl_speak_up.speak_to[pname].o_id = o_id - yl_speak_up.speak_to[pname].p_id = yl_speak_up.text_new_prerequisite_id - yl_speak_up.speak_to[pname].r_id = yl_speak_up.text_new_result_id - - -- Depends on the dialog - if o_id == yl_speak_up.text_new_option_id then --New dialog - yl_speak_up.speak_to[pname].o_hide = "false" - yl_speak_up.speak_to[pname].o_grey = "false" - yl_speak_up.speak_to[pname].o_sort = "" - yl_speak_up.speak_to[pname].o_met = "Text when conditions are not met" - yl_speak_up.speak_to[pname].o_not_met = "Text when conditions are met" - else -- existing dialog - yl_speak_up.speak_to[pname].o_hide = - dialog.n_dialogs[d_id].d_options[o_id].o_hide_when_prerequisites_not_met or "false" - yl_speak_up.speak_to[pname].o_grey = - dialog.n_dialogs[d_id].d_options[o_id].o_grey_when_prerequisites_not_met or "false" - yl_speak_up.speak_to[pname].o_sort = dialog.n_dialogs[d_id].d_options[o_id].o_sort or "" - yl_speak_up.speak_to[pname].o_met = - dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_not_met or - "Text when conditions are not met" - yl_speak_up.speak_to[pname].o_not_met = - dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_met or - "Text when conditions are met" - end - else - if fields.o_hide then - yl_speak_up.speak_to[pname].o_hide = fields.o_hide - end - if fields.o_grey then - yl_speak_up.speak_to[pname].o_grey = fields.o_grey - end - if fields.o_sort then - yl_speak_up.speak_to[pname].o_sort = fields.o_sort - end - if fields.o_met then - yl_speak_up.speak_to[pname].o_met = fields.o_met - end - if fields.o_not_met then - yl_speak_up.speak_to[pname].o_not_met = fields.o_not_met - end - - if fields.p_id ~= nil and fields.p_id ~= yl_speak_up.speak_to[pname].p_id then - yl_speak_up.speak_to[pname].p_id = fields.p_id - yl_speak_up.speak_to[pname].p_value = fields.p_value - yl_speak_up.speak_to[pname].p_type = fields.p_type - end - if fields.p_value then - yl_speak_up.speak_to[pname].p_value = fields.p_value - end - if fields.p_type then - yl_speak_up.speak_to[pname].p_type = fields.p_type - end - if fields.r_id ~= nil and fields.r_id ~= yl_speak_up.speak_to[pname].r_id then - yl_speak_up.speak_to[pname].r_id = fields.r_id - yl_speak_up.speak_to[pname].r_value = fields.r_value - yl_speak_up.speak_to[pname].r_type = fields.r_type - end - if fields.r_value then - yl_speak_up.speak_to[pname].r_value = fields.r_value - end - if fields.r_type then - yl_speak_up.speak_to[pname].r_type = fields.r_type - end - end - end - - local o_id = fields.o_id or yl_speak_up.speak_to[pname].o_id - local p_id = fields.p_id or yl_speak_up.speak_to[pname].p_id - local r_id = fields.r_id or yl_speak_up.speak_to[pname].r_id - - -- Button Save - if fields and fields.button_save and fields.n_id and fields.d_id then - local temp_dialog = options_to_dialog(pname) - - yl_speak_up.save_dialog(n_id, temp_dialog) - -- TODO: a better change detection would be good - because name, description and owner can change here - yl_speak_up.log_change(pname, n_id, - "(staff) Saved dialog "..tostring(fields.d_id)..".") - - yl_speak_up.show_fs(player, "optiondialog", - {n_id = fields.n_id, d_id = fields.d_id, o_id = fields.o_id, - p_id = fields.p_id, r_id = fields.r_id}) - end - - yl_speak_up.show_fs(player, "optiondialog", - {n_id = n_id, d_id = d_id, o_id = o_id, p_id = p_id, r_id = r_id}) -end - --- dialog - -yl_speak_up.input_setdialog = function(player, formname, fields) - if formname ~= "yl_speak_up:setdialog" then - return - end - if(not(minetest.check_player_privs(player, {npc_master=true}))) then - return - end - - local pname = player:get_player_name() - local n_id = yl_speak_up.speak_to[pname].n_id - local d_id = yl_speak_up.speak_to[pname].d_id or yl_speak_up.text_new_dialog_id - - -- Button Cancel: Exit the form - if fields.button_cancel or fields.quit then - yl_speak_up.speak_to[pname] = nil - minetest.close_formspec(pname, "yl_speak_up:setdialog") - return - end - - -- Button Options with valid d_id: Show options formspec - if fields.button_option and fields.d_id and fields.d_id ~= yl_speak_up.text_new_dialog_id then - local o_id = yl_speak_up.text_new_option_id - local p_id = yl_speak_up.text_new_prerequisite_id - local r_id = yl_speak_up.text_new_result_id - - -- Context - yl_speak_up.speak_to[pname].d_id = fields.d_id - yl_speak_up.speak_to[pname].o_id = o_id - yl_speak_up.speak_to[pname].p_id = p_id - yl_speak_up.speak_to[pname].r_id = r_id - - yl_speak_up.show_fs(player, "optiondialog", - {n_id = n_id, d_id = fields.d_id, o_id = o_id, p_id = p_id, r_id = r_id}) - return - end - - -- Button Options with invalid d_id: Show options formspec - if fields.button_option and fields.d_id and fields.d_id == yl_speak_up.text_new_dialog_id then - yl_speak_up.speak_to[pname].d_id = yl_speak_up.text_new_dialog_id - yl_speak_up.show_fs(player, "msg", {input_to = "yl_speak_up:optiondialog", - formspec = yl_speak_up.get_error_message()}) - return - end - - -- Button Save: Save the settings, but do not exit - if fields.button_save and fields.d_id then - local dialog = yl_speak_up.fields_to_dialog(pname, fields) - yl_speak_up.save_dialog(n_id, dialog) - -- TODO: a better change detection would be great (name, description, owner can be changed as well) - yl_speak_up.log_change(pname, n_id, - "(staff) Saved dialog "..tostring(fields.d_id)..".") - yl_speak_up.speak_to[pname].dialog = dialog - - if yl_speak_up.speak_to[pname].obj then - local obj = yl_speak_up.speak_to[pname].obj - local ent = obj:get_luaentity() - if ent ~= nil then - ent.yl_speak_up.npc_name = dialog.n_npc - ent.yl_speak_up.npc_description = dialog.n_description - ent.owner = dialog.npc_owner - - local i_text = dialog.n_npc .. "\n" .. dialog.n_description .. "\n" .. yl_speak_up.infotext - obj:set_properties({infotext = i_text}) - yl_speak_up.update_nametag(ent) - end - end - - yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = d_id}) - return - end - - -- Button Delete: Delete dialog, but do not exit - if fields.button_delete and fields.d_id then - yl_speak_up.delete_dialog(n_id, fields.d_id) - yl_speak_up.speak_to[pname].d_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 - - -- 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 - yl_speak_up.show_fs(player, "setdialog", {n_id = n_id, d_id = fields.d_id}) - end -end - --- Make the NPC talk - -function yl_speak_up.config(clicker, npc) - if not clicker and not clicker:is_player() then - return - end - if not npc then - return - end - - local npc_id = npc:get_luaentity().yl_speak_up.id - local n_id = "n_" .. npc_id - local pname = clicker:get_player_name() - - yl_speak_up.speak_to[pname] = {} - yl_speak_up.speak_to[pname].n_id = n_id -- Memorize which player talks to which NPC - yl_speak_up.speak_to[pname].d_id = yl_speak_up.text_new_dialog_id -- The only d_id we can rely on existing - yl_speak_up.speak_to[pname].dialog = yl_speak_up.load_dialog(n_id, false) -- Load the dialog and see what we can do with it - yl_speak_up.speak_to[pname].obj = 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 - - yl_speak_up.show_fs(clicker, "setdialog", {n_id = n_id, d_id = yl_speak_up.text_new_dialog_id}) -end - diff --git a/textures/yl_speak_up_staff_of_dawai_dawai.png b/textures/yl_speak_up_staff_of_dawai_dawai.png deleted file mode 100644 index b70f7c650e4e9ad44357df79ae34e1dc6ec3c75f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 264 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=De8Ak0{?)V>TT$X?><>&pIwO-jUEAiatUq)xKLHKN2hKQ}iuuY|$5C^fMpHASI3 zvm`^o-P1Q9ypc~FsHnix#WBR<^wvoiIS(iZI8T0exo^c0QR{$TfdVYu%P%#^XuOwn zxpmBsFDK2*;nI=RNpaZ^HlGXXdd|A%HfO_Pca==f6PC_Fcl|X#<|gxtGk6z$*Ws%7 zoVFmKnd6Ut^NX{w2X*dnggwxTXwB`ff26^m{B~9D9^F!Zpxq3fu6{1-oD!M<&iq;V diff --git a/textures/yl_speak_up_staff_of_fashion.png b/textures/yl_speak_up_staff_of_fashion.png deleted file mode 100644 index 23332e0c625c2f9b28ee0cefe53910c93f4aee3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1240 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 CkzQZ` diff --git a/textures/yl_speak_up_staff_of_shut_up.png b/textures/yl_speak_up_staff_of_shut_up.png deleted file mode 100644 index 790c477fc4d3fa1d38966b772b201b6e6139ca7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1214 zcmV;v1VQ_WP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=HGcH}4whTpY{Spt%{E(dctr+3iHpC61}msBd% zN%fhRF)?5vOF|!Vh1&05o&Lck%$}?Z(I@W>E}LwUj7c>6m1ob!&VD_ZV{#*>b3q_d zjJiKYzvK;afxawxS#~ny?#fVVYhk-x$jgw#<>2tR94YS(%rZ=Q8B$rE?f$&&+cG}I zaJ_}H^!r+$X~0dRvl_%Z&%vU%VnXl<^C-p!_e_VXASP+bYS70K zq3(Ca?a_-S=nPp_)rj6H?~#I*kO`QlBd^b|XOYtp`a*t#^qlc0@+;Cb6M8J@9U*^? z59RDGa=J!3xm|ho{`7n!ukmzolA{A(?=|+`_T6Rcv1PwDb!=tMptp@|&9^*S!0k*N z$sR4CMU+IrIjT5h8(QJS0*sw4SI*qI&9QJnh*p{ej3Pyp3qcqGBS`^TRy!JZ37WJ5 zvS`6^P)OyBg{Rvz-4%{-Tsaa>55pMal^->FMXC2uP|PNtxk6krDh*K#a?E5HY9PXW zCDqLYAMO4cTonY}OmoBrv)P6P;NKiy4wp{Q3Pp!;FJKOJ89<5Wv#>c2{z&k zWv9+M=e!Fpy5zD~KPt@o;Kvs=2Msp3;6n&8q>w3Uw9!Q$LyR%SoFpl}xGtd{Q%ou4 z45t~EGv3Zn$a#}ZH@msbZ()mD+Hw&pT5NH}mr!C!C0D6hQODKSP-9IsH*Ppe%{JG3 z3oW+Pa>r5Y+HH5;_t0Zc)bmMgVg1nlfEq7qGD!`^a8iRbgu?`n&xsq%KujzHco+m& zNn|iHk*$?MZZI=RP!&!Pq#JN54`Lu_8;k3Fvb&ITgwN<(xDi0eJIK*M_X4?(+#XS@ zdH&GpBs9u!B-JRY4@y}g{_uJsxyuB7s~#SV^p^VgOZZ=`k56*&4*VYsJx{_Hdn0*MlKxXeihqO> z{Rt9RMaX5Ik$-0000PbVXQnLvL+uWo~o;Lvm$dbY)~9cWHEJAV*0}P*;Ht z7XSbNXh}ptR5;7El0gc? z(0lhMBQSbIl9q(l8YGSVS}Oqnw!;O$k~}@j!f%o-DAgbX|I;9Q^Hi`3KLk7Q5bVOX c