moved talk to yl_speak_up.show_fs
This commit is contained in:
parent
4c9c66e7c1
commit
cf145bb07d
@ -1800,6 +1800,10 @@ yl_speak_up.show_fs = function(player, fs_name, param)
|
|||||||
local pname = player:get_player_name()
|
local pname = player:get_player_name()
|
||||||
|
|
||||||
if(fs_name == "TODO") then
|
if(fs_name == "TODO") then
|
||||||
|
elseif(fs_name == "talk") then
|
||||||
|
minetest.show_formspec(pname, "yl_speak_up:talk",
|
||||||
|
yl_speak_up.get_fs_talkdialog(player, param.n_id, param.d_id))
|
||||||
|
|
||||||
elseif(fs_name == "fashion") then
|
elseif(fs_name == "fashion") then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:fashion",
|
minetest.show_formspec(pname, "yl_speak_up:fashion",
|
||||||
yl_speak_up.get_fs_fashion(pname))
|
yl_speak_up.get_fs_fashion(pname))
|
||||||
@ -1850,8 +1854,7 @@ yl_speak_up.input_inventory = function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- ..and go back to the normal talk formspec
|
-- ..and go back to the normal talk formspec
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2194,8 +2197,7 @@ yl_speak_up.save_changes_and_switch_to_other_dialog = function(player, fields, t
|
|||||||
-- the player decided to go back and continue editing the current dialog
|
-- the player decided to go back and continue editing the current dialog
|
||||||
if(edit_mode and fields.back_to_dialog_changes) then
|
if(edit_mode and fields.back_to_dialog_changes) then
|
||||||
-- do NOT clear the list of changes; just show the old dialog again
|
-- do NOT clear the list of changes; just show the old dialog again
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
-- save changes and continue on to the next dialog
|
-- save changes and continue on to the next dialog
|
||||||
@ -2303,8 +2305,7 @@ yl_speak_up.save_changes_and_switch_to_other_dialog = function(player, fields, t
|
|||||||
end
|
end
|
||||||
-- move on to the target dialog
|
-- move on to the target dialog
|
||||||
yl_speak_up.speak_to[pname].d_id = target_dialog
|
yl_speak_up.speak_to[pname].d_id = target_dialog
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = target_dialog})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, target_dialog))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2735,8 +2736,7 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
|
|||||||
-- back to the main dialog window?
|
-- back to the main dialog window?
|
||||||
-- (this also happens when the last option was deleted)
|
-- (this also happens when the last option was deleted)
|
||||||
if(fields.show_current_dialog or fields.quit or fields.button_exit or not(d_option) or fields.del_option) then
|
if(fields.show_current_dialog or fields.quit or fields.button_exit or not(d_option) or fields.del_option) then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2793,8 +2793,7 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
|
|||||||
|
|
||||||
-- if ESC is pressed or anything else unpredicted happens: go back to the main dialog edit window
|
-- if ESC is pressed or anything else unpredicted happens: go back to the main dialog edit window
|
||||||
-- reason: don't loose any unsaved changes to the dialog
|
-- reason: don't loose any unsaved changes to the dialog
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2922,8 +2921,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- actually start a chat with our new npc
|
-- actually start a chat with our new npc
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2976,8 +2974,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
yl_speak_up.edit_mode[pname] = yl_speak_up.speak_to[pname].n_id
|
yl_speak_up.edit_mode[pname] = yl_speak_up.speak_to[pname].n_id
|
||||||
-- start a new chat - but this time in edit mode
|
-- start a new chat - but this time in edit mode
|
||||||
yl_speak_up.speak_to[pname].d_id = nil
|
yl_speak_up.speak_to[pname].d_id = nil
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = yl_speak_up.speak_to[pname].n_id, d_id = nil})
|
||||||
yl_speak_up.get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id, nil))
|
|
||||||
return
|
return
|
||||||
-- end edit mode (does not require the priv; will only switch back to normal behaviour)
|
-- end edit mode (does not require the priv; will only switch back to normal behaviour)
|
||||||
elseif fields.button_end_edit_mode then
|
elseif fields.button_end_edit_mode then
|
||||||
@ -2995,11 +2992,8 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
if fields.button_up then
|
if fields.button_up then
|
||||||
yl_speak_up.speak_to[pname].option_index =
|
yl_speak_up.speak_to[pname].option_index =
|
||||||
yl_speak_up.speak_to[pname].option_index + yl_speak_up.max_number_of_buttons
|
yl_speak_up.speak_to[pname].option_index + yl_speak_up.max_number_of_buttons
|
||||||
minetest.show_formspec(
|
yl_speak_up.show_fs(player, "talk", {n_id = yl_speak_up.speak_to[pname].n_id,
|
||||||
pname,
|
d_id = yl_speak_up.speak_to[pname].d_id})
|
||||||
"yl_speak_up:talk",
|
|
||||||
yl_speak_up.get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id, yl_speak_up.speak_to[pname].d_id)
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
elseif fields.button_down then --and yl_speak_up.speak_to[pname].option_index > yl_speak_up.max_number_of_buttons then
|
elseif fields.button_down then --and yl_speak_up.speak_to[pname].option_index > yl_speak_up.max_number_of_buttons then
|
||||||
yl_speak_up.speak_to[pname].option_index =
|
yl_speak_up.speak_to[pname].option_index =
|
||||||
@ -3007,11 +3001,8 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
if yl_speak_up.speak_to[pname].option_index < 0 then
|
if yl_speak_up.speak_to[pname].option_index < 0 then
|
||||||
yl_speak_up.speak_to[pname].option_index = 1
|
yl_speak_up.speak_to[pname].option_index = 1
|
||||||
end
|
end
|
||||||
minetest.show_formspec(
|
yl_speak_up.show_fs(player, "talk", {n_id = yl_speak_up.speak_to[pname].n_id,
|
||||||
pname,
|
d_id = yl_speak_up.speak_to[pname].d_id})
|
||||||
"yl_speak_up:talk",
|
|
||||||
yl_speak_up.get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id, yl_speak_up.speak_to[pname].d_id)
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
yl_speak_up.speak_to[pname].option_index = 1
|
yl_speak_up.speak_to[pname].option_index = 1
|
||||||
@ -3097,8 +3088,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
yl_speak_up.save_changes_and_switch_to_other_dialog(player, fields, show_dialog)
|
yl_speak_up.save_changes_and_switch_to_other_dialog(player, fields, show_dialog)
|
||||||
-- show the same dialog again
|
-- show the same dialog again
|
||||||
else
|
else
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
end
|
end
|
||||||
-- no option was selected - so we need to end this here
|
-- no option was selected - so we need to end this here
|
||||||
return
|
return
|
||||||
@ -3437,9 +3427,7 @@ function yl_speak_up.talk(self, clicker)
|
|||||||
yl_speak_up.speak_to[pname].option_index = 1
|
yl_speak_up.speak_to[pname].option_index = 1
|
||||||
yl_speak_up.speak_to[pname].obj = self.object
|
yl_speak_up.speak_to[pname].obj = self.object
|
||||||
|
|
||||||
|
yl_speak_up.show_fs(clicker, "talk", {n_id = n_id})
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
|
||||||
yl_speak_up.get_fs_talkdialog(clicker, n_id))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ###
|
-- ###
|
||||||
@ -3691,8 +3679,8 @@ yl_speak_up.input_fashion = function(player, formname, fields)
|
|||||||
-- is the player editing this npc? then we need to go back to the edit menu
|
-- is the player editing this npc? then we need to go back to the edit menu
|
||||||
if( yl_speak_up.edit_mode[pname]
|
if( yl_speak_up.edit_mode[pname]
|
||||||
and yl_speak_up.edit_mode[pname] == yl_speak_up.speak_to[pname].n_id) then
|
and yl_speak_up.edit_mode[pname] == yl_speak_up.speak_to[pname].n_id) then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = yl_speak_up.speak_to[pname].n_id,
|
||||||
yl_speak_up.get_fs_talkdialog(player, yl_speak_up.speak_to[pname].n_id, yl_speak_up.speak_to[pname].d_id))
|
d_id = yl_speak_up.speak_to[pname].d_id})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
yl_speak_up.speak_to[pname] = nil
|
yl_speak_up.speak_to[pname] = nil
|
||||||
|
@ -21,8 +21,7 @@ yl_speak_up.input_trade_list = function(player, formname, fields)
|
|||||||
|
|
||||||
-- go back to the main dialog
|
-- go back to the main dialog
|
||||||
if(fields.finished_trading) then
|
if(fields.finished_trading) then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = d_id})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, d_id))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -126,8 +126,7 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
-- show either the current or the target dialog
|
-- show either the current or the target dialog
|
||||||
elseif(target_dialog) then
|
elseif(target_dialog) then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:talk",
|
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = target_dialog})
|
||||||
yl_speak_up.get_fs_talkdialog(player, n_id, target_dialog))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user