1---------------------------------------------------------------------
2-- This file is part of Freedroid
3--
4-- Freedroid is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
8--
9-- Freedroid is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14-- You should have received a copy of the GNU General Public License
15-- along with Freedroid; see the file COPYING. If not, write to the
16-- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17-- MA 02111-1307 USA
18----------------------------------------------------------------------
19--[[WIKI
20PERSONALITY = { "Helpful" },
21PURPOSE = "$$NAME$$ guides the player through the various aspects of playing the game."
22WIKI]]--
23
24local Npc = FDrpg.get_npc()
25local Tux = FDrpg.get_tux()
26
27-- helper functions for the quickmenu thingy
28
29local function tutorial_chests_and_armor_and_shops()
30	tut_tux_items_entered = true
31	tut_tux_chest_entered = true
32end
33
34local function tutorial_melee_combat()
35	tutorial_chests_and_armor_and_shops()
36
37	tut_tux_melee_entered = true
38	Tux:add_item("Normal Jacket")
39	Tux:add_item("Improvised Buckler")
40	Tux:add_item("Shoes")
41	Tux:add_item("Worker Helmet")
42end
43
44local function tutorial_abilities()
45	tutorial_melee_combat()
46
47	tut_tux_terminal_entered = true
48end
49
50local function tutorial_upgrade_items_and_terminal()
51	tutorial_abilities()
52end
53
54local function tutorial_hacking()
55	tutorial_upgrade_items_and_terminal()
56
57	tut_tux_takeover_entered = true
58end
59
60local function tutorial_ranged_combat()
61	tutorial_hacking()
62
63	tut_tux_glass_entered = true
64end
65
66local items_up = {"Entropy Inverter", "Tachyon Condensator", "Antimatter-Matter Converter", "Superconducting Relay Unit", "Plasma Transistor"}
67
68-- actual dialog
69
70return {
71	FirstTime = function()
72		-- initialize
73		TutorialTom_doors = {"TutorialEntry", "TutorialZigzag1", "TutorialZigzag2", "TutorialZigzag3", "TutorialZigzag4"}
74		TutorialTom_doors2 = {TutorialTom_doors[1], TutorialTom_doors[2], TutorialTom_doors[3], TutorialTom_doors[4], TutorialTom_doors[5], "TutorialEquipOut", "TutorialMeleeOut", "TutorialDoor", "TutorialGlasswallDoor", "TutorialStorage", "TutorialTakeover", "TutorialExit1"}
75		ranged_combat = {"Normal Jacket", "Big kitchen knife", "Shoes", "Standard Shield", "Worker Helmet"}
76		-- to avoid excessive map validator waypoint errors, map starts with all relevant doors open, so we need to close them here
77		for var in ipairs(TutorialTom_doors2) do
78			change_obstacle_state(TutorialTom_doors2[var], "closed")
79		end
80		-- we also need remove all tux skills, except use weapon
81		Tux:downgrade_program("Hacking")
82		Tux:downgrade_program("Repair equipment")
83		Tux:downgrade_program("Emergency shutdown")
84		-- done initializing
85		Npc:set_name("Tutorial Tom")
86		display_console_message(string.format(_"Met [b]%s[/b]!", Npc:get_translated_name()))
87	end,
88
89	EveryTime = function()
90		if (TutorialTom_start_chat) then --initiated by TutorialTerminal.dialog
91			Npc:says(_"Well done.")
92			Npc:says(_"Now follow me to the next section. You will learn how to hack bots.")
93			TutorialTom_start_chat = false -- don't show this again
94			Npc:teleport("TutorialTomPostTerminalTeleportTarget")
95			Npc:set_destination("TutorialTom-Takeover")
96			change_obstacle_state("TutorialTakeover", "opened") --door
97			end_dialog()
98		end
99
100		if (partner_started()) and
101		   (TutorialTom_glasswall_smashed) and
102		   (cmp_obstacle_state("TutorialWall", "broken")) and
103		   (not TutorialTom_glasswall_done) then
104			-- wall section, shown if tux destroyed the wall by hand
105			Npc:says(_"Great, you figured out how deal with this obstacle.")
106			Npc:says(_"Let's proceed.")
107			TutorialTom_glasswall_done = true
108			if (not TutorialTom_Tux_PastWall) then
109				TutorialTom_Tux_PastWall = true
110				Npc:set_destination("TutorialTom-Ranged")
111			end
112			end_dialog()
113		end
114
115		if (not cmp_obstacle_state("TutorialWall", "broken")) then
116			--to avoid regressions with code above
117			if (partner_started()) then
118				Npc:says(_"Hi Linarian, I've been expecting you. My name is Tutorial Tom.")
119				Npc:says(_"Long stasis sleep unfortunately has the side effect of temporary memory loss, sometimes even for simple ordinary every day things.")
120				Npc:says(_"So let's start with the basics, shall we?")
121				show("node1", "node7", "node80")
122				Npc:set_rush_tux(false)
123			elseif (Tux:has_quest("Tutorial Movement")) and
124				   (not TutorialTom_talk_to_tom_EveryTime) then
125				-- only once
126				TutorialTom_talk_to_tom_EveryTime = true
127				Npc:says(_"Glad to see you figured out the quest log!")
128			elseif (Tux:has_quest("Tutorial Movement")) and
129			       (TutorialTom_move_black) and
130			       (not TutorialTom_sprinting) then
131				TutorialTom_sprinting = true
132				Npc:says(_"Speaking of moment, you can also [b]sprint[/b] by holding the [b]control key[/b].")
133				Tux:update_quest("Tutorial Movement", _"Apparently I can sprint if I hold down the control key as I move. This might help if I get in a tight spot.")
134				Npc:says(_"This distance is determined by your yellow stamina bar; the more you have, the farther you can run without becoming winded.")
135			end
136		end
137
138		if (tut_tux_items_entered) and
139		   (not TutorialTom_Tux_found_all_items) then
140			show("node5")
141		end
142
143		if (not tut_tux_melee_entered ) then
144
145			if (tut_tux_chest_entered) and
146			   (not tut_item_chest_opened) then
147				show("node10")
148			elseif (tut_item_chest_opened) then
149				hide("node10")
150				show("node11")
151			end
152
153			if (Tux:has_item("Normal Jacket")) or
154			   (Tux:has_item("Improvised Buckler")) or
155			   (Tux:has_item("Shoes")) or
156			   (Tux:has_item("Worker Helmet")) then
157				hide("node11")
158				Npc:says(_"Excellent, I see you already took on the armor that was in the box.")
159				if (not armor_node_one) then
160					show("node12")
161				end
162				if (not armor_node_two) then
163					show("node13")
164				end
165			end
166		end
167
168		if (tut_tux_melee_entered) and
169		   (not tut_tux_glass_entered) then
170			-- tux is still in bot melee area
171			show("node24")
172		end
173
174		if (tut_tux_terminal_entered) then
175			hide("node24")
176		end
177
178		if (cmp_obstacle_state("TutorialDoor", "opened")) and
179		   (tut_tux_takeover_entered) and
180		   (not TutorialTom_node50_done) then
181			show("node50")
182		end
183
184		if (tut_tux_glass_entered) then
185			show("node70")
186		end
187
188		if (TutorialTom_Tux_PastWall) then
189			hide("node70") show("node30")
190		end
191
192		if (Tux:done_quest("Tutorial Hacking")) and
193		   (not tut_tux_glass_entered) and
194		   (not TutorialTom_hide_71) then
195			show("node71")
196		else
197			hide("node71")
198		end
199
200		if (tut_tux_glass_entered) then
201			hide("node55", "node57")
202		end
203
204		if (tut_tux_ranged_entered) and
205		   (not tux_node38_done) then
206			show("node38")
207		end
208
209		if (Tux:has_quest("Tutorial Shooting")) then
210			hide("node30") --avoid assigning the quest twice etc..
211		end
212
213		show("node99")
214	end,
215
216	{
217		id = "node1",
218		text = _"Yes, it would be most kind of you. I don't remember anything.",
219		code = function()
220			Npc:says(_"You Linarians keep a quest [b]Log[/b] where you write down key bits of information.")
221			Npc:says(_"When you aren't speaking with someone, you can open it up or close it by pressing the [b]q key[/b].")
222			Npc:says(_"I'll assign you a new quest, so you can try it out. Once you are done, [b]left click[/b] on me.")
223			if (not Tux:has_quest("Tutorial Movement")) then
224				Tux:add_quest("Tutorial Movement", _"To talk to someone, left click on them. You can talk to any friendly bot or person. Friendly people and bots have a green bar above them. Press the 'q' key to open or close the quest log. Left click back on Tutorial Tom to learn more!")
225			end
226			display_big_message(_"Press 'q' for Quests!")
227			hide("node1", "node7", "node80") show("node2", "node3", "node4", "node8")
228			if (tut_tux_items_entered) and
229			   (not TutorialTom_Tux_found_all_items) then
230				show("node5")
231			end
232			end_dialog()
233		end,
234	},
235	{
236		id = "node2",
237		text = _"What can you tell me about finding my way in the world?",
238		code = function()
239			Npc:says(_"You Linarians see the world similar to the Heads Up Displays, or [b]HUD[/b], used in computer games.")
240			Npc:says(_"Linarians, like all birds, have a remarkable internal sense of direction. Apparently your HUD has a [b]compass[/b], represented by four red arrows in the upper right corner with North marked on it.")
241			Npc:says(_"You can temporarily disable this compass by pressing the 'tab' key.")
242			Tux:update_quest("Tutorial Movement", _"I learned the four red arrows in the upper-right of my HUD is a compass with north marked on it. I can toggle it using the 'tab' key.")
243			Npc:says(_"Rumor is there was a device Linarians used to remember every place they had been, called an [b]automap[/b].")
244			Npc:says(_"Although, you don't currently have such a device, you might find someone with nanotechnology skills to make one.")
245			Tux:says(_"I'll keep that in mind.")
246			hide("node2")
247		end,
248	},
249	{
250		id = "node3",
251		text = _"My limbs don't seem to want to work properly. Can you help me with that?",
252		code = function()
253			Npc:says(_"Ah yes, movement. It's second nature to us humans, but our research with you in the past showed that your brain seems to work more like a computer.")
254			Npc:says(_"To move somewhere, you have to [b]left click[/b] on the destination on your HUD.")
255			Npc:says(_"If you can go there, you will do so.")
256			Npc:says(_"Now try to move to the red dot to the north. Then to the black grating to the east, and then talk to me again.")
257			Tux:update_quest("Tutorial Movement", _"I'm supposed to left click anywhere to move to a location. If I can figure out a way, I will move there automatically. Tom wants me to first try to move to the red dot to the North.")
258			TutorialTom_learn_to_walk = true
259			hide("node3")
260			end_dialog()
261		end,
262	},
263	{
264		id = "node4",
265		text = _"What else makes me different as a Linarian?",
266		code = function()
267			Npc:says(_"As a Linarian, you have some special abilities that no human does: Linarians can translate programming source code into something like magic.")
268			Npc:says(_"However, using these [b]Programs[/b], adversely affect your body temperature, which you must regulate.")
269			Npc:says(_"But you normally have a special program called [b]Emergency Shutdown[/b], which freezes your motions for several seconds but significantly cools your body.")
270			Npc:says(_"This, and the ability to hack bots will soon return once your mind recovers from the stasis.")
271			Npc:says(_"Once it does, we'll talk more about programs. You can toggle the [b]Skills/Program menu[/b] by pressing the [b]s key[/b].")
272			Tux:update_quest("Tutorial Movement", _"View the Skills/Program menu by pressing the 's' key.")
273			hide("node4")
274		end,
275	},
276	{
277		id = "node5",
278		text = _"I'm sensing some sort of strange presence in the vicinity.",
279		code = function()
280			Npc:says(_"Ah, yes.", "NO_WAIT")
281			Npc:says(_"Linarians seem to [b]detect items[/b] - even through walls - in an augmented reality.")
282			Npc:says(_"The [b]z key[/b] will toggle this augmentation, while the [b]x key[/b] momentarily flashes it.")
283			Npc:says(_"Moving your pointer over an item will tell you more about that item.")
284			Npc:says(_"On our way to the next stopping point, we'll pass some items on the floor.")
285			Npc:says(_"Feel free to stop and examine them to get practice.")
286			Npc:says(_"[b]Left clicking[/b] on an item will pick it up and put it in your inventory, toggled by the [b]i key[/b], where you can examine it further.")
287			if (not TutorialTom_TutMovement_ToggleDetectItems) and
288			    Tux:has_quest("Tutorial Movement") then
289				Tux:update_quest("Tutorial Movement", _"Toggle detect items by pressing the 'z' key, and press 'x' to flash the ability. To pick up an item, left click on it. To view an item you've picked up, open the inventory by pressing 'i'.")
290				TutorialTom_TutMovement_ToggleDetectItems = true
291			end
292			if (Tux:has_item("Mug")) and
293			   (Tux:has_item("Anti-grav Pod for Droids")) and
294			   (Tux:has_item("Plasma Transistor")) then
295				-- these are the items in the room item
296				Npc:says(_"Oh great, I see you found all the items hidden in the room. Good job!")
297				TutorialTom_Tux_found_all_items = true
298			end
299			hide("node5")
300		end,
301	},
302	{
303		id = "node7",
304		text = _"No, thanks, I still remember how to walk, run, navigate, and pick things up.",
305		code = function()
306			hide("node1", "node7", "node80") next("node9")
307		end,
308	},
309	{
310		id = "node8",
311		text = _"Thank you, that was very informative. I think I got how to move around. Can we proceed now?",
312		code = function()
313			Tux:end_quest("Tutorial Movement")
314			Npc:says(_"I just closed your first quest. You can still see what you learned by clicking on the 'done quests' tab in the quest screen.", "NO_WAIT")
315			hide("node8") next("node9")
316		end,
317	},
318	{
319		id = "node9",
320		text = _"I'm eager to learn more.",
321		code = function()
322			Npc:says(_"Ok, follow me into the next area.")
323			for var in ipairs(TutorialTom_doors) do
324				change_obstacle_state(TutorialTom_doors[var], "opened")
325			end
326			hide("node1", "node2", "node3", "node4", "node5")
327			end_dialog()
328		end,
329	},
330	{
331		id = "node10",
332		text = _"What is in that chest?",
333		code = function()
334			Npc:says(_"Well, you can interact with several types of objects by simply [b]left clicking[/b] on them.")
335			Npc:says(_"Left click on the chest to open it up and see what is inside.")
336			if (not Tux:has_quest("Tutorial Melee")) then
337				Tux:add_quest("Tutorial Melee", _"I'm supposed to left click on chests to open them up.")
338			end
339			hide("node10") show("node19")
340			end_dialog()
341		end,
342	},
343	{
344		id = "node11",
345		text = _"Some items came out.",
346		code = function()
347			Npc:says(_"Well, you've discovered a great secret: chests sometimes contain items.")
348			Npc:says(_"We humans have a fascination with hiding our treasures. What comprises a treasure means different things to different people.")
349			Npc:says(_"For some, it's valuable metals in robotic circuitry. That's the current monetary standard on our world.")
350			Npc:says(_"For others, it may be weapons, or even just items that may be used as weapons in a pinch.")
351			Npc:says(_"Still others, odd as it may sound, keep dishes hidden away.")
352			Npc:says(_"Perhaps the best thing you can find, though, is armor. At least, given the current situation with the bots, that is.")
353			hide("node11") show("node12", "node13")
354		end,
355	},
356	{
357		-- armor_node_one
358		id = "node12",
359		text = _"Armor? I should know more about this.",
360		code = function()
361			Npc:says(_"In the years since you entered stasis, mankind has done much research in the field of robotics.")
362			Npc:says(_"One branch in particular that has served us well is the realm of nanotechnology.")
363			Npc:says(_"Because they run a very simple operating system, nanobots were not affected by whatever caused the Great Assault.")
364			Npc:says(_"To this day, our armor and clothing are made out of nanobots. This enables many different sizes of people to wear the same clothing.")
365			Npc:says(_"The nanobots reshape the garment for a comfortable fit, so even you should be able to wear them without problem.")
366			hide("node12") show("node14")
367		end,
368	},
369	{
370		-- armor_node_two
371		id = "node13",
372		text = _"How does wearing clothes and holding shields help me?",
373		code = function()
374			Npc:says(_"Well, it can help you avoid indecent exposure charges.")
375			Tux:says(_"...")
376			Npc:says(_"But all jokes aside, the bots will not mess around.")
377			Npc:says(_"Even the best of fighters sometimes get hit by enemy blows. If I were you, I would seriously consider wearing some sort of armor before mixing it up with those bots.")
378			Npc:says(_"They will help to mitigate some of the damage you take from melee or ranged combat.")
379			Npc:says(_"Keep in mind, though, that there is a chance that your armor will take damage whenever you get hit. Keep an eye on it, or you'll lose it.")
380			hide("node13") show("node15")
381		end,
382	},
383	{
384		id = "node14",
385		text = _"That sounds useful. How do I use armor?",
386		code = function()
387			Npc:says(_"Well, let me start by saying that there are four classes of armor: headgear, shoes, body armor, and shields.")
388			Npc:says(_"When you pick up a piece of armor of a particular class, and you don't already have one equipped, you will automatically equip it if you can.")
389			Npc:says(_"Picking up armor and items can be accomplished by [b]left clicking[/b] on the item. If your inventory has space, you will pick the item up.")
390			Npc:says(_"If you currently have one piece of armor equipped that you would like to swap out for another, simply drag the new armor piece to the current armor piece and left click.")
391			Npc:says(_"They will swap places, and you can put the other piece of armor back into your inventory.")
392			Npc:says(_"Alternatively, you can drag it into your field of view and drop it on the ground.")
393			hide("node14") show("node16")
394		end,
395	},
396	{
397		id = "node15",
398		text = _"I wouldn't want to lose any armor. What can I do about that?",
399		code = function()
400			Npc:says(_"Well, there are several ways to keep that from happening.")
401			Npc:says(_"Equipped items in poor condition will show up yellow and should turn red if in critical condition.")
402			Npc:says(_"If you don't unequip an item in poor or critical condition it may be ruined!")
403			Npc:says(_"There are three things you can do when an item reaches critical condition:")
404			Npc:says(_"First, you can sell or discard the item.")
405			Npc:says(_"Second, you can use your [b]repair equipment[/b] program on the item, which will repair the item at the cost of some of its durability.")
406			Npc:says(_"Or third, you can have the item repaired at a shop, which maintains the item's durability at a price.")
407			hide("node15") show("node17", "node61")
408		end,
409	},
410	{
411		id = "node16",
412		text = _"You mentioned discarding an item. Why would I want to do that?",
413		code = function()
414			Npc:says(_"Well, I can think of a few reasons.")
415			Npc:says(_"You might not have enough room in your inventory for an item you need more, or can sell for more.")
416			Npc:says(_"If an item is close to being destroyed, you might also consider dropping it.")
417			Npc:says(_"And finally some items give negative status effects, and aren't worth selling.")
418			Npc:says(_"Armor or weapons may affect you in different ways.")
419			Npc:says(_"Some will help you out, for example by increasing your cooling rate or increasing your dexterity. This is the work of specialized nanobots, but the reverse can happen too.")
420			hide("node16")
421			armor_node_two = true
422			if (armor_node_one) then
423				show("node19")
424			end
425		end,
426	},
427	{
428		id = "node17",
429		text = _"Repair equipment program? How do I use that?",
430		code = function()
431			Npc:says(_"Perhaps I should start by explaining programs in general.")
432			Npc:says(_"To use a program, select it through your HUD (remember the [b]s key[/b] toggles your [b]Skills/Program menu[/b]).")
433			Npc:says(_"After you've selected a program, run the program by right clicking. Depending on the program you can target an enemy, an item, or just the world.")
434			Npc:says(_"You can also assign quick-select keys to programs. Simply hover over the program in the Skills/Program menu and press one of the keys [b]F5[/b] to [b]F12[/b]. Then, whenever you press this button, you will select the corresponding program.")
435			Npc:says(_"If you're curious what a program does, you can find out by clicking the question mark in the Skills/Program menu.")
436			Npc:says(_"Now, to answer your question, you use your repair equipment program by selecting it in the Skills/Program menu, then right clicking on the item you wish to repair.")
437			Tux:improve_program("Repair equipment")
438			TutorialTom_has_repair = true
439			if (not Tux:has_quest("Tutorial Melee")) then -- this might be tricky
440				Tux:add_quest("Tutorial Melee", _"Run a program by right clicking after it has been selected from the Skills/Program menu. My shoes are damaged, so I might try the repair equipment program on them to slightly repair them.")
441			else
442				Tux:update_quest("Tutorial Melee", _"Run a program by right clicking after it has been selected from the Skills/Program menu. My shoes are damaged, so I might try the repair equipment program on them to slightly repair them.")
443			end
444			hide("node17")
445		end,
446	},
447	{
448		id = "node19",
449		text = _"I think I'm ready for the next section of the tutorial.",
450		code = function()
451			Npc:says(_"Ok, I'll open the next door then. But prepare yourself, soon you will learn how to fight against bots in hand-to-hand combat.")
452			if (not TutorialTom_has_repair) then
453				Tux:improve_program("Repair equipment")
454			end
455			change_obstacle_state("TutorialEquipOut", "opened")
456			end_dialog()
457			hide("node10", "node11", "node12", "node13", "node14", "node15", "node16", "node17", "node61", "node62", "node63", "node64", "node65", "node19") show("node20")
458		end,
459	},
460	{
461		id = "node20",
462		text = _"Can you tell me how to fight the bots?",
463		code = function()
464			Npc:says(_"I will certainly try my best.")
465			Npc:says(_"It's odd to think that a flightless bird would be such a scrapper, but you Linarians have been surprising us since the beginning.")
466			Npc:says(_"We prefer to fight the blamed droids at a distance. They're less likely to rend us limb from limb that way.")
467			Npc:says(_"Unfortunately, guns and other ranged weaponry are hard to come by these days.")
468			Npc:says(_"That goes double for ammunition. Because these are bots, you really can't effectively keep them at bay by just waving around an empty gun.")
469			Npc:says(_"With that in mind, your most reliable weapons are your fists. They never run out of ammo or wear down, but of course they don't do much damage against a metal body, either.")
470			hide("node20") show("node21", "node23")
471		end,
472	},
473	{
474		id = "node21",
475		text = _"So I'm supposed to fight bots with my fists?",
476		code = function()
477			Npc:says(_"There may be times when you have no choice.")
478			Npc:says(_"Melee combat, armed or unarmed, can be initiated by [b]left clicking[/b] on an enemy.")
479			Npc:says(_"You will then walk over to the enemy and start hitting them.")
480			Npc:says(_"Now, I understand you may have some concerns over your safety during this...")
481			Tux:says(_"CONCERNS? Erm... Yes, this doesn't sound like a particularly healthy endeavor.")
482			Npc:says(_"Fred, if you're afraid, you'll have to overlook it. Besides, you knew the job was dangerous when you took it.")
483			Tux:says(_"I beg your pardon? Who is Fred?")
484			Npc:says(_"Never mind, just an old song.")
485			Npc:says(_"Fighting the bots hand-to-hand has risks, there is no question. However, there are things you can do to even the odds.")
486			Npc:says(_"We already discussed armor. Another useful type of item is medical supplies.")
487			Npc:says(_"There are a few different types of restorative items. The most common are health drinks.")
488			hide("node21") show("node22")
489		end,
490	},
491	{
492		id = "node22",
493		text = _"Tell me about health drinks.",
494		code = function()
495			Npc:says(_"Man has practised medicine in one form or another for hundreds of years.")
496			Npc:says(_"Using some of the same nanotechnology that makes up your armor, we've perfected drinks that instantaneously restore your health.")
497			Npc:says(_"There are many kinds, but all accomplish the same thing, to varying degrees.")
498			Npc:says(_"Certain items, like health drinks, can be used directly without clicking on them.")
499			Npc:says(_"At the bottom of your HUD, you'll notice your item access belt. Small items can go here and be used by pressing the numbers [b]0[/b] through [b]9[/b].")
500			Npc:says(_"Unlike armor or weapons, multiple of these items will group together in your inventory slots.")
501			Npc:says(_"If you have Diet Supplements equipped in item slot 1, you can press 1 to use one.")
502			Npc:says(_"This will restore your health, and will be invaluable in the heat of battle.")
503			Tux:update_quest("Tutorial Melee", _"Small one-time-use items, like diet supplements, can be placed in inventory spots labels 1 to 0, and can be used by pressing the corresponding key.")
504			hide("node22")
505		end,
506	},
507	{
508		id = "node23",
509		text = _"I'm ready to fight my first bot.",
510		code = function()
511			Npc:says(_"We keep two bots captive for melee practice.")
512			Npc:says(_"I've unlocked the door leading to the first bot. Take care of it, then come back and talk to me.")
513			Npc:says(_"I'm also giving you some health drinks. Feel free to use them, though I can heal you if you need it.")
514			Npc:says(_"Your health will also regenerate over time. I wish it were so easy for us humans.")
515			Npc:says(_"The first bot is carrying an [b]Entropy Inverter[/b]. Bring it to me to prove you've beaten it.")
516			Npc:says(_"Come back and talk to me when you have the Entropy Inverter.")
517			change_obstacle_state("TutorialMelee1", "opened")
518			Tux:add_item("Doc-in-a-can", 3)
519			Tux:update_quest("Tutorial Melee", _"I'm going to fight my first bot! To start melee combat left click on the bot. Tom wants the Entropy Inverter from the bot after I've defeated it, so I should pick that up.")
520			hide("node23") show("node24", "node25")
521			end_dialog()
522		end,
523	},
524	{
525		id = "node24",
526		text = _"Can you heal me?",
527		code = function()
528			if (Tux:get_hp_ratio() == 1) then
529				Npc:says(_"You are fine, there is nothing that I can do.")
530				hide("node24")
531			else
532				Npc:says(_"You should be more careful, Linarian. But yes, I can heal you.")
533				Npc:says(_"There, all better.")
534				Tux:heal()
535			end
536		end,
537	},
538	{
539		id = "node25",
540		text = _"I've beaten the first bot.",
541		code = function()
542			if (Tux:has_item_backpack("Entropy Inverter")) then
543				Npc:says(_"So you have. Well done.")
544				Npc:says(_"I'll exchange this wrench for it. I think you'll find it handy.")
545				Npc:says(_"Now would be an appropriate time to mention bot parts, I guess.")
546				Npc:says(_"Certain parts in the bots are extra valuable. You can sell them at stores for cash.")
547				Npc:says(_"If you can learn to extract these parts, it can help improve your lot in the world.")
548				Npc:says(_"Hopefully, you can find someone to teach you.")
549				Tux:del_item_backpack("Entropy Inverter", 1)
550				Tux:add_item("Big wrench", 1)
551				Tux:update_quest("Tutorial Melee", _"I brought the entropy inverter to Tom and he gave me my first weapon: a Big wrench. I should equip it.")
552				hide("node25") show("node26")
553			else
554				Npc:says(_"Trying to cheat your way through the tutorial doesn't bode well for your chances in the real world.")
555				Npc:says(_"I'll need proof that you've beaten the first bot.")
556				Npc:says(_"Don't come back without the [b]Entropy Inverter[/b] it was carrying.")
557				end_dialog()
558			end
559		end,
560	},
561	{
562		id = "node26",
563		text = _"You mentioned another bot?",
564		code = function()
565			Npc:says(_"That's correct. The second bot is a lot more dangerous, and you're not likely to make much headway against it with your fists.")
566			Npc:says(_"Lucky for you, there's another dimension to melee combat.")
567			Npc:says(_"Fighting bots with your fists is fine, but there are a number of items you can use for melee.")
568			Npc:says(_"There are several traditional weapons in the world such as swords or light sabers that can be used against the bots.")
569			Npc:says(_"However, more common items you encounter every day can often be used to bash or pry at droid armor.")
570			Npc:says(_"For example, that wrench I just gave you will increase the damage you do, and should let you best the next bot.")
571			hide("node26") show("node27")
572		end,
573	},
574	{
575		id = "node27",
576		text = _"I'm ready to take the next bot on.",
577		code = function()
578			Npc:says(_"I certainly hope so. I will heal you before you go to the next room.")
579			Npc:says(_"I'm also giving you another healing drink, just in case.")
580			Npc:says(_"A 247 is nothing to trifle with, so I'm giving you a shield in the hopes that it'll help keep you alive.")
581			Npc:says(_"Finally, I'm giving you couple of somewhat experimental pills that will temporarily increase your strength and dexterity, respectively.")
582			Npc:says(_"Use them in the same way you would use a health drink.")
583			Npc:says(_"If I were you, I would think about using your repair equipment program on your armor and that wrench before you go into the room.")
584			Npc:says(_"You'll also need to equip them. I won't do that for you.")
585			Npc:says(_"Like the last bot, this one will be carrying an item. Bring me the [b]Tachyon Condensator[/b] it is carrying to continue.")
586			Npc:says(_"I've unlocked the door. Good luck, and talk to me when you have the Tachyon Condensator.")
587			change_obstacle_state("TutorialMelee2", "opened")
588			Tux:heal()
589			Tux:add_item("Doc-in-a-can", 1)
590			Tux:add_item("Strength Capsule", 1)
591			Tux:add_item("Dexterity Capsule", 1)
592			Tux:add_item("Standard Shield", 1)
593			hide("node27") show("node28")
594			end_dialog()
595		end,
596	},
597	{
598		id = "node28",
599		text = _"I've beaten the second bot.",
600		code = function()
601			if (Tux:has_item_backpack("Tachyon Condensator")) then
602				Npc:says(_"Very good! You've completed your melee training.")
603				Npc:says(_"These skills will serve you well in the future.")
604				Npc:says(_"Talk to me when you're ready to move on to the next part of the tutorial.")
605				Tux:del_item_backpack("Tachyon Condensator", 1)
606				hide("node28") show("node29")
607			else
608				Npc:says(_"You didn't bring back the Tachyon Condensator. You'll need to bring it back before we can continue.")
609				Npc:says(_"I'll go ahead and heal you. If your weapon or armor are in bad shape, perhaps you should repair them before going back in there.")
610				Npc:says(_"Don't come back without the [b]Tachyon Condensator[/b].")
611				end_dialog()
612			end
613			Tux:heal()
614		end,
615	},
616	{
617		id = "node29",
618		text = _"I'm ready to move on.",
619		code = function()
620			if (not Tux:done_quest("Tutorial Melee")) then
621				Tux:end_quest("Tutorial Melee", _"I decided to move on and go to next unit of the tutorial.")
622			end
623			--[[ if (TutorialTom_has_gun) then
624			Npc:says(_"I'll bet you're itching to try that pistol out on some bots.")
625			Npc:says(_"Our next destination is the ranged combat training area, so you're in luck.")
626			end ]]--
627			Npc:says(_"I'll unlock the door to the south. Follow the corridor east.")
628			change_obstacle_state("TutorialMeleeOut", "opened")
629			Npc:set_destination("TutorialTom-Terminal")
630			hide("node20", "node21", "node22", "node23", "node24", "node25", "node26", "node27", "node28", "node29")
631			show("node40")
632			end_dialog()
633		end,
634	},
635	{
636		id = "node30",
637		text = _"Ranged weaponry seems safer than getting up close and personal.",
638		code = function()
639			Npc:says(_"Well, Linarian, most of the time it is.")
640			Npc:says(_"There are some bots with ranged weaponry, but we don't have any of those in captivity.")
641			Tux:add_quest("Tutorial Shooting", _"I am learning about how to use ranged weapons.")
642			hide("node30") show("node31", "node38")
643		end,
644	},
645	{
646		id = "node31",
647		text = _"So what can you tell me about guns?",
648		code = function()
649			Npc:says(_"The basic idea behind ranged weaponry is to hurt or kill an enemy without having to come within swinging range.")
650			Npc:says(_"There are three basic ways to do this: traditional firearms, lasers, and plasma weapons.")
651			Npc:says(_"Traditional firearms are things that go bang. A small explosion accelerates the ammunition towards the target at a high velocity, causing injury.")
652			Npc:says(_"Lasers use an intensified beam of light to burn through the intended victim. These operate on replaceable charge packs.")
653			Npc:says(_"Plasma weapons use superheated ionized gas to burn the target. The gas comes in loadable canisters.")
654			Npc:says(_"Most other ranged weapons are variations of these three. We have a few in storage for training purposes.")
655			hide("node31") show("node32")
656		end,
657	},
658	{
659		id = "node32",
660		text = _"So how do I use guns?",
661		code = function()
662			Npc:says(_"Well, firing is pretty simple. First, equip a ranged weapon that you have ammunition for.")
663			Npc:says(_"Next, simply [b]left click[/b] on your target, and you'll begin firing.")
664			Npc:says(_"Alternatively, you can fire a single shot using the [b]Fire Weapon[/b] program, and [b]right clicking[/b] on the enemy.", "NO_WAIT")
665			Npc:says(_"That is the best way if you are trying to conserve precious ammo with high rate of fire guns.")
666			Npc:says(_"There are a couple of new tricks with ranged weapons. If you want to [b]move while firing[/b]: hold [b]shift[/b] and [b]left click[/b] your desired position.")
667			Npc:says(_"If you'd rather stay in place: Hold [b]A[/b], then [b]left click[/b] your target.")
668			Npc:says(_"When your weapon runs out of ammo during combat, it will try to automatically reload if you have extra ammunition for it.")
669			Npc:says(_"Sometimes, you will need or want to manually reload. You can do this by pressing the [b]r key[/b].")
670			Npc:says(_"If you are reloading, or you are out of ammo, the small message screen at the bottom of your HUD will tell you what type of ammo to get.")
671			if (not TutorialTom_guns_how_to) then
672				TutorialTom_guns_how_to = true
673				Tux:update_quest("Tutorial Shooting", _"If I have equipped a ranged weapon and I left click on an enemy, I will begin firing upon it until my gun is empty, and automatically reload. But if I want to fire a single shot, I need to also equip the Fire Weapon program, and then right click. To move while firing, I have to shift + left click to where I want to go. Also, if I want to manually reload I have to press the 'r' key. The small message screen at the bottom of my HUD will tell me if I'm reloading or out of ammunition.")
674			end
675			if (not TutorialTom_opened_door) then
676				show("node33")
677			end
678			hide("node32")
679		end,
680	},
681	{
682		id = "node33",
683		text = _"I think I understand how to use guns now.",
684		code = function()
685			Npc:says(_"In that case, I'll let you in to the armory. There are some crates and chests in there with weapons and ammunition.")
686			Npc:says(_"Be careful though, smashing open crates and barrels could hurt you.")
687			if (TutorialTom_has_gun) then
688				Npc:says(_"You already got the .22 pistol I gave you earlier? It's not much as guns go, but it can do the trick.")
689			else
690				Npc:says(_"Here's my personal .22 Automatic pistol. It's not much as guns go, but it can do the trick.")
691				Tux:add_item(".22 Automatic", 1)
692				Tux:add_item(".22 LR Ammunition", 10)
693			end
694			Npc:says(_"Here is some more ammunition for it.")
695			Npc:says(_"You'll no doubt get more mileage out of the plasma pistol, though. Or any other gun, for that matter.")
696			Npc:says(_"Practice switching weapons and reloading.")
697			Npc:says(_"On the other side of that fence are some bots. Practice killing them off with various ranged weapons.")
698			Npc:says(_"Once you've gotten rid of them all, we can move on.")
699			Tux:update_quest("Tutorial Shooting", _"Tutorial Tom wants me to shoot those bots.")
700			-- TODO probably explain leveling as well as balancing changes to XP always risk causing leveling here. Or somehow make sure Tux can't level
701			TutorialTom_opened_door = true
702			change_obstacle_state("TutorialStorage", "opened")
703			change_obstacle_state("TutorialShootCage", "opened")
704			Tux:add_item(".22 LR Ammunition", 50)
705			hide("node33") show("node34", "node35")
706			end_dialog()
707		end,
708	},
709	{
710		id = "node34",
711		text = _"I ran out of ammo. Can I have some more?",
712		code = function()
713			if (cmp_obstacle_state("37-ammo-chest", "unlocked")) then -- check if tux has opened the ammo chest already : yes
714				if (Tux:has_item_backpack("Laser power pack")) or (Tux:has_item_backpack("Plasma energy container")) or (Tux:has_item_backpack(".22 LR Ammunition")) then
715					-- check if tux still has ammo left
716					Npc:says(_"Looks like you still have some ammo left in your inventory...")
717					Npc:says(_"Why don't you use this first?")
718					Npc:says(_"Try to switch to another gun maybe...")
719				else -- chest opened but no ammo left in inventory...
720					Npc:says(_"Ok, I will give you some more ammo. You seem to be in need, indeed...")
721					Tux:add_item("Laser power pack", 10)
722					Tux:add_item("Plasma energy container", 10)
723					Tux:add_item(".22 LR Ammunition", 10)
724				end
725			else
726				Npc:says(_"Check the storage room to the west for more guns and ammo.")
727			end
728		end,
729	},
730	{
731		id = "node35",
732		text = _"I killed all the bots.",
733		code = function()
734			if (Tux:done_quest("Tutorial Shooting")) then
735				Npc:says(_"Excellent job.")
736				Npc:says(_"Keep shooting like that, and the bots will never stand a chance, as long as you still have ammo.")
737				Tux:update_quest("Tutorial Shooting", _"That was like shooting fish in a barrel. I could use a fish about now.")
738				hide("node35") show("node36", "node37")
739				end_dialog()
740			else
741				Npc:says(_"I don't mind if you don't want to do this, but please don't try to trick me.")
742				Npc:says(_"I don't have verified kills on all those bots.")
743			end
744		end,
745	},
746	{
747		id = "node36",
748		text = _"I would like a few more bots to shoot at.",
749		code = function()
750			Npc:says(_"Ok, I'll create some more droids.")
751			i = 1
752			while (i < 8) do
753				create_droid("shootingrange"..i, 123)
754				i = i + 2
755			end
756			hide("node36")
757			end_dialog()
758		end,
759	},
760	{
761		id = "node37",
762		text = _"So, what's next?",
763		code = function()
764			Npc:says(_"Now, there's one last thing you should know.")
765			Npc:says(_"You Linarians can apparently withdraw from our world temporarily.")
766			Npc:says(_"Time stops, and everything freezes in place.")
767			Npc:says(_"This can be accomplished by using the [b]Esc key[/b].")
768			if (not TutorialTom_hacking_bots) then
769				Npc:says(_"Your final task is to leave us using this menu.")
770				Npc:says(_"I'm afraid there's nothing more I can teach you. I wish you good luck, Linarian.")
771				Npc:says(_"You'll need it if our world is to survive.")
772			end
773			change_obstacle_state("TutorialExit1", "opened")
774			hide("node30", "node31", "node32", "node33", "node34", "node35", "node36", "node38")
775		end,
776	},
777	{
778		id = "node38",
779		text = _"Why can't I hack the bots here, or use programs on them?",
780		code = function()
781			Npc:says(_"Well, that would be cheating, don't you think so?")
782			Npc:says(_"Shooting moving targets needs a bit of practice, yes...")
783			Npc:says(_"...but in the end you will profit a lot from it.")
784			Tux:says(_"Ok, I will try my best.")
785			tux_node38_done = true
786			hide("node38")
787		end,
788	},
789	{
790		id = "node40",
791		text = _"Why are we stopping?",
792		code = function()
793			Npc:says(_"You've done well so far, Linarian. Let's take a little break.")
794			Npc:says(_"Once you get out into the real world, you'll find that your current abilities aren't always enough to survive.")
795			Npc:says(_"As you achieve combat experience, you'll be able to apply it to better yourself.")
796			Npc:says(_"As with most things, you view this as a panel in your HUD. Press the [b]c key[/b] to open the [b]Character panel[/b].")
797			Npc:says(_"Once you've gained enough experience, you'll level up. This will automatically improve some of your statistics.")
798			Npc:says(_"You'll also be given 5 points to spend however you choose in three different areas. Characteristics, Skills and Programs.")
799			Npc:says(_"[b]Strength[/b] governs the amount of damage you do with each hit in melee combat.")
800			Npc:says(_"[b]Dexterity[/b] controls your hit rate, or how likely you are to hit the enemy. It also determines how likely you are to dodge a hit from them.")
801			Npc:says(_"[b]Cooling[/b] is your processors cooling, or heat resilience, and determines how much you can process before your system starts overheating.")
802			Npc:says(_"Finally, among your main characteristics, [b]Physique[/b] determines how much health you have.")
803			Npc:says(_"There are general [b]Melee[/b] and [b]Ranged[/b] fighting skills, both of which increase the damage you inflict and how fast you attack as you improve them.")
804			Npc:says(_"You also have the [b]Programming[/b] skill, which essentially is about programming in an energy-efficient manner so programs cause less heat.")
805			Npc:says(_"Apart from this, a few programs require a teacher and training points to improve.")
806			Npc:says(_"[b]Extract Bot Parts[/b] is a special passive skill that will allow you to salvage parts from bots you 'retire', which you can trade for money in the town.")
807			Npc:says(_"A good technician is able to make use of those parts.")
808			Npc:says(_"He can create, let's say, an add-on and, after doing some modifications to the item, attach this add-on.")
809			Npc:says(_"This way an upgraded item is created.")
810			Tux:add_quest("Tutorial Upgrading Items", _"There is a way to upgrade items if I meet a good technician. It sounds useful, maybe I should learn more about this.")
811			Npc:says(_"The [b]Hacking[/b] program we will speak a bit more of in a little while.")
812			hide("node40") show("node41")
813		end,
814	},
815	{
816		id = "node41",
817		text = _"I'll have to keep that in mind.",
818		code = function()
819			Npc:says(_"Well, how about you try it out?")
820			Npc:says(_"I'll give you some points to spend, and you can distribute them as you like.")
821			Npc:says(_"Since you'll be hacking up ahead, you should probably use a few of them on [b]Cooling[/b].")
822			Npc:says(_"But, again, that's your choice.")
823			Tux:add_xp(2000)
824			hide("node41") show("node58")
825			end_dialog()
826		end,
827	},
828	{
829		id = "node42",
830		text = _"Alright, I'm ready to go hack some bots.",
831		code = function()
832			if (not Tux:done_quest("Tutorial Upgrading Items")) then
833				Tux:end_quest("Tutorial Upgrading Items", _"I decided that I don't need to know how to upgrade items.")
834			end
835			Npc:says(_"First, you'll need to unlock the door.")
836			Npc:says(_"See that [b]Terminal[/b] to the left?")
837			Npc:says(_"You will need to login, by left clicking on it, and then select unlock door.")
838			Npc:says(_"Terminals act very similar to hacked bots.")
839			Tux:add_quest("Tutorial Hacking", _"I need to login to the Terminal by left clicking on it. Then I'll unlock the door, so I can go hack some bots!")
840			hide("node42", "node58", "node59", "node60")
841			end_dialog()
842		end,
843	},
844	{
845		id = "node50",
846		text = _"So how does this work?",
847		code = function()
848			Npc:says(_"We talked about programs before. Now, we're going to focus on hacking programs in particular.")
849			Npc:says(_"As I mentioned before, your brain works in a way remarkably similar to a central processing unit.")
850			Npc:says(_"In many ways, you interact with the world around you as a virtual environment.")
851			Npc:says(_"You seem to have access to an API that isn't exposed to humans. You can interact with the environment in ways we only dream of.")
852			Npc:says(_"Because of this, you can run various programs on the bots.")
853			Npc:says(_"You can attempt to take them over, or monkey with their programming, or even cause them to damage themselves.")
854			Npc:says(_"Likewise, there are certain programs that affect you or items around you.")
855			if (not Tux:has_quest("Tutorial Hacking")) then -- quest already added in node 42
856				Tux:add_quest("Tutorial Hacking", _"I need to login to the Terminal by left clicking on it. Then I'll unlock the door, so I can go hack some bots!")
857			end
858			TutorialTom_node50_done = true
859			hide("node50") show("node51")
860		end,
861	},
862	{
863		id = "node51",
864		text = _"Tell me about taking bots over.",
865		code = function()
866			Npc:says(_"I'm afraid that you will have to experience it for yourself to really understand.")
867		--	Npc:says(_"However, you did leave yourself instructions before you went into stasis sleep.")
868			Npc:says(_"Taking over a bot comes in the form of a game or competition placing you against the bot.")
869			Npc:says(_"You initiate it by selecting the [b]Hacking[/b] program, then [b]right-clicking[/b] on a hostile bot.")
870			Npc:says(_"The field of play is split into two sides, one yellow, one purple, representing circuit boards.")
871			Npc:says(_"In the center of the field is a column of boxes known as logic cores. These cores have wires attached to them from both circuit boards.")
872			Npc:says(_"Your objective is to activate as many cores in your chosen color as possible at the end of each round.")
873			Npc:says(_"This is accomplished by selecting a wire with the up or down buttons, then pressing spacebar to activate that core.")
874			Npc:says(_"You will be given about 10 seconds initially to select which color you want with spacebar.")
875			Npc:says(_"At that point, you have 10 more seconds in which to activate more cores than the bot.")
876			Npc:says(_"Each activation of one core will consume one charge and you have a limited number of charges, 3 by default, so choose your targets carefully.")
877			Npc:says(_"I can tell you about some more advanced techniques, if you'd like.")
878			if (not TutorialTom_updated_hacking_quest) then
879				Tux:update_quest("Tutorial Hacking", _"Apparently in order to hack, all I have to do is select the Hacking program, right click a bot, and play a little game. I've got this!")
880				TutorialTom_updated_hacking_quest = true
881			end
882			show("node52", "node53", "node54") hide("node51")
883		end,
884	},
885	{
886		id = "node52",
887		text = _"What was that about activating more cores than the bot?",
888		code = function()
889			Npc:says(_"Ah, yes. While you are busy trying to take the bot over, it will be busy trying to stop you.")
890			Npc:says(_"The truth is, if the bot programming was perfect, it would be almost impossible to defeat.")
891			Npc:says(_"Fortunately for you, software bugs do indeed exist, and therefore some cores will be on your side from the beginning.")
892			Npc:says(_"Likewise, the bots only have a limited number of charges. Occasionally, they will have more than you, but that is a risk you have to take.")
893			Npc:says(_"Because you are initiating the attack, you do get to choose your side, which can let you handicap the bot greatly if used wisely.")
894			hide("node52")
895		end,
896	},
897	{
898		id = "node53",
899		text = _"Tell me about more advanced techniques.",
900		code = function()
901			Npc:says(_"Each charge will activate and remain active for a certain amount of time. This will let you take over a core that a bot just took over.")
902			Npc:says(_"Sometimes, the bots will already have charges on the wires. When you activate one of these, it will increase the time that wire is activated for.")
903			Npc:says(_"The bot can use this trick too, so it may be wise to give up a heavily guarded wire for an easier target.")
904			Npc:says(_"The wiring inside the bots sometimes contain splitters. These can be used in two ways.")
905			Npc:says(_"A 2-to-1 splitter is undesirable. This requires two charges to activate one core, halving your efficiency.")
906			Npc:says(_"A 1-to-2 splitter, however, will activate two nodes for the price of one charge.")
907			Npc:says(_"Sometimes these splitters will be stacked. Tracing the route ahead of time will be crucial to your tactical success.")
908			Npc:says(_"Ideally, you want to stick your opponent with 2-to-1 splitters, while you have 1-to-2 splitters at your disposal.")
909			Npc:says(_"Finally, remember that patience is often a virtue. Taking over all cores early on only to lose them later can be a crushing blow.")
910			hide("node53")
911		end,
912	},
913	{
914		id = "node54",
915		text = _"I'm ready to try hacking bots.",
916		code = function()
917			Npc:says(_"I certainly hope so.")
918			Npc:says(_"I should, however, take the time to tell you a few more things.")
919			Npc:says(_"Hacking, like most other programs, incurs a cost to you.")
920			Npc:says(_"Processing programs seems to heat up your brain.")
921			Npc:says(_"You seem to be able to handle quite a bit of heat, but you have your limits.")
922			Npc:says(_"If you do not use all charges when attempting to take over a bot, you will spare some heat.")
923			Npc:says(_"Not activating all charges or beating the bot with a comfortable winning margin is less exhaustive for you.")
924			Npc:says(_"If you nevertheless accumulate too much heat, you will automatically shut down in order to cool off.")
925			Npc:says(_"Over time, the heat will seep away from your body naturally. However, there are ways to speed up the process.")
926			Npc:says(_"If you can find them, cooling drinks will quickly relieve your thermal discomfort, in much the same way healing drinks help your health.")
927			Npc:says(_"Remember you also have a special program called [b]Emergency Shutdown[/b] that will lower your heat level drastically. Unfortunately using Emergency Shutdown will shut you down and render you paralyzed for several seconds. It makes you a sitting duck... er, penguin.")
928			Tux:says(_"I take it that was a joke also?")
929			Npc:says(_"Quite.", "NO_WAIT")
930			Npc:says(_"In addition to hacking, you have the ability to execute arbitrary code on bots.")
931			Npc:says(_"These scripts and programs can be learned through reading source code books. To read a book, right-click on it in inventory.")
932			Npc:says(_"You should have recovered your hacking ability by now, and I'll give you a couple of source code books as well.")
933			show("node55", "node57") hide("node54")
934		end,
935	},
936	{
937		id = "node55",
938		text = _"Thanks. I'm ready now.",
939		code = function()
940			Npc:says(_"We have several bots behind that fence for you to practice on.")
941			Npc:says(_"Take them over, then talk to me when they're all dead.")
942			Npc:says(_"If you need more help, don't hesitate to ask.")
943			Npc:says(_"Oh, and Linarian... If you fail when hacking, you'll receive an electrical shock.")
944			Npc:says(_"It shouldn't kill you, but you need to be aware of it nonetheless.")
945			if (not TutorialTom_hacking_bots) then
946				Tux:improve_program("Hacking")
947				Tux:improve_program("Emergency shutdown")
948				Tux:add_item("Liquid nitrogen", 1)
949				Tux:add_item("Source Book of Calculate Pi", 1)
950				Tux:add_item("Source Book of Malformed packet", 1)
951				TutorialTom_hacking_bots = true
952				Tux:update_quest("Tutorial Hacking", _"Tutorial Tom wants me to hack those bots. The only thing I need to worry about is overheating. But if I get too hot I can always try the Emergency shutdown program.")
953				change_obstacle_state("TutorialTakeoverCage", "opened")
954			end
955			hide("node55")
956			end_dialog()
957			-- TODO Also explain improving program revisions
958		end,
959	},
960	{
961		id = "node57",
962		text = _"Tell me again about take over, I'm not sure I got it all.",
963		code = function()
964			Npc:says(_"Tell me exactly what part you want me to explain again.")
965			Npc:says(_"But things will be much clearer once you try for yourself than when I try to explain.")
966			Npc:says(_"Use your experience as notes, and all should be clear.")
967			show("node51", "node52", "node53") hide("node57")
968		end,
969	},
970	{
971		id = "node58",
972		text = _"Can you tell me more about upgrading items?",
973		code = function()
974			Npc:says(_"You can upgrade most weapons and clothing. First, you'll need some materials to craft add-ons.")
975			Npc:says(_"Parts needed for this process can be extracted from bots. You'll have to learn how to do it.")
976			Npc:says(_"When you have enough materials, you can craft an add-on. Make sure the add-on is suitable for your equipment.")
977			Npc:says(_"After this, you have to make a socket in your equipment so you can plug in the add-on.")
978			Npc:says(_"That's the theory. Simple, isn't it?")
979			Npc:says(_"I'll give you some materials now and let you craft an add-on.")
980			Npc:says(_"Pay attention to the type of socket the add-on needs.")
981			Tux:update_quest("Tutorial Upgrading Items", _"Before crafting an add-on I have to get some materials. The best way is to extract them from the bots, using Extract Bot Parts skill. Each add-on requires a socket in the item. When the add-on is ready, I have to create a socket in the item and plug the add-on. Only technicians can craft add-ons or plug them.")
982			-- TODO decide on what type of upgrade should player make?
983			for i,v in ipairs(items_up) do
984				Tux:add_item(v, 20)
985			end
986
987			craft_addons()
988			Npc:says(_"Now you'll need to pay some more money in order to make a socket and plug in the add-on. Here, take some.")
989			Tux:add_gold(1200)
990			Npc:says(_"Choose an item and add an appropriate socket by clicking '+' on the right of the item. Then attach the add-on to this item and confirm your choice.")
991			upgrade_items()
992			Tux:end_quest("Tutorial Upgrading Items",_"Maybe I need some time to practice this, but I got the basics.")
993			hide("node58") show("node59", "node60", "node42")
994		end,
995	},
996	{
997		id = "node59",
998		text = _"I wasted my materials on the add-on I didn't need. Can you give more?",
999		code = function()
1000			Npc:says(_"Yes, but only this time. I'll give you some money too. Just be more careful in the future and make wise choices.")
1001			Npc:says(_"Reality is not as generous as I am.")
1002			for i,v in ipairs(items_up) do
1003				Tux:add_item(v, 20)
1004			end
1005
1006			Tux:add_gold(1200)
1007			Tux:says(_"Thank you.")
1008			Npc:says(_"Think carefully before you make your next add-on.")
1009			hide("node59")
1010		end,
1011	},
1012	{
1013		id = "node60",
1014		text = _"Upgrading items is still too complex for me. Can you explain it again?",
1015		code = function()
1016			Npc:says(_"First step is finding materials. They may be extracted from bots, but you'll have to learn how to do it.")
1017			Npc:says(_"Those materials can be used in crafting add-ons. Make sure the add-on will fit your equipment. Also, remember the type of the socket your add-on needs.")
1018			Npc:says(_"I gave you materials. Let's craft an add-on now.")
1019			craft_addons()
1020			Npc:says(_"All you have to do now is to choose a suitable item and add a socket by clicking ''+'' on the right of the chosen item.")
1021			Npc:says(_"Remember you pay for both adding a socket and plugging an add-on.")
1022			Npc:says(_"Let's try it, shall we?")
1023			upgrade_items()
1024			Npc:says(_"I hope it's clear now.")
1025		end,
1026	},
1027	{
1028		id = "node61",
1029		text = _"Shops?",
1030		code = function()
1031			Npc:says(_"Some people are willing to trade items and circuits with you.")
1032			--Npc:says(_"Although, if you have too many circuits, they will charge you a bit more.") http://rb.freedroid.org/r/1327/
1033			Npc:says(_"Most are willing to buy whatever you have, at a discounted price.")
1034			Npc:says(_"There are also some automated vending machines, that dispense small items.") -- but these cannot buy from you.") -- to be implemented
1035			hide("node61") show("node62")
1036		end,
1037	},
1038	{
1039		id = "node62",
1040		text = _"I would like to practice selling an item.",
1041		code = function()
1042			Npc:says(_"I'm going to give you a Small Axe, which you can't use yet, so you can practice selling it to me.")
1043			Npc:says(_"You will see the Small Axe appear in the lower shop bar. You can sell most of these items.")
1044			Npc:says(_"Items that you have equipped have a hand icon on them.")
1045			Npc:says(_"However, if you sell the items from the chest (which should have been equipped automatically) I won't be giving you replacements.")
1046			Npc:says(_"Select the Small Axe and click the sell button.")
1047			Tux:add_item("Small Tutorial Axe")
1048			i = 1
1049			while (i < 100) do -- this is a ugly hack to get rid of the "Item received: Small Axe" centerprint
1050				display_big_message("")
1051				i = i + 1
1052			end
1053			hide("node62") next("node63")
1054		end,
1055	},
1056	{
1057		id = "node63",
1058		text = _"Let me try that again.",
1059		echo_text = false,
1060		code = function()
1061			trade_with("TutorialTom")
1062			if (Tux:has_item_backpack("Small Tutorial Axe")) then
1063				show("node63")
1064			else
1065				hide("node63")
1066				show("node64")
1067			end
1068		end,
1069	},
1070	{
1071		id = "node64",
1072		text = _"How about buying an item?",
1073		code = function()
1074			Npc:says(_"Well it is much the same procedure, except the items for sale are on the top row.")
1075			Npc:says(_"With the circuits from selling the Small Axe to me, you can afford to buy a unit of Bottled ice.")
1076			Npc:says(_"Since Bottled ice combine together, a slider will pop-up asking how many you'd like to buy.")
1077			Npc:says(_"You have enough circuits for one unit.")
1078			sell_item("Bottled Tutorial ice")
1079			hide("node64") next("node65")
1080		end,
1081	},
1082	{
1083		--hidden
1084		id = "node65",
1085		text = _"Let me try that again.",
1086		echo_text = false,
1087		code = function()
1088			if (Tux:get_gold() < 15) then
1089				Tux:add_gold(15 - Tux:get_gold())
1090			end
1091			trade_with("TutorialTom")
1092			if (Tux:count_item_backpack("Bottled Tutorial ice") < 1) then
1093				show("node65")
1094			else
1095				hide("node65")
1096				next("node66")
1097			end
1098		end,
1099	},
1100	{
1101		--hidden
1102		id = "node66",
1103		code = function()
1104			Npc:says(_"You will occasionally run into items that can't be sold.")
1105			Npc:says(_"This generally means that the shopkeeper can't give you a reasonable deal on it.")
1106			Npc:says(_"Someone else probably wants the item.")
1107			Npc:says(_"You might check your questbook to see if it is mentioned there.")
1108			if (Tux:has_item_backpack("Bottled Tutorial ice")) then --before player notices, swap the "tutorial" item to normal one :P
1109				local Tutorial_ice_amount = Tux:count_item("Bottled Tutorial ice")
1110				Tux:del_item_backpack("Bottled Tutorial ice", Tutorial_ice_amount)
1111				Tux:add_item("Bottled ice", Tutorial_ice_amount)
1112				display_big_message("") -- so that we don't have the Item Received: spam on the screen which might be confusing
1113				display_big_message("")
1114				display_big_message("")
1115				display_big_message("")
1116				display_big_message("")
1117				display_big_message("")
1118				display_big_message("")
1119				display_big_message("")
1120				display_big_message("")
1121				display_big_message("")
1122				display_big_message("")
1123			else
1124				Npc:says("ERROR OCCURRED, TutorialTom node 66, player doesn't have bottled tutorial ice, WTF happened??")
1125			end
1126			armor_node_one = true
1127			if (armor_node_two) then
1128				show("node19")
1129			end
1130		end,
1131	},
1132	{
1133		id = "node70",
1134		text = _"There is a wall in the path! How will we get through?",
1135		code = function()
1136			if (cmp_obstacle_state("TutorialWall", "broken")) then
1137				Npc:says(_"Uhm, looks like the wall is already broken, I'll repair it.")
1138				change_obstacle_state("TutorialWall", "intact")
1139			else
1140				Npc:says(_"Notice that part of it is made of a weak material, glass.")
1141				Npc:says(_"Obstacles you can interact with change color when your cursor is hovering over them.")
1142				Npc:says(_"[b]Left click[/b] on the glass wall to break it.")
1143				Npc:says(_"After you break through the glass wall, walk to the other side so I know you are ready to move on.")
1144			end
1145			end_dialog()
1146		end,
1147	},
1148	{
1149		id = "node71",
1150		text = _"I defeated all the bots in the cage.",
1151		code = function()
1152			Npc:says(_"Well done!")
1153			Npc:says(_"Then let us move towards the next stage of the Tutorial")
1154			change_obstacle_state("TutorialGlasswallDoor", "opened")
1155			Npc:says(_"As a reward, I'm giving you a .22 Automatic pistol.")
1156			if (Tux:has_item("Source Book of Calculate Pi")) and
1157			   (Tux:has_item("Source Book of Malformed packet")) then
1158				--plural
1159				Npc:says(_"But I have to take these sourcebooks from you to prevent you from cheating in the next section of the tutorial.")
1160				Npc:says(_"Sorry about that...")
1161				Tux:says(_"Ok...")
1162			elseif (Tux:has_item("Source Book of Calculate Pi")) or
1163			       (Tux:has_item("Source Book of Malformed packet")) then
1164				--singular
1165				Npc:says(_"But I have to take this sourcebook from you to prevent you from cheating in the next section of the tutorial.")
1166				Npc:says(_"Sorry about that...")
1167				Tux:says(_"Ok...")
1168			end
1169			if (Tux:has_item("Source Book of Calculate Pi")) then -- ugly, but it shall do
1170				Tux:del_item("Source Book of Calculate Pi")
1171			end
1172			if (Tux:has_item("Source Book of Malformed packet")) then
1173				Tux:del_item("Source Book of Malformed packet")
1174			end
1175			Tux:add_item(".22 Automatic", 1)
1176			Tux:add_item(".22 LR Ammunition", 10)
1177			TutorialTom_has_gun = true
1178			TutorialTom_hide_71 = true
1179			hide("node42", "node50", "node51", "node52", "node53", "node57", "node71")
1180			end_dialog()
1181		end,
1182	},
1183
1184--    							Quick Menu (to jump to sections)
1185
1186	{
1187		id = "node80",
1188		text = _"I'd like to skip to a later section of the Tutorial.",
1189		code = function()
1190			Npc:says(_"OK, what would you like to learn about?")
1191			show("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1192			hide("node1", "node7", "node80")
1193		end,
1194	},
1195
1196	{
1197		id = "node81",
1198		text = _"Chests and Armor",
1199		code = function()
1200			Npc:says(_"OK, I'll take us to the Chest.")
1201			Npc:teleport("TutorialTom-Chest")
1202			Tux:teleport("TutorialTux-Chest")
1203			tutorial_chests_and_armor_and_shops()
1204			next("node10")
1205			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1206		end,
1207	},
1208
1209	{
1210		id = "node82",
1211		text = _"Shops",
1212		code = function()
1213			Npc:says(_"Remember to pick up the items in the chest.")
1214			Npc:says(_"I'll tell you about the shops.")
1215			Npc:teleport("TutorialTom-Chest")
1216			Tux:teleport("TutorialTux-Chest")
1217			tutorial_chests_and_armor_and_shops()
1218			next("node61")
1219			show("node19")
1220			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1221		end,
1222	},
1223
1224	{
1225		id = "node83",
1226		text = _"Melee Combat",
1227		code = function()
1228			Npc:says(_"OK, I'll take us to the melee arena and give you some armor.")
1229			Npc:teleport("TutorialTom-Melee")
1230			Tux:teleport("TutorialTux-Melee")
1231			Tux:add_quest("Tutorial Melee", _"I skipped ahead to the Melee practice. Tom gave me some armor to use.")
1232			tutorial_melee_combat()
1233			next("node20")
1234			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1235		end,
1236	},
1237
1238	{
1239		id = "node85",
1240		text = _"Abilities",
1241		code = function()
1242			Npc:says(_"OK, I'll take us there and give you some armor and a weapon.")
1243			Npc:teleport("TutorialTom-Terminal")
1244			Tux:teleport("TutorialTux-Terminal")
1245			tutorial_abilities()
1246			next("node40")
1247			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1248		end,
1249	},
1250
1251	{
1252		id = "node86",
1253		text = _"Upgrading Items & Terminals",
1254		code = function()
1255			Npc:says(_"OK, I'll take us there and give you some armor and a weapon to work with.")
1256			Npc:teleport("TutorialTom-Terminal")
1257			Tux:teleport("TutorialTux-Terminal")
1258			tutorial_upgrade_items_and_terminal()
1259			if (not Tux:has_quest("Tutorial Upgrading Items")) then
1260				Tux:add_quest("Tutorial Upgrading Items", "")
1261			end
1262			next("node58")
1263			show("node42")
1264			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1265		end,
1266	},
1267
1268	{
1269		id = "node87",
1270		text = _"Hacking Bots",
1271		code = function()
1272			Npc:says(_"OK, I'll take us to the hacking area. Also, I'll give you some XP so you can improve your cooling.")
1273			Tux:add_xp(2000)
1274			Npc:teleport("TutorialTom-Takeover")
1275			Tux:teleport("TutorialTom-Takeover")
1276			tutorial_hacking()
1277			next("node50")
1278			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1279		end,
1280	},
1281
1282	{
1283		id = "node84",
1284		text = _"Ranged Combat",
1285		code = function()
1286			Npc:says(_"OK, I'll take us to the shooting range and give you some armor and a weapon.")
1287			Npc:teleport("TutorialTom-Ranged")
1288			Tux:teleport("TutorialTux-Ranged")
1289			change_obstacle_state("TutorialShootCage", "opened")
1290			tutorial_ranged_combat()
1291			next("node30")
1292			hide("node81", "node82", "node83", "node84", "node85", "node86", "node87")
1293		end,
1294	},
1295
1296	{
1297		id = "node99",
1298		text = _"Let me take a short break and practice on my own for a while.",
1299		code = function()
1300			Npc:says(_"Ok, I'll be around if you need any more questions answered. Don't hesitate to ask.")
1301			end_dialog()
1302		end,
1303	},
1304}
1305