From 4c9c66e7c11e622e1535371f60a4a44e82056625 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Mon, 31 May 2021 21:35:50 +0200 Subject: [PATCH] moved frashion to yl_speak_up.show_fs --- functions.lua | 28 +++++++++++++++++----------- trade_list.lua | 3 +-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/functions.lua b/functions.lua index 0442338..80d06e4 100644 --- a/functions.lua +++ b/functions.lua @@ -1799,9 +1799,17 @@ yl_speak_up.show_fs = function(player, fs_name, param) end local pname = player:get_player_name() - if(fs_name == "trade_list") then - minetest.show_formspec(pname, - "yl_speak_up:trade_list", + if(fs_name == "TODO") then + elseif(fs_name == "fashion") then + minetest.show_formspec(pname, "yl_speak_up:fashion", + yl_speak_up.get_fs_fashion(pname)) + + elseif(fs_name == "inventory") then + minetest.show_formspec(pname, "yl_speak_up:inventory", + yl_speak_up.get_fs_inventory(player)) + + elseif(fs_name == "trade_list") then + minetest.show_formspec(pname, "yl_speak_up:trade_list", yl_speak_up.get_fs_trade_list(player)) elseif(fs_name == "trade_simple") then @@ -1809,8 +1817,7 @@ yl_speak_up.show_fs = function(player, fs_name, param) if(not(param) and yl_speak_up.speak_to[pname]) then param = yl_speak_up.speak_to[pname].trade_id end - minetest.show_formspec(pname, - "yl_speak_up:do_trade_simple", + minetest.show_formspec(pname, "yl_speak_up:do_trade_simple", yl_speak_up.get_fs_trade_simple(player, param)) elseif(fs_name == "add_trade_simple") then @@ -1818,8 +1825,7 @@ yl_speak_up.show_fs = function(player, fs_name, param) if(not(param) and yl_speak_up.speak_to[pname]) then param = yl_speak_up.speak_to[pname].trade_id end - minetest.show_formspec(pname, - "yl_speak_up:add_trade_simple", + minetest.show_formspec(pname, "yl_speak_up:add_trade_simple", yl_speak_up.get_fs_add_trade_simple(player, param)) -- fallback in case of wrong call else @@ -2939,7 +2945,7 @@ yl_speak_up.input_talk = function(player, formname, fields) -- the player wants to access the inventory of the NPC if(edit_mode and fields.show_inventory) then -- the inventory is just an inventory with a back button; come back to this dialog here - minetest.show_formspec(pname, "yl_speak_up:inventory", yl_speak_up.get_fs_inventory(player)) + yl_speak_up.show_fs(player, "inventory") return end @@ -2948,7 +2954,7 @@ yl_speak_up.input_talk = function(player, formname, fields) local dialog = yl_speak_up.speak_to[pname].dialog -- necessary so that the fashin formspec can be created yl_speak_up.speak_to[pname].n_npc = dialog.n_npc - minetest.show_formspec(pname, "yl_speak_up:fashion", yl_speak_up.get_fs_fashion(pname)) + yl_speak_up.show_fs(player, "fashion") return end @@ -3748,7 +3754,7 @@ yl_speak_up.input_fashion = function(player, formname, fields) --yl_speak_up.speak_to[pname].textures = textures end - minetest.show_formspec(pname, "yl_speak_up:fashion", yl_speak_up.get_fs_fashion(pname)) + yl_speak_up.show_fs(player, "fashion") end function yl_speak_up.fashion(player, obj) @@ -3772,7 +3778,7 @@ function yl_speak_up.fashion(player, obj) yl_speak_up.speak_to[pname].n_npc = "Unknown" end - minetest.show_formspec(pname, "yl_speak_up:fashion", yl_speak_up.get_fs_fashion(pname)) + yl_speak_up.show_fs(player, "fashion") end diff --git a/trade_list.lua b/trade_list.lua index c7c9009..3f89a3a 100644 --- a/trade_list.lua +++ b/trade_list.lua @@ -36,8 +36,7 @@ yl_speak_up.input_trade_list = function(player, formname, fields) -- show the inventory of the NPC if(fields.show_inventory) then - minetest.show_formspec(pname, "yl_speak_up:inventory", - yl_speak_up.get_fs_inventory(player)) + yl_speak_up.show_fs(player, "inventory") return end -- TODO: and otherwise?