Fix basic_end message
[minetest_tutorial_subgame.git] / mods / tutorial / init.lua
blob057c7d2aa3edaf343e116d6ad402eca38c783ad5
1 tutorial = {}
3 -- intllib support
4 local S
5 if (minetest.get_modpath("intllib")) then
6 dofile(minetest.get_modpath("intllib").."/intllib.lua")
7 S = intllib.Getter(minetest.get_current_modname())
8 else
9 S = function ( s ) return s end
10 end
12 -- Saves tutorial state into file
13 function tutorial.save_state()
14 local str = minetest.serialize(tutorial.state)
15 local filepath = minetest.get_worldpath().."/tutorialdata.mt"
16 local file = io.open(filepath, "w")
17 if(file) then
18 file:write(str)
19 minetest.log("action", "[tutorial] Tutorial state has been written into "..filepath..".")
20 else
21 minetest.log("error", "[tutorial] An attempt to save the tutorial state into "..filepath.." failed.")
22 end
23 end
26 -- load tutorial state from file
28 local filepath = minetest.get_worldpath().."/tutorialdata.mt"
29 local file = io.open(filepath, "r")
30 local read = false
31 if file then
32 local string = file:read()
33 io.close(file)
34 if(string ~= nil) then
35 tutorial.state = minetest.deserialize(string)
36 minetest.log("action", "[tutorial] Tutorial state has been read from "..filepath..".")
37 read = true
38 end
39 end
40 if(read==false) then
41 tutorial.state = {}
43 -- Is this the first time the player joins this tutorial?
44 tutorial.state.first_join = true
45 -- These variables store wheather a message for those events has been shown yet.
46 tutorial.state.first_gold = false
47 tutorial.state.last_gold = false
48 tutorial.state.first_diamond = false
49 tutorial.state.last_diamond = false
50 end
52 function tutorial.convert_newlines(str)
53 if(type(str)~="string") then
54 return "ERROR: No string found!"
55 end
57 local function convert(s)
58 return s:gsub("\n", function(slash, what)
59 return ","
60 end)
61 end
63 return convert(str)
64 end
66 function tutorial.register_infosign(itemstringpart, caption, fulltext)
67 minetest.register_node("tutorial:sign_"..itemstringpart, {
68 description = string.format(S("tutorial sign '%s'"), S(caption)),
69 drawtype = "signlike",
70 tiles = {"default_sign_wall.png"},
71 inventory_image = "default_sign_wall.png",
72 wield_image = "default_sign_wall.png",
73 paramtype = "light",
74 paramtype2 = "wallmounted",
75 sunlight_propagates = true,
76 is_ground_content = false,
77 walkable = false,
78 selection_box = { type = "wallmounted" },
79 groups = {immortal=1,attached_node=1,tutorial_sign=1},
80 legacy_wallmounted = true,
81 sounds = default.node_sound_defaults(),
82 on_construct = function(pos)
83 local meta = minetest.get_meta(pos)
84 local formspec = ""..
85 "size[12,6]"..
86 "label[-0.15,-0.4;"..minetest.formspec_escape(S(caption)).."]"..
87 "tablecolumns[text]"..
88 "tableoptions[background=#000000;highlight=#000000;border=false]"..
89 "table[0,0.25;12,5.2;infosign_text;"..
90 tutorial.convert_newlines(minetest.formspec_escape(S(fulltext)))..
91 "]"..
92 "button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
93 meta:set_string("formspec", formspec)
94 meta:set_string("infotext", string.format(S("%s (Right-click to read)"), S(caption)))
95 meta:set_string("id", itemstringpart)
96 meta:set_string("caption", caption)
97 end
99 end
101 minetest.register_abm( {
102 nodenames = {"group:tutorial_sign"},
103 interval = 1,
104 chance = 1,
105 action = function(pos, node, active_object_count, active_object_count_wider)
106 local meta = minetest.get_meta(pos)
107 local id = meta:get_string("id")
108 local caption = meta:get_string("caption")
109 local formspec = ""..
110 "size[12,6]"..
111 "label[-0.15,-0.4;"..minetest.formspec_escape(S(caption)).."]"..
112 "tablecolumns[text]"..
113 "tableoptions[background=#000000;highlight=#000000;border=false]"..
114 "table[0,0.25;12,5.2;infosign_text;"..
115 tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts[id])))..
116 "]"..
117 "button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
118 meta:set_string("formspec", formspec)
119 meta:set_string("infotext", string.format(S("%s (Right-click to read)"), S(caption)))
121 end }
126 -- Number of gold ingots/lumps
127 tutorial.gold = 13
129 -- Number of hidden diamonds
130 tutorial.diamonds = 12
134 tutorial.texts = {}
135 tutorial.texts.intro =
136 [[Welcome! This tutorial will teach you the most crucial basics of Minetest.
137 This tutorial assumes that you have not changed the default keybindings yet.
139 Let's start for the most important keybindings right now:
141 Look around: Move the mouse
142 Walk forwards: [W]
143 Strafe left: [A]
144 Walk backwards: [S]
145 Strafe right: [D]
146 Action: [Right mouse button]
147 Pause menu (you can exit the game here): [Esc]
149 You will find signs with more introductionary texts throughout this tutorial.
150 The "action" key has many uses. For now, let's just say you need it to read
151 the signs. Look at one and right-click it to read it.
153 To look at a sign, make sure you are close enough to it and the crosshair in the
154 center of the screen points directly on the sign.
156 You can exit the tutorial at any time, the world will be automatically saved.
158 Now feel free to walk around a bit and read the other signs to learn more.]]
160 tutorial.texts.minetest =
161 [[Minetest itself is not a game, it is a game engine.
162 To be able to actually play it, you need something called a "Minetest game",
163 sometimes also called "subgame" or just "game". In this tutorial, we use the term,
164 "subgame".
166 Don't worry, Minetest comes pre-installed with a rather simple default subgame, oddly,
167 also called "Minetest"
169 This tutorial teaches you the basics of Minetest (the engine), things which are true for
170 all subgames. This tutorial does not teach you how to play a particular subgame, not
171 even the default one.
173 Minetest as well as the default subgame are unfinished at the moment, so please forgive
174 us when not everything works out perfectly.]]
176 tutorial.texts.subgame =
177 [[Now since you probably now the basics, you may want to actually play or build something.
178 Minetest comes bundled with a default subgame, which you may try out now.
179 Sadly, there is currently no tutorial for the default subgame.
180 You may want to read the "Getting Started" section of the Community Wiki,
181 which is more specific about the default subgame.
182 Said document can be found at:
184 <http://wiki.minetest.net/Getting_Started>
186 Alternatively, you may check out one of the subgames which are shared on the Minetest forums.]]
189 tutorial.texts.creative =
190 [[The creative mode is turned on. If you are here to learn how to play Minetest,
191 you should probably leave now, turn creative mode off and restart the
192 tutorial.
194 Roughly spoken, creative mode is for messing around with the game without
195 the normal gameplay restraints.
197 You can leave now by pressing "Leave tutorial", or later, by pressing [Esc].]]
199 tutorial.texts.notsingleplayer =
200 [[You are now playing the tutorial in multiplayer mode.
201 But this tutorial is optimized for the singleplayer mode.
202 This tutorial does not work properly with more than 1 player.
204 Unless you are sure no other players will join, you should
205 leave now and start the tutorial in singleplayer mode.]]
207 tutorial.texts.cam =
208 [=[Minetest has 3 different camera modes which determine the way you see the world.
209 The three modes are:
211 - First-person view (default)
212 - Third-person view from behind
213 - Third-person view from the front
215 You can change the camera mode by pressing [F7] (but you have to close this
216 window first).
218 Switch camera mode: [F7]]=]
220 tutorial.texts.blocks =
221 [[The world of Minetest is made entirely out of blocks, or cubes, to be precise.
222 Blocks can be added or removed with the correct tools.
224 In this section, we'll show you a few special but common blocks which behave in unexpected,
225 ways.,
227 Of course, subgames can come up with more special weird blocks.]]
229 tutorial.texts.falling_node =
230 [[Some blocks need to rest on top of another block, otherwise, they fall down.
231 Try it and mine the block below the uppermost block.]]
233 tutorial.texts.attached_node =
234 [[Some blocks have to be attached to another block, otherwise, they drop as an item
235 as if you would have mined it.
237 Attached here is a picture frame. You can't collect or mine it directly, but if you mine
238 the block it is attached to, it will drop as an item which you can collect.]]
240 tutorial.texts.disable_jump =
241 [[These nasty blocks on the floor prevent you from jumping when you stand on them.]]
243 tutorial.texts.runover =
244 [[This abyss behind this sign is so small that you can even walk over it,
245 as long as you don't stop midway. But you can jump over it anyways, just to be,
246 safe.]]
248 tutorial.texts.jumpup =
249 [[You can't reach this upper block by walking. But luckily, you are able to jump.
250 For our purposes, you can jump just high enough to reach one block above you.
251 But you can't two blocks high.
252 Press the space bar once to jump at a constant height.
254 Jump: [Space]
256 Now try it to continue.]]
259 tutorial.texts.jumpover =
260 [=[Here is a slightly larger abyss. Luckily, you can also jump just far enough to
261 cross a gap of this width. Don't worry, the abyss is not deep enough to hurt you
262 when you fall down. There are stairs which lead back up here.
264 Jump: [Space]]=]
266 tutorial.texts.orientation =
267 [[From this point on, there will be branching paths. For orientation, we placed
268 some arrow signs. They just show a short text when you hover them, that's all.
270 You don't have to follow the sections in any particular order, with one exception,
271 for which you will be informed.]]
273 tutorial.texts.sneak =
274 [=[Sneaking is a special move. As long as you sneak, you walk slower, but you are
275 guaranteed to not accidentally fall off the edge of a block. This also allows you to
276 "lean over" in a sense.
277 To sneak, keep the sneak key pressed. As soon as you release the sneak key,
278 you walk at normal speed again. Be careful not releasing the sneak key when you
279 are at a ledge, you might fall!
281 Sneak: [Shift]
283 Keep in mind that the [Shift] key is used for a large number of other things in Minetest.
284 Sneaking only works when you are not in a liquid stand on solid ground and are not at a
285 ladder.
287 You may try out sneaking at this little blocky pyramid.]=]
289 tutorial.texts.hotbar =
290 [[At the bottom of the screen you see 8 squares. This is called the 'hotbar'.
291 The hotbar allows you to quickly access some items from your inventory.
292 In our case, the upper 8 slots in your inventory.
293 You can change the selected item with the mouse wheel, if you have one, or with the
294 number keys.
296 Select previous item in hotbar: [Mouse wheel up]
297 Select next item in hotbar: [Mouse wheel down]
298 Select item #N in hotbar: the key with the number #N
300 The item you've seleted is also the item you wield. This will be important later for
301 tools, mining, building, etc.]]
304 tutorial.texts.eat =
305 [[In this chest you find some comestibles. Comestibles are items which instantly
306 heal you when eaten. This removes the item from your inventory.
307 To eat one, select the comestible in your hotbar, then click the left mouse button.
308 Unlike other items, you cannot punch or attack while holding a comestible. To be able
309 to attack, you have to select something else.
310 Of course, this does not have to be the only way to heal you.
312 Eat comestible: [Left mouse button]
314 Don't forget to take the gold ingot.]]
316 tutorial.texts.chest =
317 [[Treasure chests are a common sight in Minetest. They are actually not built-in
318 into the game.]]
320 tutorial.texts.damageblock =
321 [[Careful! These spikes hurt you when you stand inside, so don't walk into them.
322 Try to walk around and get the gold ingot.
324 They damage you every second you stand in them.
326 This is one of the many ways you can get hurt in Minetest.]]
328 tutorial.texts.ladder =
329 [[This is a ladder. Ladders help you to climb up great heights or to climb down safely.
330 To climb a ladder, go into the block occupied by the ladder and hold one of the
331 following keys:
333 Climb up ladder: [Space]
334 Climb down ladder: [Shift]
336 Note that sneaking and jumping do not work when you are at a ladder.]]
338 tutorial.texts.swim =
339 [[What you see here is a small swimming pool. You are able to swim and dive.
340 Diving usually costs you breath. While diving, 10 bubbles appear in the heads-up display.
341 These bubbles disappear over time while diving and when you are out of bubbles,
342 you slowly lose some health points. You have to back up to the surface from time to
343 time to restore the bubbles.
345 Movement in a liquid is slightly different than on solid ground:
347 Swim forwards: [W]
348 Swim backwards: [S]
349 Swim leftwards: [A]
350 Swim rightwards: [D]
351 Swim upwards: [Space]
352 Swim downwards: [Shift]
354 At the bottom of the pool lies a gold ingot. Try to get it!]]
357 tutorial.texts.dive =
358 [=[To get to the other side, you have to dive here. Don't worry, the tunnel is not
359 long. But don't stay too long in the water, or else you take damage.
360 At the bottom of the pool lies a gold ingot. Try to get it!
362 Swim forwards: [W]
363 Swim backwards: [S]
364 Swim leftwards: [A]
365 Swim rightwards: [D]
366 Swim upwards: [Space]
367 Swim downwards: [Shift]]=]
369 tutorial.texts.waterfall = ""..
370 [=[You can easily swim up this waterfall. Go into the water and hold the space bar until you're
371 at the top
373 Swim forwards: [W]
374 Swim backwards: [S]
375 Swim leftwards: [A]
376 Swim rightwards: [D]
377 Swim upwards: [Space]
378 Swim downwards: [Shift]]=]
380 tutorial.texts.liquidtypes =
381 [=[Liquids behave somewhat weirdly in Minetest. Actually, there are 2 kinds of liquids.
382 If you watched the waterfall closely, you may have noticed that there is a slight difference
383 between the water blocks that make the waterfall, and those up here in the basin.
385 Minetest distinguishes between liquid source and flowing liquid.
387 A liquid source block is always a full cube.
388 A flowing liquid block looks slightly different. Often, it is not a full cube, but has a more or less
389 triangular shape. Also, flowing liquids usually have an unique "flowing" animation, but this may
390 not be the case for all liuqids.
392 Up in the basin, you see four rows of liquid sources, followed by one row of flowing
393 liquids, followed by the waterfall itself. The waterfall itself is solely made of flowing liquids.
395 Liquid sources generate flowing liquids around them. Liquid sources can also exist on their own.
396 Flowing liquids are not able to exist on their own. They have to originate from a liquid source.
397 If the liquid source is gone, or the way to one is blocked, the flowing liquid will slowly dry
398 out.
400 To the left of this sign is a special block. When used, it will block the liquid flow.
401 Use that block, being close enough and looking at it, and watch the waterfall dry out.
403 Use something: [Right mouse button]]=]
405 tutorial.texts.viscosity =
406 [[Minetest mods can introduce various liquids which differ in their properties.
407 Probably the most important property is their viscosity. Here you have some
408 pools which differ in their viscosity. Feel free to try them out.]]
410 tutorial.texts.pointing1 =
411 [[An important general concept in Minetest is pointing. As mentioned earlier,
412 there is a crosshair in the center of the screen.
414 You can point several things in Minetest:
416 - Blocks
417 - Dropped items
418 - Other players
419 - Many other things
421 You can only point one thing at once, or nothing at all. You can tell when
422 you point something if it is surrounded by a thin cuboid wireframe.
424 To point something, three conditions have to be met:
425 1. The thing in question must be pointable at all
426 2. Your crosshair must be exactly over the thing in question
427 3. You must be close enough to the thing
429 When a thing is pointed, you can do different stuff with it; e.g. collecting it,
430 punching it, building to it, etc. We come to all that later.
432 Now collect that apple from the small tree in front of this sign, and the gold bar.
433 To do that, you must point it and click with the left mouse button.]]
436 tutorial.texts.pointing2 =
437 [[The distance you need to point to things solely depends on the tool you carry.
438 Most tools share a default value but some tools may have a longer or shorter distance.
440 At the moment, your only "tool" is the hand. It was good enough to collect the apple
441 from the small tree.
443 Above this sign hang some apples, but you cannot reach them by normal means. At the
444 wall in front of this sign lies a special example tool which you can use to retrieve the apple
445 from afar.
447 To take the tool, point to it and click the left mouse button. Then select it with the
448 mouse wheel or the number keys. You will learn more about tools in a different section.]]
450 tutorial.texts.health =
451 [[Unless you have damage disabled, all players start with 20 hit points (HP), represented
452 by ten hearts in the heads-up display. One HP is represented by half a heart in this
453 tutorial, but the actual representation can vary from subgame to subgame.
455 You can take damage for the following reasons (including, but not limited to):
456 - Falling too deep
457 - Standing in a block which hurts you
458 - Attacks from other players
459 - Staying too long in a liquid
461 In this tutorial, you can regain health by eating a comestible. This is only an example,
462 mods and subgames may come with other mechanisms to heal you.
464 When you lose all your hit points, you die. Death is normally not really that bad in Minetest.
465 When you die, you will usually lose all your possessions. You are able to put yourself
466 into the world immediately again. This is called "respawning". Normally you appear at a
467 more or less random location.
468 In the tutorial you can die, too, but don't worry about that. You will
469 respawn at a special location you can't normally reach and keep all your posessions.
470 Subgames may introduce special events on a player's death.]]
472 tutorial.texts.death =
473 [[Oops! So it seems you just have died. Don't worry, you don't have lost any of your
474 possessions and you have been revived. You are still in Tutorial World at a different
475 location.
477 You have arrived at the so-called respawn location of Tutorial World. You will
478 always appear here after you died. This is called "respawning". In most worlds,
479 however, you will respawn in a slightly randomized location.
481 The tutorial uses a so-called fixed spawn point, so you respawn always at the same
482 spot. This is unusual for singleplayer worlds, but in online play some servers,
483 use fixed spawn points, too.
485 Under normal conditions you would have lost all or a part of your possessions or some
486 other bad thing would have happened to you. But not here, this is a tutorial.
488 To continue, just drop out at the end of that gangway. The drop is safe.]]
493 tutorial.texts.items =
494 [[Throughout your journey, you will probably collect many items. Once you collected
495 them, blocks are considered to be items, too.
497 Items can be stored in your inventory and selected with the hotbar (see the other signs).
498 You can wield any items; you can even punch with almost any item to hurt enemies.
499 Usually, you will deal a minimal default damage with most items. Even if you do not hold,
500 an item at all.
501 If you don't want to have an item anymore, you can always throw it away. Likewise,
502 you can collect items which lie around by pointing and leftclicking them.
504 Collect item: [Left mouse button]
505 Drop carried item stack: [Q]
506 Drop single item from carried item stack: [Shift] + [Q]
508 On the ledge at the right to this sign lies an item stack of 50 rocks so you have some items,
509 to test out the inventory.]]
511 tutorial.texts.tools =
512 [[A tool is a special kind of item.
513 Tools can be used for many things, such as:
514 - Breaking blocks
515 - Collecting liquids
516 - Rotating blocks
517 - Many others!
518 The number of tools which are possible in Minetest are innumberable and are
519 too many to cover in this tutorial.
520 But at least we will look at a very common and important tool type: mining tools,
521 We will come to that in the mining section.
523 Many tools wear off and get destroyed after you used them for a while. In an
524 inventory the tool's "health" is indicated by a colored bar
526 Tools may be able to be repaired, see the sign about repairing.]]
528 tutorial.texts.inventory =
529 [[The inventory menu usually contains the player inventory. This allows you
530 to carry along items throughout the world.
532 Every inventory is made out of slots where you can store items in. You can store one
533 entire stack of items per slot, the only condition is that the items are of the same
534 type. In this tutorial all items except for tools stack up to 99 items, but this number
535 can vary in actual subgames.
537 Here are the controls which explain how to move around the items within the inventory:
539 In the game:
540 Open inventory menu: [I]
542 When the inventory is opened and you don't hold any items:
543 Take item stack: [Left mouse button]
544 Take 10 items from item stack: [Middle mouse button]
545 Take half item stack: [Right mouse button]
547 When you took an item stack in the inventory:
548 Put item stack: [Left mouse button]
549 Put 10 items from item stack: [Middle mouse button]
550 Put single item from item stack: [Right mouse button]
552 You can also drop an item stack by holding it in the inventory, then clicking anywhere
553 outside of the window.]]
555 tutorial.texts.chest =
556 [[This is a chest. You can view its contents by right-clicking it. In the menu you will see
557 two inventories, on the upper part the chest inventory and on the lower part the player
558 inventory. Exchanging items works exactly the same as in the inventory menu.]]
561 tutorial.texts.build =
562 [[Another important task in Minetest is building blocks.
563 Building" here refers to the task of placing one block in your possession onto
564 another block in the world.
565 Unlike mining, building a block happens instantanous. To build, select a block in your
566 hotbar, point to any block in the world and press the right mouse button.
567 Your block will be immediately placed on the pointed side.
568 It is important that the block you want to build to is pointable. This means you cannot build
569 next to or on liquids by normal means.
571 Build on ordinary block: [Right mouse button]
573 Try to get up to that little hole by using the wood blocks in the chest. There is another
574 gold ingot waiting for you.]]
576 tutorial.texts.mine =
577 [[Mining is a method to remove a single block with a mining tool. It is a very important
578 task in Minetest which you will use often.
580 (It is recommended that you go to the crafting and items house first. It is right in front of
581 this sign.)
583 To be able to mine a block, you need
585 1. to have minable block, after all,
586 2. to point on the block and
587 3. to carry an appropriate tool.
589 Mine: [Left mouse button]
591 When you are ready, hold the left mouse button while pointing the block. Depending on
592 the block type and the tool properties, this can take some time. Some tools are fast with
593 some particular block types, some other tools may be slower to mine other block types.
594 If you do not carry an appropriate tool, you are not able to mine the block at all.
595 You can tell that you are actually mining when you see cracks or some other animation
596 on the block in question.
598 When done mining, blocks will often add one or more items to your inventory. This is called
599 the "drop" of a block and depends on the block type. Now try to mine those large cubes in
600 this area, using different tools. Note that all blocks here are just examples to show you
601 different kinds of drops.]]
603 tutorial.texts.mine_cobble =
604 [[This is cobblestone. You can mine it with a pickaxe.
605 This cobblestone will always drop itself, that means, cobblestone. Dropping itself is the
606 usual dropping behaviour of a block, throughout many subgames.]]
608 tutorial.texts.mine_wood =
609 [[These are wooden planks. In the tutorial, you can only mine those blocks with an axe.
610 Wooden planks drop themselves.
612 In Minetest, we use the term "mining" in a general sense, regardless of the material.]]
614 tutorial.texts.mine_conglomerate =
615 [[This is a cube of conglomerate. You need a pickaxe to mine it.
616 Conglomerate drops something based on probability. Conglomerate randomly drops between 1
617 and 5 rocks, when mined.]]
619 tutorial.texts.mine_glass =
620 [[This is some weak glass. You can break it with your bare hands. Or you can use your pickaxe,
621 which is faster. Note that it looks slightly different than the other glass in this world.
622 These glass blocks don't drop anything.]]
624 tutorial.texts.mine_stone =
625 [[This is stone. You need a pickaxe to mine it. When mined, stone will drop cobblestone.]]
627 tutorial.texts.mine_immortal =
628 [[There can always be some blocks which are not minable by any tool. In our tutorial, all
629 those castle walls can't me mined, for example.]]
631 tutorial.texts.craft1 =
632 [[Crafting is the task of taking several items and combining them to form a new item.
633 Crafting is another important task in Minetest.
635 To craft something, you need a few items and a so-called crafting grid.
637 In this tutorial, you have a grid of size 3 times 3 in your inventory.
638 Let's get right into crafting:
640 1. Take 3 sheets of paper from the chest next to this sign.
641 2. Open the inventory menu with [I].
642 3. Place the paper in the crafting grid so that they form a 1×3 vertical line.
643 4. A book should appear in the output slot. Click on it to take it,
644 then put it in your player inventory.
646 This process consumes the paper.
647 When you have the book in your inventory, go on with the next sign.]]
649 tutorial.texts.craft2 =
650 [[To craft the book you have used a so-called crafting recipe. You must know the crafting
651 recipes as well so you can craft.
653 The crafting recipe you used in particular is a so-called shaped recipe. This means the
654 pattern you place in the crafting grid matters, but you can move the entire pattern
655 freely.
657 There is another kind of crafting recipe: Shapeless.
658 Shapeless recipes only care about which items you place in the crafting grid, but not in
659 which pattern. In the next chest you find some wheat. Let's make dough from it! For this,
660 you have to place at least 1 wheat in 4 different slots, but the other slots must be empty.
661 What is special about this recipe is that you can place them anywhere in the grid.
663 When you got your dough, go on with the next sign.]]
665 tutorial.texts.craft3 =
666 [[Do you got your dough? Good.
668 You may have noticed that crafting always consumes one item from each occupied slot
669 of the crafting grid. This is true for all crafting recipes.
670 You can speed crafting up a bit when you click with the middle mouse button on the
671 item in the output slot. Doing so will attempt to do the same craft up to 10 times,
672 instead of just once.
674 Feel free to try it with the remaining wheat or just go on with the next sign.]]
676 tutorial.texts.craft4 =
677 [[Another important thing to know about crafting are so-called groups. Crafting recipes do
678 not always require you to use the exactly same items every time.
679 This tutorial has a special recipe for books. In the chest, you will find paper in 4
680 different colors. You can also make a book by placing 3 paper sheets of any color
681 in a vertical line.
682 The paper color does not matter here, you can use only white paper, only orange paper
683 or even mix it. What is important here are the occupied slots.
684 This is possible because all 4 types of (example) paper belong to the same group and
685 our book recipe accepts not only white paper, but any paper of that group.
687 Feel free to experiment a bit around with this.]]
689 tutorial.texts.smelt =
690 [[This is a furnace. Furnaces can be used to turn a smeltable item with help of a fuel
691 to a new item. Many items can be furnace fuels, but not all. A few items are smeltable.
693 In order to operate a furnace, you have to put the smeltable item into the 'Source' slot
694 and the fuel into the 'Fuel' slot.
695 As soon as the items have been placed, the furnace automatically starts to smelt the
696 items. The furnace becomes active and consumes an item in the fuel slot. The flame
697 goes on and will continue burning for a given time. The time depends on the fuel type.
698 ome fuels burn very short, and other burn longer. In the furnace menu, the burn time
699 is indicated by the flame symbol. As soon as the flame goes out, the furnace may
700 continue burning if there is still fuel and smeltable material in the furnace,
701 otherwise, the furnace becomes inactive again.
702 The smeltable material has to be exposed to the flame for a given time as well. This
703 time depends on the type of the material, too. Some material smelt faster than others.
704 You can see the smelting progress of a single item on the progress arrow. If one item
705 has been smelt, the result goes to one of the output slots, where you can take it.
707 In the left chest you find some fuels and in the right chest you find some materials to
708 smelt. Feel free to experiment with the furnace a bit. Smelt the gold lump to receive
709 this station's gold bar.
711 Again, this furnace is just an example; the exact operation may differ slightly from
712 subgame to subgame.]]
714 tutorial.texts.repair =
715 [[Some subgames may come with a special recipe which allows you to repair your tools.
716 In those, repairing works always the same way:
717 Place two more or less worn out tools of the same kind into the crafting crid and
718 take the result. The result is a new tool which is slightly repaired by a fixed percentage.
720 Of course, this tutorial comes with such a recipe. The chest next to this sign stores
721 some damaged tools which you may try to repair now.]]
724 tutorial.texts.use =
725 [=[You will often meet some blocks you can use. Something special happens when you
726 right-click while pointing on them.
727 In fact, you already used such blocks: All the signs you read are "usable" blocks.
729 There is a strange device next to this sign. Use it and see what happens.
731 Use usable block: [Right mouse button]]=]
734 tutorial.texts.basic_end =
735 [[If you think you have enough of this tutorial, you can leave at any time. There are
736 13 gold ingots at the stations to be found, to help you keep track.
738 You can find the gold ingots at the following stations:
739 - Ladders
740 - Sneaking
741 - Swimming
742 - Diving
743 - Waterfall
744 - Viscosity
745 - Comestibles and Eating
746 - Pointing
747 - Crafting
748 - Smelting
749 - Mining
750 - Building
751 - Damage and Health
753 If you've got 13 gold ingots (in total), you probably know now everything which can be
754 learned from this tutorial. Collecting the gold ingots is optional and won't give you
755 anything special.
757 After you closed this dialog, you can press [Esc] to open the pause menu and return
758 to the main menu or quit Minetest.
760 In the next room there are some further signs with information, but it is entirely optional
761 and not related to gameplay.]]
763 tutorial.texts.fallout =
764 [[You somehow managed to fall from the castle or got otherwise below it!
765 How did you do that?
767 Anyways, you've got teleported back to the starting location. Whatever you did, be more
768 careful next time.]]
770 tutorial.texts.first_gold =
771 [[You have collected your first gold ingot. Those will help you to keep track in this tutorial.
772 There are 14 gold ingots in this tutorial.
774 There is a gold ingot at every important station. If you collected all ingots, you are
775 done with the tutorial, but collecting the gold ingots is not mandatory.]]
777 tutorial.texts.last_gold =
778 [[You have collected all the gold ingots in this tutorial.
780 This means you have now travelled to each station. If you read and understood everything,
781 you have learned everything which can be learned from this tutorial.
783 If this is the case, you are finished with this tutorial and can leave now. But feel
784 free to stay in this world to explore the area a bit further.
786 You may also want to visit the Good-Bye room, which has a few more informational
787 signs with supplemental information, but nothing of is is essential or gameplay-relevant.
789 If you want to stay, you leave later by pressing [Esc] to open the pause menu and then
790 return to the main menu or quit Minetest.]]
792 tutorial.texts.first_diamond =
793 [[Great, you have found and collected a hidden diamond! In Tutorial World, there are 12 hidden
794 diamonds. Can you find them all? The first diamond may have been easy to collect, but the
795 remaining 11 diamonds probably won't be that easy.
797 If you manage to find them all, you will be awarded a symbolic prize.]]
799 tutorial.texts.last_diamond =
800 [[Congratulations!
801 You have collected all the diamonds of Tutorial World!
803 To recognize this achievement, you have been awarded with a diamond cup. It has been placed in
804 the Good-Bye Room for you.]]
807 tutorial.texts.controls =
808 [[To recap, here is an overview over the most important default controls:
810 Move forwards: [W]
811 Move left: [A]
812 Move backwards: [S]
813 Move right: [D]
814 Jump: [Space]
815 Sneak: [Shift]
816 Move upwards (ladder/liquid): [Space]
817 Move downwards (ladder/liquid): [Shift]
819 Toggle camera mode: [F7]
821 Select item in hotbar: [Mouse wheel]
822 Select item in hotbar: [0] - [9]
823 Inventory menu: [I]
825 Collect pointed item: [Left mouse button]
826 Drop item stack: [Q]
827 Drop single item: [Shift] + [Q]
829 Punch: [Left mouse button]
830 Mine: [Left mouse button]
831 Build/use: [Right mouse button]
832 Build: [Shift] + [Right mouse button]
834 Abort/open pause menu: [Esc]
836 You can review a shorter version of the controls in the pause menu.]]
839 tutorial.texts.online =
840 [[You may want to check out these online resources related to Minetest:
842 Official homepage of Minetest: <http://minetest.net/>
843 The main place to find the most recent version of Minetest.
845 Community wiki: <http://wiki.minetest.net/>
846 A community-based documentation website for Minetest. Anyone with an account can edit
847 it! It also features a documentation of the default game, which was NOT covered by
848 this tutorial.
850 Webforums: <http://forums.minetest.net/>
851 A web-based discussion platform where you can discuss everything related to Minetest.
852 This is also a place where player-made mods and subgames are published and
853 discussed. The discussions are mainly in English, but there is also space for
854 discussion in other languages.
856 Chat: <irc://irc.freenode.net#minetest>
857 A generic Internet Relay Chat channel for everything related to Minetest where people can
858 meet to discuss in real-time.
859 If you do not understand IRC, see the Community Wiki for help.]]
862 tutorial.register_infosign("intro", "Introduction", tutorial.texts.intro)
863 tutorial.register_infosign("minetest", "Minetest", tutorial.texts.minetest)
864 tutorial.register_infosign("cam", "Player Camera", tutorial.texts.cam)
865 tutorial.register_infosign("runover", "Small Abysses", tutorial.texts.runover)
866 tutorial.register_infosign("jumpup", "Jumping (1)", tutorial.texts.jumpup)
867 tutorial.register_infosign("jumpover", "Jumping (2)", tutorial.texts.jumpover)
868 tutorial.register_infosign("sneak", "Sneaking", tutorial.texts.sneak)
869 tutorial.register_infosign("orientation", "Information about the following tutorial sections", tutorial.texts.orientation)
870 tutorial.register_infosign("hotbar", "Hotbar", tutorial.texts.hotbar)
871 tutorial.register_infosign("eat", "Comestibles and Eating", tutorial.texts.eat)
872 tutorial.register_infosign("chest", "Chests", tutorial.texts.chest)
873 tutorial.register_infosign("damageblock", "Blocks Which Hurt You", tutorial.texts.damageblock)
874 tutorial.register_infosign("ladder", "Climbing Ladders", tutorial.texts.ladder)
875 tutorial.register_infosign("swim", "Swimming", tutorial.texts.swim)
876 tutorial.register_infosign("dive", "Diving", tutorial.texts.dive)
877 tutorial.register_infosign("waterfall", "Swimming up a Waterfall", tutorial.texts.waterfall)
878 tutorial.register_infosign("viscosity", "Viscosity", tutorial.texts.viscosity)
879 tutorial.register_infosign("liquidtypes", "Liquid sources and flowing liquids", tutorial.texts.liquidtypes)
880 tutorial.register_infosign("pointing1", "Pointing (1)", tutorial.texts.pointing1)
881 tutorial.register_infosign("pointing2", "Pointing (2)", tutorial.texts.pointing2)
882 tutorial.register_infosign("health", "Health and Damage", tutorial.texts.health)
883 tutorial.register_infosign("death", "Death and Respawning", tutorial.texts.death)
884 tutorial.register_infosign("items", "Items", tutorial.texts.items)
885 tutorial.register_infosign("tools", "Tools", tutorial.texts.tools)
886 tutorial.register_infosign("inventory", "Using the Inventory", tutorial.texts.inventory)
887 tutorial.register_infosign("chest", "Comment About Chests", tutorial.texts.chest)
888 tutorial.register_infosign("build", "Building Some Blocks", tutorial.texts.build)
889 tutorial.register_infosign("mine", "Mining blocks", tutorial.texts.mine)
890 tutorial.register_infosign("mine_cobble", "Mining example: Cobblestone", tutorial.texts.mine_cobble)
891 tutorial.register_infosign("mine_stone", "Mining example: Stone", tutorial.texts.mine_stone)
892 tutorial.register_infosign("mine_conglomerate", "Mining example: Conglomerate", tutorial.texts.mine_conglomerate)
893 tutorial.register_infosign("mine_wood", "Mining example: Wooden Planks", tutorial.texts.mine_wood)
894 tutorial.register_infosign("mine_glass", "Mining example: Weak glass", tutorial.texts.mine_glass)
895 tutorial.register_infosign("mine_immortal", "Unminable blocks", tutorial.texts.mine_immortal)
896 tutorial.register_infosign("blocks", "Special blocks", tutorial.texts.blocks)
897 tutorial.register_infosign("disable_jump", "No-jumping blocks", tutorial.texts.disable_jump)
898 tutorial.register_infosign("falling_node", "Falling blocks", tutorial.texts.falling_node)
899 tutorial.register_infosign("attached_node", "Attached blocks", tutorial.texts.attached_node)
900 tutorial.register_infosign("use", "Using blocks", tutorial.texts.use)
901 tutorial.register_infosign("craft1", "Crafting Basics", tutorial.texts.craft1)
902 tutorial.register_infosign("craft2", "Crafting using Shapeless Recipes", tutorial.texts.craft2)
903 tutorial.register_infosign("craft3", "Crafting Faster", tutorial.texts.craft3)
904 tutorial.register_infosign("craft4", "Crafting Groups", tutorial.texts.craft4)
905 tutorial.register_infosign("smelt", "Furnace Operation Instructions", tutorial.texts.smelt)
906 tutorial.register_infosign("repair", "Repairing Tools", tutorial.texts.repair)
907 tutorial.register_infosign("basic_end", "End of the Basic Tutorial", tutorial.texts.basic_end)
908 tutorial.register_infosign("controls", "Controls Overview", tutorial.texts.controls)
909 tutorial.register_infosign("online", "Online Resources", tutorial.texts.online)
910 tutorial.register_infosign("subgame", "Subgames", tutorial.texts.subgame)
912 minetest.register_node("tutorial:wall", {
913 description = S("reinforced wall"),
914 tiles = {"default_stone_brick.png"},
915 is_ground_content = true,
916 groups = {immortal=1},
917 sounds = default.node_sound_stone_defaults(),
920 minetest.register_node("tutorial:reinforced_glass", {
921 description = S("reinforced glass"),
922 drawtype = "glasslike",
923 tiles = {"tutorial_reinforced_glass.png"},
924 inventory_image = minetest.inventorycube("tutorial_reinforced_glass.png"),
925 paramtype = "light",
926 sunlight_propagates = true,
927 groups = { immortal=1 },
928 sounds = default.node_sound_glass_defaults(),
931 minetest.register_node("tutorial:weak_glass", {
932 description = S("weak glass"),
933 drawtype = "glasslike",
934 tiles = {"tutorial_weak_glass.png"},
935 inventory_image = minetest.inventorycube("tutorial_weak_glass.png"),
936 paramtype = "light",
937 sunlight_propagates = true,
938 groups = { cracky=3, oddly_breakable_by_hand=1 },
939 drop = "",
940 sounds = default.node_sound_glass_defaults(),
944 minetest.register_tool("tutorial:snatcher", {
945 description = S("apple snatcher"),
946 inventory_image = "tutorial_snatcher.png",
947 wield_image = "tutorial_snatcher.png",
948 wield_scale = { x = 1, y = 1, z = 1 },
949 range = 10,
950 tool_capabilities = {},
953 --[[ A special switch which, when flipped, exchanges day for night and vice versa. ]]
954 minetest.register_node("tutorial:day", {
955 description = S("day/night switch (day)"),
956 tiles = { "tutorial_day.png" },
957 groups = {immortal=1},
958 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
959 minetest.set_timeofday(0)
960 minetest.set_node(pos, {name="tutorial:night"})
963 minetest.register_node("tutorial:night", {
964 description = S("day/night switch (night)"),
965 tiles = { "tutorial_night.png" },
966 groups = {immortal=1},
967 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
968 minetest.set_timeofday(0.5)
969 minetest.set_node(pos, {name="tutorial:day"})
973 --[[ A special switch which "activates" and "deactivates" the waterfall in Tutorial World.
974 It only works on a prepared map! ]]
975 minetest.register_node("tutorial:waterfall_on", {
976 description = S("waterfall switch (on)"),
977 tiles = { "tutorial_waterfall_on.png" },
978 groups = {immortal=1},
979 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
980 local wpos = { y = 5, z = 86 }
981 for x=33,46 do
982 wpos.x = x
983 minetest.set_node(wpos, {name="tutorial:wall"})
985 minetest.set_node({x=30,y=7,z=91}, {name="tutorial:waterfall_off"})
986 minetest.set_node({x=40,y=2,z=86}, {name="tutorial:waterfall_off"})
989 minetest.register_node("tutorial:waterfall_off", {
990 description = S("waterfall switch (off)"),
991 tiles = { "tutorial_waterfall_off.png" },
992 groups = {immortal=1},
993 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
994 local wpos = { y = 5, z = 86 }
995 for x=33,46 do
996 wpos.x = x
997 minetest.remove_node(wpos)
999 minetest.set_node({x=30,y=7,z=91}, {name="tutorial:waterfall_on"})
1000 minetest.set_node({x=40,y=2,z=86}, {name="tutorial:waterfall_on"})
1005 --[[ Tutorial cups, awarded for achievements ]]
1006 tutorial.cupnodebox = {
1007 type = "fixed",
1008 fixed = {
1009 {-0.3,-0.5,-0.3,0.3,-0.4,0.3}, -- stand
1010 {-0.1,-0.4,-0.1,0.1,0,0.1}, -- handle
1011 {-0.3,0,-0.3,0.3,0.1,0.3}, -- cup (lower part)
1012 -- the 4 sides of the upper part
1013 {-0.2,0.1,-0.3,0.2,0.5,-0.2},
1014 {-0.2,0.1,0.2,0.2,0.5,0.3},
1015 {-0.3,0.1,-0.3,-0.2,0.5,0.3},
1016 {0.2,0.1,-0.3,0.3,0.5,0.3},
1020 --[[ awarded for collecting all gold ingots ]]
1021 minetest.register_node("tutorial:cup_gold", {
1022 description = S("golden cup"),
1023 tiles = { "default_gold_block.png" },
1024 paramtype = "light",
1025 drawtype = "nodebox",
1026 node_box = tutorial.cupnodebox,
1027 groups = { immortal = 1 }
1030 --[[ awarded for collecting all diamonds ]]
1031 minetest.register_node("tutorial:cup_diamond", {
1032 description = S("diamond cup"),
1033 tiles = { "default_diamond_block.png" },
1034 paramtype = "light",
1035 drawtype = "nodebox",
1036 node_box = tutorial.cupnodebox,
1037 groups = { immortal = 1 }
1042 --[[ This function shows a simple dialog window with scrollable text
1043 name: name of the player to show the formspec to
1044 caption: Caption of the dialog window (not escaped)
1045 text: The text to be shown. Must be escaped manually for formspec, an unescaped
1046 comma generates a line break.
1048 function tutorial.show_default_dialog(name, caption, text)
1049 local formspec = "size[12,6]"..
1050 "label[-0.15,-0.4;"..minetest.formspec_escape(caption).."]"..
1051 "tablecolumns[text]"..
1052 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1053 "table[0,0.25;12,5.2;text_table;"..
1054 tutorial.convert_newlines(minetest.formspec_escape(S(text)))..
1055 "]"..
1056 "button_exit[4.5,5.5;3,1;close;"..S("Close").."]"
1057 minetest.show_formspec(name, "tutorial_dialog", formspec)
1060 minetest.register_on_joinplayer(function(player)
1061 local formspec = nil
1062 if(minetest.is_singleplayer() == false) then
1063 formspec = "size[12,6]"..
1064 "label[-0.15,-0.4;"..minetest.formspec_escape(S("Warning: You're not playing in singleplayer mode")).."]"..
1065 "tablecolumns[text]"..
1066 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1067 "table[0,0.25;12,5.2;creative_text;"..
1068 tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.notsingleplayer)))..
1069 "]"..
1070 "button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue anyways")).."]"..
1071 "button_exit[6.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"
1072 elseif(minetest.setting_getbool("creative_mode")) then
1073 formspec = "size[12,6]"..
1074 "label[-0.15,-0.4;"..(minetest.formspec_escape(S("Warning: Creative mode is active"))).."]"..
1075 "tablecolumns[text]"..
1076 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1077 "table[0,0.25;12,5.2;creative_text;"..
1078 tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.creative)))..
1079 "]"..
1080 "button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue anyways")).."]"..
1081 "button_exit[6.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"
1083 else
1084 if(tutorial.state.first_join==true) then
1085 formspec = "size[12,6]"..
1086 "label[-0.15,-0.4;"..minetest.formspec_escape(S("Introduction")).."]"..
1087 "tablecolumns[text]"..
1088 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1089 "table[0,0.25;12,5.2;intro_text;"..
1090 tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.intro)))..
1091 "]"..
1092 "button_exit[4.5,5.5;3,1;close;"..minetest.formspec_escape(S("Close")).."]"
1094 tutorial.state.first_join = false
1095 tutorial.save_state()
1097 if(formspec~=nil) then
1098 minetest.show_formspec(player:get_player_name(), "intro", formspec)
1103 minetest.register_on_player_receive_fields(function(player, formname, fields)
1104 if(fields.leave) then
1105 minetest.kick_player(player:get_player_name(), S("You have voluntarily exited the tutorial."))
1107 if(fields.gotostart) then
1108 tutorial.back_to_start(player)
1110 if(fields.gotoend) then
1111 tutorial.go_to_end(player)
1113 end)
1115 tutorial.steptimer = 0
1116 minetest.register_globalstep(function(dtime)
1117 tutorial.steptimer = tutorial.steptimer + dtime
1118 local players = minetest.get_connected_players()
1119 if(tutorial.steptimer > 2) then
1120 for p=1,#players do
1121 local player = players[p]
1122 local name = player:get_player_name()
1123 if(player:getpos().y < -12 and (not minetest.setting_getbool("creative_mode"))) then
1124 -- teleport players back to the start when they fell away
1125 tutorial.back_to_start(player)
1126 tutorial.show_default_dialog(name, S("You fell from the castle!"), tutorial.texts.fallout)
1128 else
1129 local inv = player:get_inventory()
1130 local state_changed = false
1132 if(tutorial.state.first_gold ~= true) then
1133 local gold_stack = ItemStack("default:gold_ingot 1")
1134 if(inv:contains_item("main", gold_stack)) then
1135 tutorial.show_default_dialog(
1136 name,
1137 S("Gold ingots in the tutorial"),
1138 tutorial.texts.first_gold
1140 tutorial.state.first_gold = true
1141 state_changed = true
1144 if(tutorial.state.last_gold ~= true) then
1145 local gold_stack = ItemStack("default:gold_ingot "..tostring(tutorial.gold))
1146 if(inv:contains_item("main", gold_stack)) then
1147 local formspec = "size[12,6]"..
1148 "label[-0.15,-0.4;"..minetest.formspec_escape(S("You've finished the tutorial!")).."]"..
1149 "tablecolumns[text]"..
1150 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1151 "table[0,0.25;12,5.2;creative_text;"..
1152 tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.last_gold)))..
1153 "]"..
1154 "button_exit[0.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue")).."]"..
1155 "button_exit[4.5,5.5;3,1;leave;"..minetest.formspec_escape(S("Leave tutorial")).."]"..
1156 "button_exit[8.5,5.5;3,1;gotoend;"..minetest.formspec_escape(S("Go to Good-Bye room")).."]"
1158 minetest.show_formspec(name, "tutorial_last_gold", formspec)
1160 minetest.set_node({x=19,y=2,z=72}, {name="tutorial:cup_gold"})
1161 tutorial.state.last_gold = true
1162 state_changed = true
1166 if(tutorial.state.first_diamond ~= true) then
1167 local diamond_stack = ItemStack("default:diamond 1")
1168 if(inv:contains_item("main", diamond_stack)) then
1169 tutorial.show_default_dialog(
1170 name,
1171 S("You found a hidden diamond!"),
1172 tutorial.texts.first_diamond
1174 tutorial.state.first_diamond = true
1175 state_changed = true
1178 if(tutorial.state.last_diamond ~= true) then
1179 local diamond_stack = ItemStack("default:diamond "..tostring(tutorial.diamonds))
1180 if(inv:contains_item("main", diamond_stack)) then
1181 local formspec = "size[12,6]"..
1182 "label[-0.15,-0.4;"..minetest.formspec_escape(S("You have collected all hidden diamonds!")).."]"..
1183 "tablecolumns[text]"..
1184 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1185 "table[0,0.25;12,5.2;last_diamond_text;"..
1186 tutorial.convert_newlines(minetest.formspec_escape(S(tutorial.texts.last_diamond)))..
1187 "]"..
1188 "button_exit[2.5,5.5;3,1;close;"..minetest.formspec_escape(S("Continue")).."]"..
1189 "button_exit[6.5,5.5;3,1;gotoend;"..minetest.formspec_escape(S("Go to Good-Bye room")).."]"
1190 minetest.show_formspec(name, "tutorial_last_diamond", formspec)
1192 minetest.set_node({x=19,y=2,z=74}, {name="tutorial:cup_diamond"})
1193 tutorial.state.last_diamond = true
1194 state_changed = true
1198 if(state_changed) then
1199 tutorial.save_state()
1203 tutorial.steptimer = 0
1205 end)
1207 function tutorial.back_to_start(player)
1208 player:setpos({x=42,y=0.5,z=28})
1211 function tutorial.go_to_end(player)
1212 player:setpos({x=23,y=0.5,z=74})
1215 --[[
1216 FIXME: This does not work in 0.4.10 thanks to a bug. Uncomment this as soon as
1217 set_physics_override gets fixed
1219 function tutorial.disable_sneak_glitch(player)
1220 player:set_physics_override({sneak_glitch=false, sneak=false})
1223 minetest.register_on_newplayer(tutorial.disable_sneak_glitch)
1224 minetest.register_on_joinplayer(tutorial.disable_sneak_glitch)
1225 minetest.register_on_respawnplayer(tutorial.disable_sneak_glitch)
1229 --[[
1230 Helper tools for sign text extracting
1231 must be called with /lua from luacmd
1232 An ugly, quick and dirty hack.
1233 TODO: Toss away intllib in favor of gettext as soon as possible
1236 function tutorial.convert_newlines_for_intllib(str)
1237 local function convert(s)
1238 return s:gsub("\n", function(slash, what)
1239 return "\\n"
1240 end)
1243 return convert(str)
1246 function tutorial.extract_texts()
1247 local filepath = minetest.get_modpath("tutorial").."/locale/template_texts.txt"
1248 local file = io.open(filepath, "w")
1249 if(file) then
1250 for k,v in pairs(tutorial.texts) do
1251 file:write("# Tutorial text: "..k.."\n")
1252 file:write(tutorial.convert_newlines_for_intllib(v).."\n\n")
1254 else
1255 minetest.log("error", "[tutorial] An attempt to write into "..filepath.." failed.")
1257 io.close(file)