- fix tux not advancing on worldmap after solving a level
[supertux.git] / data / scripts / console.nut
1 /**
2  * This script is loaded into the console script interpreter.
3  * You should define shortcuts and helper functions that are usefull for the
4  * console here
5  */
6
7 function flip()
8 {
9         Level.flip_vertically();
10 }
11
12 function finish()
13 {
14         Level.finish(true);
15 }
16
17 function worldmapfinish()
18 {
19         save_state();
20         foreach(levelname, level in state.worlds[state.world].levels) {
21                 level.solved = true;
22         }
23         update_worldmap();
24 }
25
26 function grow()
27 {
28         sector.Tux.add_bonus("grow");
29 }
30
31 function fire()
32 {
33         sector.Tux.add_bonus("fireflower");
34 }
35
36 function ice()
37 {
38         sector.Tux.add_bonus("iceflower");
39 }
40
41 function shrink()
42 {
43         sector.Tux.add_bonus("none");
44 }
45
46 function kill()
47 {
48         sector.Tux.kill(true);
49 }
50
51 function lifeup()
52 {
53         sector.Tux.add_coins(100);
54 }
55
56 /**
57  * Display a list of functions in the roottable (or in the table specified)
58  */
59 function functions(...)
60 {
61         local obj = this;
62         if(vargc == 1)
63                 obj = vargv[0];
64         if(::type(obj) == "instance")
65                 obj = obj.getclass()
66
67         while(obj != null) {
68                 foreach(key, val in obj) {
69                         if(::type(val) == "function")
70                                 println(key);
71                 }
72                 obj = obj.parent;
73         }
74 }
75