Remove newline converter in tutorial mod

This commit is contained in:
Wuzzy 2024-11-27 13:37:07 +01:00
parent 2581923fbd
commit 7b103e1f25

View File

@ -58,20 +58,6 @@ if(read==false) then
tutorial.state.last_diamond = false
end
function tutorial.convert_newlines(str)
if(type(str)~="string") then
return "ERROR: No string found!"
end
local function convert(s)
return s:gsub("\n", function(slash, what)
return ","
end)
end
return convert(str)
end
function tutorial.register_infosign(itemstringpart, caption, fulltext)
tutorial.captions[itemstringpart] = caption
minetest.register_node("tutorial:sign_"..itemstringpart, {
@ -97,7 +83,7 @@ function tutorial.register_infosign(itemstringpart, caption, fulltext)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;infosign_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(fulltext)))..
minetest.formspec_escape(S(fulltext))..
"]"..
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
meta:set_string("formspec", formspec)
@ -125,7 +111,7 @@ minetest.register_abm( {
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;infosign_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts[id])))..
minetest.formspec_escape(S(tutorial.texts[id]))..
"]"..
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
meta:set_string("formspec", formspec)
@ -1347,7 +1333,7 @@ function tutorial.show_default_dialog(name, caption, text)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;text_table;"..
tutorial.convert_newlines(minetest.formspec_escape(S(text)))..
minetest.formspec_escape(S(text))..
"]"..
"button_exit[4.5,5.5;3,1;close;"..S("Close").."]"
minetest.show_formspec(name, "tutorial_dialog", formspec)
@ -1361,7 +1347,7 @@ minetest.register_on_joinplayer(function(player)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;creative_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.notsingleplayer)))..
minetest.formspec_escape(S(tutorial.texts.notsingleplayer))..
"]"..
"button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue anyways")).."]"..
"button_exit[6.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"
@ -1371,7 +1357,7 @@ minetest.register_on_joinplayer(function(player)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;creative_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.creative)))..
minetest.formspec_escape(S(tutorial.texts.creative))..
"]"..
"button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue anyways")).."]"..
"button_exit[6.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"
@ -1382,7 +1368,7 @@ minetest.register_on_joinplayer(function(player)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;intro_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.intro)))..
minetest.formspec_escape(S(tutorial.texts.intro))..
"]"..
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
tutorial.state.intro_text = true
@ -1483,7 +1469,7 @@ minetest.register_globalstep(function(dtime)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;creative_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.last_gold)))..
minetest.formspec_escape(S(tutorial.texts.last_gold))..
"]"..
"button_exit[0.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue")).."]"..
"button_exit[4.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"..
@ -1517,7 +1503,7 @@ minetest.register_globalstep(function(dtime)
"tablecolumns[text]"..
"tableoptions[background=#000000;highlight=#000000;border=false]"..
"table[0,0.25;12,5.2;last_diamond_text;"..
tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.last_diamond)))..
minetest.formspec_escape(S(tutorial.texts.last_diamond))..
"]"..
"button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue")).."]"..
"button_exit[6.5,5.5;3,1;gotoend;"..minetest.formspec_escape(S("Go to Good-Bye room")).."]"