forked from Sokomine/yl_speak_up
load_dialog is no longer a local function
This commit is contained in:
parent
cb49d9cfe2
commit
1b28dd6a07
@ -157,7 +157,7 @@ yl_speak_up.save_dialog = function(n_id, dialog)
|
||||
end
|
||||
|
||||
|
||||
local function load_dialog(n_id) -- returns the saved dialog
|
||||
yl_speak_up.load_dialog = function(n_id) -- returns the saved dialog
|
||||
local p = save_path(n_id)
|
||||
|
||||
local file, err = io.open(p, "r")
|
||||
@ -179,7 +179,7 @@ end
|
||||
-- used by staff and input_inital_config
|
||||
yl_speak_up.fields_to_dialog = function(pname, fields)
|
||||
local n_id = yl_speak_up.speak_to[pname].n_id
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
local save_d_id = ""
|
||||
|
||||
if next(dialog) == nil then -- No file found. Let's create the basic values
|
||||
@ -326,7 +326,7 @@ local function delete_dialog(n_id, d_id)
|
||||
return false
|
||||
end -- We don't delete "New dialog"
|
||||
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
|
||||
dialog.n_dialogs[d_id] = nil
|
||||
|
||||
@ -341,7 +341,7 @@ local function delete_option(n_id, d_id, o_id)
|
||||
return false
|
||||
end -- We don't delete "New option"
|
||||
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
|
||||
dialog.n_dialogs[d_id].d_options[o_id] = nil
|
||||
|
||||
@ -387,7 +387,7 @@ end
|
||||
-- dialog
|
||||
|
||||
yl_speak_up.get_fs_setdialog = function(clicker, n_id, d_id)
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
|
||||
local items = yl_speak_up.text_new_dialog_id
|
||||
local count = 1
|
||||
@ -465,7 +465,7 @@ end
|
||||
-- options
|
||||
|
||||
yl_speak_up.get_fs_optiondialog = function(player, n_id, d_id, o_id, p_id, r_id)
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
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
|
||||
@ -1766,7 +1766,7 @@ yl_speak_up.save_changes_and_switch_to_other_dialog = function(player, fields, t
|
||||
-- if we just reload the old state, they would both get lost
|
||||
local target_dialog_data = yl_speak_up.speak_to[pname].dialog.n_dialogs[ target_dialog ]
|
||||
-- actually restore the old state and discard the changes by loading the dialog anew
|
||||
yl_speak_up.speak_to[pname].dialog = load_dialog(n_id)
|
||||
yl_speak_up.speak_to[pname].dialog = yl_speak_up.load_dialog(n_id)
|
||||
-- clear list of changes
|
||||
yl_speak_up.npc_was_changed[ n_id ] = {}
|
||||
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||
@ -2291,7 +2291,7 @@ end
|
||||
-- identify multiple results that lead to target dialogs
|
||||
yl_speak_up.check_for_disambigous_results = function(n_id, pname)
|
||||
local errors_found = false
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
-- nothing defined yet - nothing to repair
|
||||
if(not(dialog.n_dialogs)) then
|
||||
return
|
||||
@ -2564,7 +2564,7 @@ function yl_speak_up.config(clicker, npc)
|
||||
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 = load_dialog(n_id) -- Load the dialog and see what we can do with it
|
||||
yl_speak_up.speak_to[pname].dialog = yl_speak_up.load_dialog(n_id) -- 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
|
||||
@ -2706,7 +2706,7 @@ function yl_speak_up.talk(self, clicker)
|
||||
|
||||
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].dialog = load_dialog(n_id) -- Load the dialog and see what we can do with it
|
||||
yl_speak_up.speak_to[pname].dialog = yl_speak_up.load_dialog(n_id) -- Load the dialog and see what we can do with it
|
||||
yl_speak_up.speak_to[pname].textures = self.yl_speak_up.textures
|
||||
yl_speak_up.speak_to[pname].option_index = 1
|
||||
yl_speak_up.speak_to[pname].obj = self.object
|
||||
@ -3048,7 +3048,7 @@ function yl_speak_up.fashion(player, obj)
|
||||
yl_speak_up.speak_to[pname].textures = t
|
||||
yl_speak_up.speak_to[pname].skins = textures2skin(t)
|
||||
|
||||
local dialog = load_dialog(n_id)
|
||||
local dialog = yl_speak_up.load_dialog(n_id)
|
||||
if next(dialog) then
|
||||
yl_speak_up.speak_to[pname].n_npc = dialog.n_npc
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user