show correct dialog when the player uses an older formspec version; note: does not cover editing
This commit is contained in:
parent
7a0c442508
commit
be9dfbf1dd
@ -815,6 +815,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text)
|
||||
if(yl_speak_up.npc_owner[ n_id ]) then
|
||||
owner_info = "\n\n(owned by "..minetest.formspec_escape(yl_speak_up.npc_owner[ n_id ])..")"
|
||||
end
|
||||
|
||||
if formspec_v >= 4 then
|
||||
formspec = {
|
||||
"formspec_version[3]",
|
||||
@ -1234,6 +1235,9 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text)
|
||||
table.insert(formspec, "scroll_container_end[]")
|
||||
|
||||
table.insert(formspec, "container_end[]")
|
||||
|
||||
-- if the player has an older formspec version
|
||||
-- TODO: the version for older formspec versions lacks quite a lot - in particular regarding editing
|
||||
else
|
||||
minetest.log(
|
||||
"info",
|
||||
@ -1254,6 +1258,12 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text)
|
||||
upgrade_warning = table.concat(warn, "")
|
||||
end
|
||||
|
||||
if(alternate_text) then
|
||||
alternate_text = string.gsub(alternate_text, "%$TEXT%$", active_dialog.d_text)
|
||||
end
|
||||
-- replace $NPC_NAME$ etc.
|
||||
local t = minetest.formspec_escape(yl_speak_up.replace_vars_in_text(
|
||||
(alternate_text or active_dialog.d_text), dialog, pname))
|
||||
formspec = {
|
||||
"formspec_version[1]",
|
||||
"size[48,28]",
|
||||
@ -1303,7 +1313,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text)
|
||||
portrait,
|
||||
"]",
|
||||
"textarea[0.5,5;19.6,13.5;;;",
|
||||
minetest.formspec_escape(active_dialog.d_text) .. "\n",
|
||||
t .. "\n",
|
||||
"]",
|
||||
"container[0,18]"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user