Add sign texts to template.txt
[minetest_tutorial_subgame.git] / mods / tutorial / init.lua
blob2be2b84c8c7a8b898ef7e4a371a06eeea099f120
1 tutorial = {}
3 -- intllib support
4 if (minetest.get_modpath("intllib")) then
5 dofile(minetest.get_modpath("intllib").."/intllib.lua")
6 S = intllib.Getter(minetest.get_current_modname())
7 F = minetest.formspec_escape(S(s))
8 else
9 S = function ( s ) return s end
10 F = function ( s ) return minetest.formspec_escape(s) end
11 end
13 -- Saves tutorial state into file
14 function tutorial.save_state()
15 local str = minetest.serialize(tutorial.state)
16 local filepath = minetest.get_worldpath().."/tutorialdata.mt"
17 local file = io.open(filepath, "w")
18 if(file) then
19 file:write(str)
20 minetest.log("action", "[tutorial] Tutorial state has been written into "..filepath..".")
21 else
22 minetest.log("error", "[tutorial] An attempt to save the tutorial state into "..filepath.." failed.")
23 end
24 end
27 -- load tutorial state from file
29 local filepath = minetest.get_worldpath().."/tutorialdata.mt"
30 local file = io.open(filepath, "r")
31 local read = false
32 if file then
33 local string = file:read()
34 io.close(file)
35 if(string ~= nil) then
36 tutorial.state = minetest.deserialize(string)
37 minetest.log("action", "[tutorial] Tutorial state has been read from "..filepath..".")
38 read = true
39 end
40 end
41 if(read==false) then
42 tutorial.state = {}
44 -- Is this the first time the player joins this tutorial?
45 tutorial.state.first_join = true
46 -- These variables store wheather a message for those events has been shown yet.
47 tutorial.state.first_gold = false
48 tutorial.state.last_gold = false
49 tutorial.state.first_diamond = false
50 tutorial.state.last_diamond = false
51 end
53 function tutorial.convert_newlines(str)
54 local function convert(s)
55 return s:gsub("\n", function(slash, what)
56 return ","
57 end)
58 end
60 return convert(str)
61 end
63 function tutorial.register_infosign(itemstringpart, caption, fulltext)
64 minetest.register_node("tutorial:sign_"..itemstringpart, {
65 description = string.format(S("tutorial sign '%s'"), caption),
66 drawtype = "signlike",
67 tiles = {"default_sign_wall.png"},
68 inventory_image = "default_sign_wall.png",
69 wield_image = "default_sign_wall.png",
70 paramtype = "light",
71 paramtype2 = "wallmounted",
72 sunlight_propagates = true,
73 is_ground_content = false,
74 walkable = false,
75 selection_box = { type = "wallmounted" },
76 groups = {immortal=1,attached_node=1},
77 legacy_wallmounted = true,
78 sounds = default.node_sound_defaults(),
79 on_construct = function(pos)
80 --local n = minetest.get_node(pos)
81 local meta = minetest.get_meta(pos)
82 local formspec = ""..
83 "size[12,6]"..
84 "label[-0.15,-0.4;"..F(caption).."]"..
85 "tablecolumns[text]"..
86 "tableoptions[background=#000000;highlight=#000000;border=false]"..
87 "table[0,0.25;12,5.2;infosign_text;"..
88 tutorial.convert_newlines(F(fulltext))..
89 "]"..
90 "button_exit[4.5,5.5;3,1;close;"..F("Close").."]"
91 meta:set_string("formspec", formspec)
92 meta:set_string("infotext", string.format(S("%s (Right-click to read)"), caption))
93 end
95 end
99 -- Number of gold ingots/lumps
100 tutorial.gold = 13
102 -- Number of hidden diamonds
103 tutorial.diamonds = 12
107 tutorial.texts = {}
108 tutorial.texts.intro =
109 [[Welcome! This tutorial will teach you the most crucial basics of Minetest.
110 This tutorial assumes that you have not changed the default keybindings yet.
112 Let's start for the most important keybindings right now:
114 Look around: Move the mouse
115 Walk forwards: [W]
116 Strafe left: [A]
117 Walk backwards: [S]
118 Strafe right: [D]
119 Action: [Right mouse button]
120 Pause menu (you can exit the game here): [Esc]
122 You will find signs with more introductionary texts throughout this tutorial.
123 The "action" key has many uses. For now, let's just say you need it to read
124 the signs. Look at one and right-click it to read it.
126 To look at a sign, make sure you are close enough to it and the crosshair in the
127 center of the screen points directly on the sign.
129 You can exit the tutorial at any time, the world will be automatically saved.
131 Now feel free to walk around a bit and read the other signs to learn more.]]
133 tutorial.texts.minetest =
134 [[Minetest itself is not a game, it is a game engine.
135 To be able to actually play it, you need something called a "Minetest game",
136 sometimes also called "subgame" or just "game". In this tutorial, we use the term,
137 "subgame".
139 Don't worry, Minetest comes pre-installed with a rather simple default subgame, oddly,
140 also called "Minetest"
142 This tutorial teaches you the basics of Minetest (the engine), things which are true for
143 all subgames. This tutorial does not teach you how to play a particular subgame, not
144 even the default one.
146 Minetest as well as the default subgame are unfinished at the moment, so please forgive
147 us when not everything works out perfectly.]]
149 tutorial.texts.subgame =
150 [[Now since you probably now the basics, you may want to actually play or build something.
151 Minetest comes bundled with a default subgame, which you may try out now.
152 Sadly, there is currently no tutorial for the default subgame.
153 You may want to read the "Getting Started" section of the Community Wiki,
154 which is more specific about the default subgame.
155 Said document can be found at:
157 <http://wiki.minetest.net/Getting_Started>
159 Alternatively, you may check out one of the subgames which are shared on the Minetest forums.]]
162 tutorial.texts.creative =
163 [[The creative mode is turned on. If you are here to learn how to play Minetest,
164 you should probably leave now, turn creative mode off and restart the
165 tutorial.
167 Roughly spoken, creative mode is for messing around with the game without
168 the normal gameplay restraints.
170 You can leave now by pressing "Leave tutorial", or later, by pressing [Esc].]]
172 tutorial.texts.notsingleplayer =
173 [[You are now playing the tutorial in multiplayer mode.
174 But this tutorial is optimized for the singleplayer mode.
175 This tutorial does not work properly with more than 1 player.
177 Unless you are sure no other players will join, you should
178 leave now and start the tutorial in singleplayer mode.]]
180 tutorial.texts.cam =
181 [=[Minetest has 3 different camera modes which determine the way you see the world.
182 The three modes are:
184 - First-person view (default)
185 - Third-person view from behind
186 - Third-person view from the front
188 You can change the camera mode by pressing [F7] (but you have to close this
189 window first).
191 Switch camera mode: [F7]]=]
193 tutorial.texts.blocks =
194 [[The world of Minetest is made entirely out of blocks, or cubes, to be precise.
195 Blocks can be added or removed with the correct tools.
197 In this section, we'll show you a few special but common blocks which behave in unexpected,
198 ways.,
200 Of course, subgames can come up with more special weird blocks.]]
202 tutorial.texts.falling_node =
203 [[Some blocks need to rest on top of another block, otherwise, they fall down.
204 Try it and mine the block below the uppermost block.]]
206 tutorial.texts.attached_node =
207 [[Some blocks have to be attached to another block, otherwise, they drop as an item
208 as if you would have mined it.
210 Attached here is a picture frame. You can't collect or mine it directly, but if you mine
211 the block it is attached to, it will drop as an item which you can collect.]]
213 tutorial.texts.disable_jump =
214 [[These nasty blocks on the floor prevent you from jumping when you stand on them.]]
216 tutorial.texts.runover =
217 [[This abyss behind this sign is so small that you can even walk over it,
218 as long as you don't stop midway. But you can jump over it anyways, just to be,
219 safe.]]
221 tutorial.texts.jumpup =
222 [[You can't reach this upper block by walking. But luckily, you are able to jump.
223 For our purposes, you can jump just high enough to reach one block above you.
224 But you can't two blocks high.
225 Press the space bar once to jump at a constant height.
227 Jump: [Space]
229 Now try it to continue.]]
232 tutorial.texts.jumpover =
233 [=[Here is a slightly larger abyss. Luckily, you can also jump just far enough to
234 cross a gap of this width. Don't worry, the abyss is not deep enough to hurt you
235 when you fall down. There are stairs which lead back up here.
237 Jump: [Space]]=]
239 tutorial.texts.orientation =
240 [[From this point on, there will be branching paths. For orientation, we placed
241 some arrow signs. They just show a short text when you hover them, that's all.
243 You don't have to follow the sections in any particular order, with one exception,
244 for which you will be informed.]]
246 tutorial.texts.sneak =
247 [=[Sneaking is a special move. As long as you sneak, you walk slower, but you are
248 guaranteed to not accidentally fall off the edge of a block. This also allows you to
249 "lean over" in a sense.
250 To sneak, keep the sneak key pressed. As soon as you release the sneak key,
251 you walk at normal speed again. Be careful not releasing the sneak key when you
252 are at a ledge, you might fall!
254 Sneak: [Shift]
256 Keep in mind that the [Shift] key is used for a large number of other things in Minetest.
257 Sneaking only works when you are not in a liquid stand on solid ground and are not at a
258 ladder.
260 You may try out sneaking at this little blocky pyramid.]=]
262 tutorial.texts.hotbar =
263 [[At the bottom of the screen you see 8 squares. This is called the 'hotbar'.
264 The hotbar allows you to quickly access some items from your inventory.
265 In our case, the upper 8 slots in your inventory.
266 You can change the selected item with the mouse wheel, if you have one, or with the
267 number keys.
269 Select previous item in hotbar: [Mouse wheel up]
270 Select next item in hotbar: [Mouse wheel down]
271 Select item #N in hotbar: the key with the number #N
273 The item you've seleted is also the item you wield. This will be important later for
274 tools, mining, building, etc.]]
277 tutorial.texts.eat =
278 [[In this chest you find some comestibles. Comestibles are items which instantly
279 heal you when eaten. This removes the item from your inventory.
280 To eat one, select the comestible in your hotbar, then click the left mouse button.
281 Unlike other items, you cannot punch or attack while holding a comestible. To be able
282 to attack, you have to select something else.
283 Of course, this does not have to be the only way to heal you.
285 Eat comestible: [Left mouse button]
287 Don't forget to take the gold ingot.]]
289 tutorial.texts.chest =
290 [[Treasure chests are a common sight in Minetest. They are actually not built-in
291 into the game.]]
293 tutorial.texts.damageblock =
294 [[Careful! These spikes hurt you when you stand inside, so don't walk into them.
295 Try to walk around and get the gold ingot.
297 They damage you every second you stand in them.
299 This is one of the many ways you can get hurt in Minetest.]]
301 tutorial.texts.ladder =
302 [[This is a ladder. Ladders help you to climb up great heights or to climb down safely.
303 To climb a ladder, go into the block occupied by the ladder and hold one of the
304 following keys:
306 Climb up ladder: [Space]
307 Climb down ladder: [Shift]
309 Note that sneaking and jumping do not work when you are at a ladder.]]
311 tutorial.texts.swim =
312 [[What you see here is a small swimming pool. You are able to swim and dive.
313 Diving usually costs you breath. While diving, 10 bubbles appear in the heads-up display.
314 These bubbles disappear over time while diving and when you are out of bubbles,
315 you slowly lose some health points. You have to back up to the surface from time to
316 time to restore the bubbles.
318 Movement in a liquid is slightly different than on solid ground:
320 Swim forwards: [W]
321 Swim backwards: [S]
322 Swim leftwards: [A]
323 Swim rightwards: [D]
324 Swim upwards: [Space]
325 Swim downwards: [Shift]
327 At the bottom of the pool lies a gold ingot. Try to get it!]]
330 tutorial.texts.dive =
331 [=[To get to the other side, you have to dive here. Don't worry, the tunnel is not
332 long. But don't stay too long in the water, or else you take damage.
333 At the bottom of the pool lies a gold ingot. Try to get it!
335 Swim forwards: [W]
336 Swim backwards: [S]
337 Swim leftwards: [A]
338 Swim rightwards: [D]
339 Swim upwards: [Space]
340 Swim downwards: [Shift]]=]
342 tutorial.texts.waterfall = ""..
343 [=[You can easily swim up this waterfall. Go into the water and hold the space bar until you're
344 at the top
346 Swim forwards: [W]
347 Swim backwards: [S]
348 Swim leftwards: [A]
349 Swim rightwards: [D]
350 Swim upwards: [Space]
351 Swim downwards: [Shift]]=]
353 tutorial.texts.liquidtypes =
354 [=[Liquids behave somewhat weirdly in Minetest. Actually, there are 2 kinds of liquids.
355 If you watched the waterfall closely, you may have noticed that there is a slight difference
356 between the water blocks that make the waterfall, and those up here in the basin.
358 Minetest distinguishes between liquid source and flowing liquid.
360 A liquid source block is always a full cube.
361 A flowing liquid block looks slightly different. Often, it is not a full cube, but has a more or less
362 triangular shape. Also, flowing liquids usually have an unique "flowing" animation, but this may
363 not be the case for all liuqids.
365 Up in the basin, you see four rows of liquid sources, followed by one row of flowing
366 liquids, followed by the waterfall itself. The waterfall itself is solely made of flowing liquids.
368 Liquid sources generate flowing liquids around them. Liquid sources can also exist on their own.
369 Flowing liquids are not able to exist on their own. They have to originate from a liquid source.
370 If the liquid source is gone, or the way to one is blocked, the flowing liquid will slowly dry
371 out.
373 To the left of this sign is a special block. When used, it will block the liquid flow.
374 Use that block, being close enough and looking at it, and watch the waterfall dry out.
376 Use something: [Right mouse button]]=]
378 tutorial.texts.viscosity =
379 [[Minetest mods can introduce various liquids which differ in their properties.
380 Probably the most important property is their viscosity. Here you have some
381 pools which differ in their viscosity. Feel free to try them out.]]
383 tutorial.texts.pointing1 =
384 [[An important general concept in Minetest is pointing. As mentioned earlier,
385 there is a crosshair in the center of the screen.
387 You can point several things in Minetest:
389 - Blocks
390 - Dropped items
391 - Other players
392 - Many other things
394 You can only point one thing at once, or nothing at all. You can tell when
395 you point something if it is surrounded by a thin cuboid wireframe.
397 To point something, three conditions have to be met:
398 1. The thing in question must be pointable at all
399 2. Your crosshair must be exactly over the thing in question
400 3. You must be close enough to the thing
402 When a thing is pointed, you can do different stuff with it; e.g. collecting it,
403 punching it, building to it, etc. We come to all that later.
405 Now collect that apple from the small tree in front of this sign, and the gold bar.
406 To do that, you must point it and click with the left mouse button.]]
409 tutorial.texts.pointing2 =
410 [[The distance you need to point to things solely depends on the tool you carry.
411 Most tools share a default value but some tools may have a longer or shorter distance.
413 At the moment, your only "tool" is the hand. It was good enough to collect the apple
414 from the small tree.
416 Above this sign hang some apples, but you cannot reach them by normal means. At the
417 wall in front of this sign lies a special example tool which you can use to retrieve the apple
418 from afar.
420 To take the tool, point to it and click the left mouse button. Then select it with the
421 mouse wheel or the number keys. You will learn more about tools in a different section.]]
423 tutorial.texts.health =
424 [[Unless you have damage disabled, all players start with 20 hit points (HP), represented
425 by ten hearts in the heads-up display. One HP is represented by half a heart in this
426 tutorial, but the actual representation can vary from subgame to subgame.
428 You can take damage for the following reasons (including, but not limited to):
429 - Falling too deep
430 - Standing in a block which hurts you
431 - Attacks from other players
432 - Staying too long in a liquid
434 In this tutorial, you can regain health by eating a comestible. This is only an example,
435 mods and subgames may come with other mechanisms to heal you.
437 When you lose all your hit points, you die. Death is normally not really that bad in Minetest.
438 When you die, you will usually lose all your possessions. You are able to put yourself
439 into the world immediately again. This is called "respawning". Normally you appear at a
440 more or less random location.
441 In the tutorial you can die, too, but don't worry about that. You will
442 respawn at a special location you can't normally reach and keep all your posessions.
443 Subgames may introduce special events on a player's death.]]
445 tutorial.texts.death =
446 [[Oops! So it seems you just have died. Don't worry, you don't have lost any of your
447 possessions and you have been revived. You are still in Tutorial World at a different
448 location.
450 You have arrived at the so-called respawn location of Tutorial World. You will
451 always appear here after you died. This is called "respawning". In most worlds,
452 however, you will respawn in a slightly randomized location.
454 The tutorial uses a so-called fixed spawn point, so you respawn always at the same
455 spot. This is unusual for singleplayer worlds, but in online play some servers,
456 use fixed spawn points, too.
458 Under normal conditions you would have lost all or a part of your possessions or some
459 other bad thing would have happened to you. But not here, this is a tutorial.
461 To continue, just drop out at the end of that gangway. The drop is safe.]]
466 tutorial.texts.items =
467 [[Throughout your journey, you will probably collect many items. Once you collected
468 them, blocks are considered to be items, too.
470 Items can be stored in your inventory and selected with the hotbar (see the other signs).
471 You can wield any items; you can even punch with almost any item to hurt enemies.
472 Usually, you will deal a minimal default damage with most items. Even if you do not hold,
473 an item at all.
474 If you don't want to have an item anymore, you can always throw it away. Likewise,
475 you can collect items which lie around by pointing and leftclicking them.
477 Collect item: [Left mouse button]
478 Drop carried item stack: [Q]
479 Drop single item from carried item stack: [Shift] + [Q]
481 On the ledge at the right to this sign lies an item stack of 50 rocks so you have some items,
482 to test out the inventory.]]
484 tutorial.texts.tools =
485 [[A tool is a special kind of item.
486 Tools can be used for many things, such as:
487 - Breaking blocks
488 - Collecting liquids
489 - Rotating blocks
490 - Many others!
491 The number of tools which are possible in Minetest are innumberable and are
492 too many to cover in this tutorial.
493 But at least we will look at a very common and important tool type: mining tools,
494 We will come to that in the mining section.
496 Many tools wear off and get destroyed after you used them for a while. In an
497 inventory the tool's "health" is indicated by a colored bar
499 Tools may be able to be repaired, see the sign about repairing.]]
501 tutorial.texts.inventory =
502 [[The inventory menu usually contains the player inventory. This allows you
503 to carry along items throughout the world.
505 Every inventory is made out of slots where you can store items in. You can store one
506 entire stack of items per slot, the only condition is that the items are of the same
507 type. In this tutorial all items except for tools stack up to 99 items, but this number
508 can vary in actual subgames.
510 Here are the controls which explain how to move around the items within the inventory:
512 In the game:
513 Open inventory menu: [I]
515 When the inventory is opened and you don't hold any items:
516 Take item stack: [Left mouse button]
517 Take 10 items from item stack: [Middle mouse button]
518 Take half item stack: [Right mouse button]
520 When you took an item stack in the inventory:
521 Put item stack: [Left mouse button]
522 Put 10 items from item stack: [Middle mouse button]
523 Put single item from item stack: [Right mouse button]
525 You can also drop an item stack by holding it in the inventory, then clicking anywhere
526 outside of the window.]]
528 tutorial.texts.chest =
529 [[This is a chest. You can view its contents by right-clicking it. In the menu you will see
530 two inventories, on the upper part the chest inventory and on the lower part the player
531 inventory. Exchanging items works exactly the same as in the inventory menu.]]
534 tutorial.texts.build =
535 [[Another important task in Minetest is building blocks.
536 Building" here refers to the task of placing one block in your possession onto
537 another block in the world.
538 Unlike mining, building a block happens instantanous. To build, select a block in your
539 hotbar, point to any block in the world and press the right mouse button.
540 Your block will be immediately placed on the pointed side.
541 It is important that the block you want to build to is pointable. This means you cannot build
542 next to or on liquids by normal means.
544 Build on ordinary block: [Right mouse button]
546 Try to get up to that little hole by using the wood blocks in the chest. There is another
547 gold ingot waiting for you.]]
549 tutorial.texts.mine =
550 [[Mining is a method to remove a single block with a mining tool. It is a very important
551 task in Minetest which you will use often.
553 (It is recommended that you go to the crafting and items house first. It is right in front of
554 this sign.)
556 To be able to mine a block, you need
558 1. to have minable block, after all,
559 2. to point on the block and
560 3. to carry an appropriate tool.
562 Mine: [Left mouse button]
564 When you are ready, hold the left mouse button while pointing the block. Depending on
565 the block type and the tool properties, this can take some time. Some tools are fast with
566 some particular block types, some other tools may be slower to mine other block types.
567 If you do not carry an appropriate tool, you are not able to mine the block at all.
568 You can tell that you are actually mining when you see cracks or some other animation
569 on the block in question.
571 When done mining, blocks will often add one or more items to your inventory. This is called
572 the "drop" of a block and depends on the block type. Now try to mine those large cubes in
573 this area, using different tools. Note that all blocks here are just examples to show you
574 different kinds of drops.]]
576 tutorial.texts.mine_cobble =
577 [[This is cobblestone. You can mine it with a pickaxe.
578 This cobblestone will always drop itself, that means, cobblestone. Dropping itself is the
579 usual dropping behaviour of a block, throughout many subgames.]]
581 tutorial.texts.mine_wood =
582 [[These are wooden planks. In the tutorial, you can only mine those blocks with an axe.
583 Wooden planks drop themselves.
585 In Minetest, we use the term "mining" in a general sense, regardless of the material.]]
587 tutorial.texts.mine_conglomerate =
588 [[This is a cube of conglomerate. You need a pickaxe to mine it.
589 Conglomerate drops something based on probability. Conglomerate randomly drops between 1
590 and 5 rocks, when mined.]]
592 tutorial.texts.mine_glass =
593 [[This is some weak glass. You can break it with your bare hands. Or you can use your pickaxe,
594 which is faster. Note that it looks slightly different than the other glass in this world.
595 These glass blocks don't drop anything.]]
597 tutorial.texts.mine_stone =
598 [[This is stone. You need a pickaxe to mine it. When mined, stone will drop cobblestone.]]
600 tutorial.texts.mine_immortal =
601 [[There can always be some blocks which are not minable by any tool. In our tutorial, all
602 those castle walls can't me mined, for example.]]
604 tutorial.texts.craft1 =
605 [[Crafting is the task of taking several items and combining them to form a new item.
606 Crafting is another important task in Minetest.
608 To craft something, you need a few items and a so-called crafting grid.
610 In this tutorial, you have a grid of size 3 times 3 in your inventory.
611 Let's get right into crafting:
613 1. Take 3 sheets of paper from the chest next to this sign.
614 2. Open the inventory menu with [I].
615 3. Place the paper in the crafting grid so that they form a 1×3 vertical line.
616 4. A book should appear in the output slot. Click on it to take it,
617 then put it in your player inventory.
619 This process consumes the paper.
620 When you have the book in your inventory, go on with the next sign.]]
622 tutorial.texts.craft2 =
623 [[To craft the book you have used a so-called crafting recipe. You must know the crafting
624 recipes as well so you can craft.
626 The crafting recipe you used in particular is a so-called shaped recipe. This means the
627 pattern you place in the crafting grid matters, but you can move the entire pattern
628 freely.
630 There is another kind of crafting recipe: Shapeless.
631 Shapeless recipes only care about which items you place in the crafting grid, but not in
632 which pattern. In the next chest you find some wheat. Let's make dough from it! For this,
633 you have to place at least 1 wheat in 4 different slots, but the other slots must be empty.
634 What is special about this recipe is that you can place them anywhere in the grid.
636 When you got your dough, go on with the next sign.]]
638 tutorial.texts.craft3 =
639 [[Do you got your dough? Good.
641 You may have noticed that crafting always consumes one item from each occupied slot
642 of the crafting grid. This is true for all crafting recipes.
643 You can speed crafting up a bit when you click with the middle mouse button on the
644 item in the output slot. Doing so will attempt to do the same craft up to 10 times,
645 instead of just once.
647 Feel free to try it with the remaining wheat or just go on with the next sign.]]
649 tutorial.texts.craft4 =
650 [[Another important thing to know about crafting are so-called groups. Crafting recipes do
651 not always require you to use the exactly same items every time.
652 This tutorial has a special recipe for books. In the chest, you will find paper in 4
653 different colors. You can also make a book by placing 3 paper sheets of any color
654 in a vertical line.
655 The paper color does not matter here, you can use only white paper, only orange paper
656 or even mix it. What is important here are the occupied slots.
657 This is possible because all 4 types of (example) paper belong to the same group and
658 our book recipe accepts not only white paper, but any paper of that group.
660 Feel free to experiment a bit around with this.]]
662 tutorial.texts.smelt =
663 [[This is a furnace. Furnaces can be used to turn a smeltable item with help of a fuel
664 to a new item. Many items can be furnace fuels, but not all. A few items are smeltable.
666 In order to operate a furnace, you have to put the smeltable item into the 'Source' slot
667 and the fuel into the 'Fuel' slot.
668 As soon as the items have been placed, the furnace automatically starts to smelt the
669 items. The furnace becomes active and consumes an item in the fuel slot. The flame
670 goes on and will continue burning for a given time. The time depends on the fuel type.
671 ome fuels burn very short, and other burn longer. In the furnace menu, the burn time
672 is indicated by the flame symbol. As soon as the flame goes out, the furnace may
673 continue burning if there is still fuel and smeltable material in the furnace,
674 otherwise, the furnace becomes inactive again.
675 The smeltable material has to be exposed to the flame for a given time as well. This
676 time depends on the type of the material, too. Some material smelt faster than others.
677 You can see the smelting progress of a single item on the progress arrow. If one item
678 has been smelt, the result goes to one of the output slots, where you can take it.
680 In the left chest you find some fuels and in the right chest you find some materials to
681 smelt. Feel free to experiment with the furnace a bit. Smelt the gold lump to receive
682 this station's gold bar.
684 Again, this furnace is just an example; the exact operation may differ slightly from
685 subgame to subgame.]]
687 tutorial.texts.repair =
688 [[Some subgames may come with a special recipe which allows you to repair your tools.
689 In those, repairing works always the same way:
690 Place two more or less worn out tools of the same kind into the crafting crid and
691 take the result. The result is a new tool which is slightly repaired by a fixed percentage.
693 Of course, this tutorial comes with such a recipe. The chest next to this sign stores
694 some damaged tools which you may try to repair now.]]
697 tutorial.texts.use =
698 [=[You will often meet some blocks you can use. Something special happens when you
699 right-click while pointing on them.
700 In fact, you already used such blocks: All the signs you read are "usable" blocks.
702 There is a strange device next to this sign. Use it and see what happens.
704 Use usable block: [Right mouse button]]=]
707 tutorial.texts.basic_end =
708 [[If you think you have enough of this tutorial, you can leave at any time. There are
709 14 gold ingots at the stations to be found, to help you keep track.
711 "You can find the gold ingots at the following stations:
712 - Ladders,"..
713 - Sneaking,"..
714 - Swimming,"..
715 - Diving,"..
716 - Waterfall,"..
717 - Viscosity,"..
718 - Comestibles and Eating,"..
719 - Pointing,"..
720 - Crafting,"..
721 - Smelting,"..
722 - Mining,"..
723 - Building,"..
724 - Damage and Health,"..
726 If you got 14 gold ingots (in total), you probably know now everything
727 which can be learned from this tutorial. Collecting the gold ingots is optional and won't give you
728 anything special.
730 After you closed this dialog, you can press [Esc] to open the pause menu and return
731 to the main menu or quit Minetest.
733 In the next room there are some further signs with information, but it is entirely optional
734 and not related to gameplay.]]
736 tutorial.texts.fallout =
737 [[You somehow managed to fall from the castle or got otherwise below it!
738 How did you do that?
740 Anyways, you've got teleported back to the starting location. Whatever you did, be more
741 careful next time.]]
743 tutorial.texts.first_gold =
744 [[You have collected your first gold ingot. Those will help you to keep track in this tutorial.
745 There are 14 gold ingots in this tutorial.
747 There is a gold ingot at every important station. If you collected all ingots, you are
748 done with the tutorial, but collecting the gold ingots is not mandatory.]]
750 tutorial.texts.last_gold =
751 [[You have collected all the gold ingots in this tutorial.
753 This means you have now travelled to each station. If you read and understood everything,
754 you have learned everything which can be learned from this tutorial.
756 If this is the case, you are finished with this tutorial and can leave now. But feel
757 free to stay in this world to explore the area a bit further.
759 You may also want to visit the Good-Bye room, which has a few more informational
760 signs with supplemental information, but nothing of is is essential or gameplay-relevant.
762 If you want to stay, you leave later by pressing [Esc] to open the pause menu and then
763 return to the main menu or quit Minetest.]]
765 tutorial.texts.first_diamond =
766 [[Great, you have found and collected a hidden diamond! In Tutorial World, there are 12 hidden
767 diamonds. Can you find them all? The first diamond may have been easy to collect, but the
768 remaining 11 diamonds probably won't be that easy.
770 There won't be any special event or bonus, however, if you manage to collect all
771 diamonds, apart from feeling special, maybe. ;-)]]
773 tutorial.texts.last_diamond =
774 [[Congratulations!
775 You have collected all the diamonds of Tutorial World!
777 You can feel special now.]]
780 tutorial.texts.controls =
781 [[To recap, here is an overview over the most important default controls:
783 Move forwards: [W]
784 Move left: [A]
785 Move backwards: [S]
786 Move right: [D]
787 Jump: [Space]
788 Sneak: [Shift]
789 Move upwards (ladder/liquid): [Space]
790 Move downwards (ladder/liquid): [Shift]
792 Toggle camera mode: [F7]
794 Select item in hotbar: [Mouse wheel]
795 Select item in hotbar: [0] - [9]
796 Inventory menu: [I]
798 Collect pointed item: [Left mouse button]
799 Drop item stack: [Q]
800 Drop single item: [Shift] + [Q]
802 Punch: [Left mouse button]
803 Mine: [Left mouse button]
804 Build/use: [Right mouse button]
805 Build: [Shift] + [Right mouse button]
807 Abort/open pause menu: [Esc]
809 You can review a shorter version of the controls in the pause menu.]]
812 tutorial.texts.online =
813 [[You may want to check out these online resources related to Minetest:
815 Official homepage of Minetest: <http://minetest.net/>
816 The main place to find the most recent version of Minetest.
818 Community wiki: <http://wiki.minetest.net/>
819 A community-based documentation website for Minetest. Anyone with an account can edit
820 it! It also features a documentation of the default game, which was NOT covered by
821 this tutorial.
823 Webforums: <http://forums.minetest.net/>
824 A web-based discussion platform where you can discuss everything related to Minetest.
825 This is also a place where player-made mods and subgames are published and
826 discussed. The discussions are mainly in English, but there is also space for
827 discussion in other languages.
829 Chat: <irc://irc.freenode.net#minetest>
830 A generic Internet Relay Chat channel for everything related to Minetest where people can
831 meet to discuss in real-time.
832 If you do not understand IRC, see the Community Wiki for help.]]
835 tutorial.register_infosign("intro", "Introduction", tutorial.texts.intro)
836 tutorial.register_infosign("minetest", "Minetest", tutorial.texts.minetest)
837 tutorial.register_infosign("cam", "Player Camera", tutorial.texts.cam)
838 tutorial.register_infosign("runover", "Small Abysses", tutorial.texts.runover)
839 tutorial.register_infosign("jumpup", "Jumping (1)", tutorial.texts.jumpup)
840 tutorial.register_infosign("jumpover", "Jumping (2)", tutorial.texts.jumpover)
841 tutorial.register_infosign("sneak", "Sneaking", tutorial.texts.sneak)
842 tutorial.register_infosign("orientation", "Information about the following tutorial sections", tutorial.texts.orientation)
843 tutorial.register_infosign("hotbar", "Hotbar", tutorial.texts.hotbar)
844 tutorial.register_infosign("eat", "Comestibles and Eating", tutorial.texts.eat)
845 tutorial.register_infosign("chest", "Chests", tutorial.texts.chest)
846 tutorial.register_infosign("damageblock", "Blocks Which Hurt You", tutorial.texts.damageblock)
847 tutorial.register_infosign("ladder", "Climbing Ladders", tutorial.texts.ladder)
848 tutorial.register_infosign("swim", "Swimming", tutorial.texts.swim)
849 tutorial.register_infosign("dive", "Diving", tutorial.texts.dive)
850 tutorial.register_infosign("waterfall", "Swimming up a Waterfall", tutorial.texts.waterfall)
851 tutorial.register_infosign("viscosity", "Viscosity", tutorial.texts.viscosity)
852 tutorial.register_infosign("liquidtypes", "Liquid sources and flowing liquids", tutorial.texts.liquidtypes)
853 tutorial.register_infosign("pointing1", "Pointing (1)", tutorial.texts.pointing1)
854 tutorial.register_infosign("pointing2", "Pointing (2)", tutorial.texts.pointing2)
855 tutorial.register_infosign("health", "Health and Damage", tutorial.texts.health)
856 tutorial.register_infosign("death", "Death and Respawning", tutorial.texts.death)
857 tutorial.register_infosign("items", "Items", tutorial.texts.items)
858 tutorial.register_infosign("tools", "Tools", tutorial.texts.tools)
859 tutorial.register_infosign("inventory", "Using the Inventory", tutorial.texts.inventory)
860 tutorial.register_infosign("chest", "Comment About Chests", tutorial.texts.chest)
861 tutorial.register_infosign("build", "Building Some Blocks", tutorial.texts.build)
862 tutorial.register_infosign("mine", "Mining blocks", tutorial.texts.mine)
863 tutorial.register_infosign("mine_cobble", "Mining example: Cobblestone", tutorial.texts.mine_cobble)
864 tutorial.register_infosign("mine_stone", "Mining example: Stone", tutorial.texts.mine_stone)
865 tutorial.register_infosign("mine_conglomerate", "Mining example: Conglomerate", tutorial.texts.mine_conglomerate)
866 tutorial.register_infosign("mine_wood", "Mining example: Wooden Planks", tutorial.texts.mine_wood)
867 tutorial.register_infosign("mine_glass", "Mining example: Weak glass", tutorial.texts.mine_glass)
868 tutorial.register_infosign("mine_immortal", "Unminable blocks", tutorial.texts.mine_immortal)
869 tutorial.register_infosign("blocks", "Special blocks", tutorial.texts.blocks)
870 tutorial.register_infosign("disable_jump", "No-jumping blocks", tutorial.texts.disable_jump)
871 tutorial.register_infosign("falling_node", "Falling blocks", tutorial.texts.falling_node)
872 tutorial.register_infosign("attached_node", "Attached blocks", tutorial.texts.attached_node)
873 tutorial.register_infosign("use", "Using blocks", tutorial.texts.use)
874 tutorial.register_infosign("craft1", "Crafting Basics", tutorial.texts.craft1)
875 tutorial.register_infosign("craft2", "Crafting using Shapeless Recipes", tutorial.texts.craft2)
876 tutorial.register_infosign("craft3", "Crafting Faster", tutorial.texts.craft3)
877 tutorial.register_infosign("craft4", "Crafting Groups", tutorial.texts.craft4)
878 tutorial.register_infosign("smelt", "Furnace Operation Instructions", tutorial.texts.smelt)
879 tutorial.register_infosign("repair", "Repairing Tools", tutorial.texts.repair)
880 tutorial.register_infosign("basic_end", "End of the Basic Tutorial", tutorial.texts.basic_end)
881 tutorial.register_infosign("controls", "Controls Overview", tutorial.texts.controls)
882 tutorial.register_infosign("online", "Online Resources", tutorial.texts.online)
883 tutorial.register_infosign("subgame", "Subgames", tutorial.texts.subgame)
885 minetest.register_node("tutorial:wall", {
886 description = S("reinforced wall"),
887 tiles = {"default_stone_brick.png"},
888 is_ground_content = true,
889 groups = {immortal=1},
890 sounds = default.node_sound_stone_defaults(),
893 minetest.register_node("tutorial:reinforced_glass", {
894 description = S("reinforced glass"),
895 drawtype = "glasslike",
896 tiles = {"tutorial_reinforced_glass.png"},
897 inventory_image = minetest.inventorycube("tutorial_reinforced_glass.png"),
898 paramtype = "light",
899 sunlight_propagates = true,
900 groups = { immortal=1 },
901 sounds = default.node_sound_glass_defaults(),
904 minetest.register_node("tutorial:weak_glass", {
905 description = S("weak glass"),
906 drawtype = "glasslike",
907 tiles = {"tutorial_weak_glass.png"},
908 inventory_image = minetest.inventorycube("tutorial_weak_glass.png"),
909 paramtype = "light",
910 sunlight_propagates = true,
911 groups = { cracky=3, oddly_breakable_by_hand=1 },
912 drop = "",
913 sounds = default.node_sound_glass_defaults(),
917 minetest.register_tool("tutorial:snatcher", {
918 description = S("apple snatcher"),
919 inventory_image = "tutorial_snatcher.png",
920 wield_image = "tutorial_snatcher.png",
921 wield_scale = { x = 1, y = 1, z = 1 },
922 range = 10,
923 tool_capabilities = {},
926 --[[ A special switch which, when flipped, exchanges day for night and vice versa. ]]
927 minetest.register_node("tutorial:day", {
928 description = S("day/night switch (day)"),
929 tiles = { "tutorial_day.png" },
930 groups = {immortal=1},
931 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
932 minetest.set_timeofday(0)
933 minetest.set_node(pos, {name="tutorial:night"})
936 minetest.register_node("tutorial:night", {
937 description = S("day/night switch (night)"),
938 tiles = { "tutorial_night.png" },
939 groups = {immortal=1},
940 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
941 minetest.set_timeofday(0.5)
942 minetest.set_node(pos, {name="tutorial:day"})
946 --[[ A special switch which "activates" and "deactivates" the waterfall in Tutorial World.
947 It only works on a prepared map! ]]
948 minetest.register_node("tutorial:waterfall_on", {
949 description = S("waterfall switch (on)"),
950 tiles = { "tutorial_waterfall_on.png" },
951 groups = {immortal=1},
952 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
953 local wpos = { y = 5, z = 86 }
954 for x=33,46 do
955 wpos.x = x
956 minetest.set_node(wpos, {name="tutorial:wall"})
958 minetest.set_node({x=30,y=7,z=91}, {name="tutorial:waterfall_off"})
959 minetest.set_node({x=40,y=2,z=86}, {name="tutorial:waterfall_off"})
962 minetest.register_node("tutorial:waterfall_off", {
963 description = S("waterfall switch (off)"),
964 tiles = { "tutorial_waterfall_off.png" },
965 groups = {immortal=1},
966 on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
967 local wpos = { y = 5, z = 86 }
968 for x=33,46 do
969 wpos.x = x
970 minetest.remove_node(wpos)
972 minetest.set_node({x=30,y=7,z=91}, {name="tutorial:waterfall_on"})
973 minetest.set_node({x=40,y=2,z=86}, {name="tutorial:waterfall_on"})
977 --[[ This function shows a simple dialog window with scrollable text
978 name: name of the player to show the formspec to
979 caption: Caption of the dialog window (not escaped)
980 text: The text to be shown. Must be escaped manually for formspec, an unescaped
981 comma generates a line break.
983 function tutorial.show_default_dialog(name, caption, text)
984 local formspec = "size[12,6]"..
985 "label[-0.15,-0.4;"..minetest.formspec_escape(caption).."]"..
986 "tablecolumns[text]"..
987 "tableoptions[background=#000000;highlight=#000000;border=false]"..
988 "table[0,0.25;12,5.2;text_table;"..
989 tutorial.convert_newlines(F(text))..
990 "]"..
991 "button_exit[4.5,5.5;3,1;close;Close]"
992 minetest.show_formspec(name, "tutorial_dialog", formspec)
995 minetest.register_on_joinplayer(function(player)
996 local formspec = nil
997 if(minetest.is_singleplayer() == false) then
998 formspec = "size[12,6]"..
999 "label[-0.15,-0.4;"..F("Warning: You're not playing in singleplayer mode").."]"..
1000 "tablecolumns[text]"..
1001 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1002 "table[0,0.25;12,5.2;creative_text;"..
1003 tutorial.convert_newlines(F(tutorial.texts.notsingleplayer))..
1004 "]"..
1005 "button_exit[2.5,5.5;3,1;close;"..F("Continue anyways").."]"..
1006 "button_exit[6.5,5.5;3,1;leave;"..F("Leave tutorial").."]"
1007 elseif(minetest.setting_getbool("creative_mode")) then
1008 formspec = "size[12,6]"..
1009 "label[-0.15,-0.4;"..(F("Warning: Creative mode is active")).."]"..
1010 "tablecolumns[text]"..
1011 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1012 "table[0,0.25;12,5.2;creative_text;"..
1013 tutorial.convert_newlines(F(tutorial.texts.creative))..
1014 "]"..
1015 "button_exit[2.5,5.5;3,1;close;"..F("Continue anyways").."]"..
1016 "button_exit[6.5,5.5;3,1;leave;"..F("Leave tutorial").."]"
1018 else
1019 if(tutorial.state.first_join==true) then
1020 formspec = "size[12,6]"..
1021 "label[-0.15,-0.4;"..F("Introduction").."]"..
1022 "tablecolumns[text]"..
1023 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1024 "table[0,0.25;12,5.2;intro_text;"..
1025 tutorial.convert_newlines(F(tutorial.texts.intro))..
1026 "]"..
1027 "button_exit[4.5,5.5;3,1;close;"..F("Close").."]"
1029 tutorial.state.first_join = false
1030 tutorial.save_state()
1032 if(formspec~=nil) then
1033 minetest.show_formspec(player:get_player_name(), "intro", formspec)
1038 minetest.register_on_player_receive_fields(function(player, formname, fields)
1039 if(fields.leave) then
1040 minetest.kick_player(player:get_player_name(), S("You have voluntarily exited the tutorial."))
1042 if(fields.gotostart) then
1043 tutorial.back_to_start(player)
1045 if(fields.gotoend) then
1046 tutorial.go_to_end(player)
1048 end)
1050 tutorial.steptimer = 0
1051 minetest.register_globalstep(function(dtime)
1052 tutorial.steptimer = tutorial.steptimer + dtime
1053 local players = minetest.get_connected_players()
1054 if(tutorial.steptimer > 2) then
1055 for p=1,#players do
1056 local player = players[p]
1057 local name = player:get_player_name()
1058 if(player:getpos().y < -12 and (not minetest.setting_getbool("creative_mode"))) then
1059 -- teleport players back to the start when they fell away
1060 tutorial.back_to_start(player)
1061 tutorial.show_default_dialog(name, S("You fell from the castle!"), tutorial.texts.fallout)
1063 else
1064 local inv = player:get_inventory()
1065 local state_changed = false
1067 if(tutorial.state.first_gold ~= true) then
1068 local gold_stack = ItemStack("default:gold_ingot 1")
1069 if(inv:contains_item("main", gold_stack)) then
1070 tutorial.show_default_dialog(
1071 name,
1072 S("Gold ingots in the tutorial"),
1073 tutorial.texts.first_gold
1075 tutorial.state.first_gold = true
1076 state_changed = true
1079 if(tutorial.state.last_gold ~= true) then
1080 local gold_stack = ItemStack("default:gold_ingot "..tostring(tutorial.gold))
1081 if(inv:contains_item("main", gold_stack)) then
1082 local formspec = "size[12,6]"..
1083 "label[-0.15,-0.4;"..F("You've finished the tutorial!").."]"..
1084 "tablecolumns[text]"..
1085 "tableoptions[background=#000000;highlight=#000000;border=false]"..
1086 "table[0,0.25;12,5.2;creative_text;"..
1087 tutorial.convert_newlines(F(tutorial.texts.last_gold))..
1088 "]"..
1089 "button_exit[0.5,5.5;3,1;close;"..F("Continue").."]"..
1090 "button_exit[4.5,5.5;3,1;leave;"..F("Leave tutorial").."]"..
1091 "button_exit[8.5,5.5;3,1;gotoend;"..F("Go to Good-Bye room").."]"
1093 minetest.show_formspec(name, "tutorial_last_gold", formspec)
1095 tutorial.state.last_gold = true
1096 state_changed = true
1100 if(tutorial.state.first_diamond ~= true) then
1101 local diamond_stack = ItemStack("default:diamond 1")
1102 if(inv:contains_item("main", diamond_stack)) then
1103 tutorial.show_default_dialog(
1104 name,
1105 S("You found a hidden diamond!"),
1106 tutorial.texts.first_diamond
1108 tutorial.state.first_diamond = true
1109 state_changed = true
1112 if(tutorial.state.last_diamond ~= true) then
1113 local diamond_stack = ItemStack("default:diamond "..tostring(tutorial.diamonds))
1114 if(inv:contains_item("main", diamond_stack)) then
1115 tutorial.show_default_dialog(
1116 name,
1117 S("You have collected all hidden diamonds!"),
1118 tutorial.texts.last_diamond
1120 tutorial.state.last_diamond = true
1121 state_changed = true
1125 if(state_changed) then
1126 tutorial.save_state()
1130 tutorial.steptimer = 0
1132 end)
1134 function tutorial.back_to_start(player)
1135 player:setpos({x=42,y=0.5,z=28})
1138 function tutorial.go_to_end(player)
1139 player:setpos({x=23,y=0.5,z=74})
1142 --[[
1143 FIXME: This does not work in 0.4.10 thanks to a bug. Uncomment this as soon as
1144 set_physics_override gets fixed
1146 function tutorial.disable_sneak_glitch(player)
1147 player:set_physics_override({sneak_glitch=false, sneak=false})
1150 minetest.register_on_newplayer(tutorial.disable_sneak_glitch)
1151 minetest.register_on_joinplayer(tutorial.disable_sneak_glitch)
1152 minetest.register_on_respawnplayer(tutorial.disable_sneak_glitch)
1156 --[[
1157 Helper tools for sign text extracting
1158 must be called with /lua from luacmd
1159 An ugly, quick and dirty hack.
1160 TODO: Toss away intllib in favor of gettext as soon as possible
1163 function tutorial.convert_newlines_for_intllib(str)
1164 local function convert(s)
1165 return s:gsub("\n", function(slash, what)
1166 return "\\n"
1167 end)
1170 return convert(str)
1173 function tutorial.extract_texts()
1174 local filepath = minetest.get_modpath("tutorial").."/locale/template_texts.txt"
1175 local file = io.open(filepath, "w")
1176 if(file) then
1177 for k,v in pairs(tutorial.texts) do
1178 file:write("# Tutorial text: "..k.."\n")
1179 file:write(tutorial.convert_newlines_for_intllib(v).."\n\n")
1181 else
1182 minetest.log("error", "[tutorial] An attempt to write into "..filepath.." failed.")
1184 io.close(file)