some new debug commands for console
[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 /**
38  * Display a list of functions in the roottable (or in the table specified)
39  */
40 function functions(...)
41 {
42         local obj = this;
43         if(vargc == 1)
44                 obj = vargv[0];
45         if(::type(obj) == "instance")
46                 obj = obj.getclass()
47
48         while(obj != null) {
49                 foreach(key, val in obj) {
50                         if(::type(val) == "function")
51                                 println(key);
52                 }
53                 obj = obj.parent;
54         }
55 }
56