forked from your-land-mirror/yl_speak_up
add d_end in migration script when necessary
This commit is contained in:
parent
56b832d9d1
commit
bd67fa2ea7
@ -79,20 +79,33 @@ yl_speak_up.check_one_npc_for_migration = function(dialog, pname, n_id)
|
||||
-- sometimes we need d_end because minetest.close_formspec in
|
||||
-- an effect of type "function" is not enough
|
||||
elseif(has_close_formspec) then
|
||||
local found = false
|
||||
local d_old = ""
|
||||
for r_id, r in pairs(o.o_results) do
|
||||
if(r.r_type == "dialog" and r.r_value ~= "d_end") then
|
||||
if(r.r_type == "dialog" and not(found)) then
|
||||
d_old = r.r_value
|
||||
r.r_value = "d_end"
|
||||
found = true
|
||||
end
|
||||
end
|
||||
yl_speak_up.save_dialog(n_id, dialog)
|
||||
local msg = "ERROR: Dialog "..
|
||||
tostring(d_id)..", option "..tostring(o_id)..
|
||||
", uses minetest.close_formspec in its lua code "..
|
||||
"but "..tostring(d_old).." instead of d_end as "..
|
||||
"target dialog. Fixing."
|
||||
minetest.chat_send_player(pname, msg)
|
||||
-- if there is no dialog option yet: create one
|
||||
if(not(found)) then
|
||||
local future_r_id = yl_speak_up.add_new_result(
|
||||
dialog, d_id, o_id)
|
||||
o.o_results[future_r_id] = {
|
||||
r_id = future_r_id,
|
||||
r_type = "dialog",
|
||||
r_value = "d_end"}
|
||||
end
|
||||
if(d_old ~= "d_end") then
|
||||
yl_speak_up.save_dialog(n_id, dialog)
|
||||
local msg = "ERROR: Dialog "..
|
||||
tostring(d_id)..", option "..tostring(o_id)..
|
||||
", uses minetest.close_formspec in its "..
|
||||
"lua code but "..tostring(d_old)..
|
||||
" instead of d_end as target dialog. Fixing."
|
||||
minetest.chat_send_player(pname, msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
if(o_id and o and o.o_prerequisites) then
|
||||
|
Loading…
Reference in New Issue
Block a user