fix bug with player not stopping when deactivated, make key support code simpler
[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 grow()
18 {
19         sector.Tux.add_bonus("grow");
20 }
21
22 function fire()
23 {
24         sector.Tux.add_bonus("fireflower");
25 }
26
27 function shrink()
28 {
29         sector.Tux.add_bonus("none");
30 }
31
32 function kill()
33 {
34         sector.Tux.kill(true);
35 }
36
37 function lifeup()
38 {
39         sector.Tux.add_coins(100);
40 }
41
42 /**
43  * Display a list of functions in the roottable (or in the table specified)
44  */
45 function functions(...)
46 {
47         local obj = this;
48         if(vargc == 1)
49                 obj = vargv[0];
50         if(::type(obj) == "instance")
51                 obj = obj.getclass()
52
53         while(obj != null) {
54                 foreach(key, val in obj) {
55                         if(::type(val) == "function")
56                                 println(key);
57                 }
58                 obj = obj.parent;
59         }
60 }
61