Swtich from tables to textareas for text display
This commit is contained in:
parent
7b103e1f25
commit
0bc9d897b5
@ -58,6 +58,14 @@ if(read==false) then
|
|||||||
tutorial.state.last_diamond = false
|
tutorial.state.last_diamond = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function text_box(caption, text)
|
||||||
|
return "label[0,-0.3;"..minetest.formspec_escape(S(caption)).."]"..
|
||||||
|
"box[-0.05,0.25;12,5.2;#000000FF]"..
|
||||||
|
"textarea[0.35,0.35;12,5.75;;;"..
|
||||||
|
minetest.formspec_escape(S(text))..
|
||||||
|
"]"
|
||||||
|
end
|
||||||
|
|
||||||
function tutorial.register_infosign(itemstringpart, caption, fulltext)
|
function tutorial.register_infosign(itemstringpart, caption, fulltext)
|
||||||
tutorial.captions[itemstringpart] = caption
|
tutorial.captions[itemstringpart] = caption
|
||||||
minetest.register_node("tutorial:sign_"..itemstringpart, {
|
minetest.register_node("tutorial:sign_"..itemstringpart, {
|
||||||
@ -80,9 +88,8 @@ function tutorial.register_infosign(itemstringpart, caption, fulltext)
|
|||||||
local formspec = ""..
|
local formspec = ""..
|
||||||
"size[12,6]"..
|
"size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(S(caption)).."]"..
|
"label[-0.15,-0.4;"..minetest.formspec_escape(S(caption)).."]"..
|
||||||
"tablecolumns[text]"..
|
"box[-0.05,0.25;12,5.7;#000000FF]"..
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
"textarea[0.35,0.35;12,5.7;;;"..
|
||||||
"table[0,0.25;12,5.2;infosign_text;"..
|
|
||||||
minetest.formspec_escape(S(fulltext))..
|
minetest.formspec_escape(S(fulltext))..
|
||||||
"]"..
|
"]"..
|
||||||
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
|
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
|
||||||
@ -107,12 +114,7 @@ minetest.register_abm( {
|
|||||||
end
|
end
|
||||||
local formspec = ""..
|
local formspec = ""..
|
||||||
"size[12,6]"..
|
"size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(S(caption)).."]"..
|
text_box(caption, tutorial.texts[id])..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;infosign_text;"..
|
|
||||||
minetest.formspec_escape(S(tutorial.texts[id]))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
|
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
meta:set_string("infotext", S("@1 (Right-click to read)", S(caption)))
|
meta:set_string("infotext", S("@1 (Right-click to read)", S(caption)))
|
||||||
@ -1329,12 +1331,7 @@ minetest.register_abm({
|
|||||||
]]
|
]]
|
||||||
function tutorial.show_default_dialog(name, caption, text)
|
function tutorial.show_default_dialog(name, caption, text)
|
||||||
local formspec = "size[12,6]"..
|
local formspec = "size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(caption).."]"..
|
text_box(caption, text)..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;text_table;"..
|
|
||||||
minetest.formspec_escape(S(text))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[4.5,5.5;3,1;close;"..S("Close").."]"
|
"button_exit[4.5,5.5;3,1;close;"..S("Close").."]"
|
||||||
minetest.show_formspec(name, "tutorial_dialog", formspec)
|
minetest.show_formspec(name, "tutorial_dialog", formspec)
|
||||||
end
|
end
|
||||||
@ -1343,33 +1340,18 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
local formspec = nil
|
local formspec = nil
|
||||||
if(minetest.is_singleplayer() == false) then
|
if(minetest.is_singleplayer() == false) then
|
||||||
formspec = "size[12,6]"..
|
formspec = "size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(S("Warning: You're not playing in singleplayer mode")).."]"..
|
text_box(NS("Warning: You're not playing in singleplayer mode"), tutorial.texts.notsingleplayer)..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;creative_text;"..
|
|
||||||
minetest.formspec_escape(S(tutorial.texts.notsingleplayer))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue anyways")).."]"..
|
"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")).."]"
|
"button_exit[6.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"
|
||||||
elseif(not map_editing and minetest.settings:get_bool("creative_mode")) then
|
elseif(not map_editing and minetest.settings:get_bool("creative_mode")) then
|
||||||
formspec = "size[12,6]"..
|
formspec = "size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..(minetest.formspec_escape(S("Warning: Creative mode is active"))).."]"..
|
text_box(NS("Warning: Creative mode is active"), tutorial.texts.creative)..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;creative_text;"..
|
|
||||||
minetest.formspec_escape(S(tutorial.texts.creative))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue anyways")).."]"..
|
"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")).."]"
|
"button_exit[6.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"
|
||||||
|
|
||||||
elseif(not map_editing and tutorial.state.intro_text == false) then
|
elseif(not map_editing and tutorial.state.intro_text == false) then
|
||||||
formspec = "size[12,6]"..
|
formspec = "size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(S("Introduction")).."]"..
|
text_box(NS("Introduction"), tutorial.texts.intro)..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;intro_text;"..
|
|
||||||
minetest.formspec_escape(S(tutorial.texts.intro))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
|
"button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
|
||||||
tutorial.state.intro_text = true
|
tutorial.state.intro_text = true
|
||||||
end
|
end
|
||||||
@ -1454,7 +1436,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
if(inv:contains_item("main", gold_stack)) then
|
if(inv:contains_item("main", gold_stack)) then
|
||||||
tutorial.show_default_dialog(
|
tutorial.show_default_dialog(
|
||||||
name,
|
name,
|
||||||
S("Gold ingots in the tutorial"),
|
NS("Gold ingots in the tutorial"),
|
||||||
tutorial.texts.first_gold
|
tutorial.texts.first_gold
|
||||||
)
|
)
|
||||||
tutorial.state.first_gold = true
|
tutorial.state.first_gold = true
|
||||||
@ -1465,12 +1447,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
local gold_stack = ItemStack("tutorial_default:gold_ingot "..tostring(tutorial.gold))
|
local gold_stack = ItemStack("tutorial_default:gold_ingot "..tostring(tutorial.gold))
|
||||||
if(inv:contains_item("main", gold_stack)) then
|
if(inv:contains_item("main", gold_stack)) then
|
||||||
local formspec = "size[12,6]"..
|
local formspec = "size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(S("You've finished the tutorial!")).."]"..
|
text_box(NS("You've finished the tutorial!"), tutorial.texts.last_gold)..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;creative_text;"..
|
|
||||||
minetest.formspec_escape(S(tutorial.texts.last_gold))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[0.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue")).."]"..
|
"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")).."]"..
|
"button_exit[4.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"..
|
||||||
"button_exit[8.5,5.5;3,1;gotoend;"..minetest.formspec_escape(S("Go to Good-Bye room")).."]"
|
"button_exit[8.5,5.5;3,1;gotoend;"..minetest.formspec_escape(S("Go to Good-Bye room")).."]"
|
||||||
@ -1488,7 +1465,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
if(inv:contains_item("main", diamond_stack)) then
|
if(inv:contains_item("main", diamond_stack)) then
|
||||||
tutorial.show_default_dialog(
|
tutorial.show_default_dialog(
|
||||||
name,
|
name,
|
||||||
S("You found a hidden diamond!"),
|
NS("You found a hidden diamond!"),
|
||||||
tutorial.texts.first_diamond
|
tutorial.texts.first_diamond
|
||||||
)
|
)
|
||||||
tutorial.state.first_diamond = true
|
tutorial.state.first_diamond = true
|
||||||
@ -1499,12 +1476,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
local diamond_stack = ItemStack("tutorial_default:diamond "..tostring(tutorial.diamonds))
|
local diamond_stack = ItemStack("tutorial_default:diamond "..tostring(tutorial.diamonds))
|
||||||
if(inv:contains_item("main", diamond_stack)) then
|
if(inv:contains_item("main", diamond_stack)) then
|
||||||
local formspec = "size[12,6]"..
|
local formspec = "size[12,6]"..
|
||||||
"label[-0.15,-0.4;"..minetest.formspec_escape(S("You have collected all hidden diamonds!")).."]"..
|
text_box(NS("You have collected all hidden diamonds!"), tutorial.texts.last_diamond)..
|
||||||
"tablecolumns[text]"..
|
|
||||||
"tableoptions[background=#000000;highlight=#000000;border=false]"..
|
|
||||||
"table[0,0.25;12,5.2;last_diamond_text;"..
|
|
||||||
minetest.formspec_escape(S(tutorial.texts.last_diamond))..
|
|
||||||
"]"..
|
|
||||||
"button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue")).."]"..
|
"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")).."]"
|
"button_exit[6.5,5.5;3,1;gotoend;"..minetest.formspec_escape(S("Go to Good-Bye room")).."]"
|
||||||
minetest.show_formspec(name, "tutorial_last_diamond", formspec)
|
minetest.show_formspec(name, "tutorial_last_diamond", formspec)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user