Some more sounds from Some_Person
[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 useful 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 edit()
18 {
19         Level.edit(true);
20 }
21
22 function play()
23 {
24         Level.edit(false);
25 }
26
27 function worldmapfinish()
28 {
29         save_state();
30         foreach(world in state.worlds) {
31                 foreach(levelname, level in world.levels) {
32                         level.solved = true;
33                 }
34         }
35         update_worldmap();
36 }
37
38 function grow()
39 {
40         sector.Tux.add_bonus("grow");
41 }
42
43 function fire()
44 {
45         sector.Tux.add_bonus("fireflower");
46 }
47
48 function ice()
49 {
50         sector.Tux.add_bonus("iceflower");
51 }
52
53 function shrink()
54 {
55         sector.Tux.add_bonus("none");
56 }
57
58 function kill()
59 {
60         sector.Tux.kill(true);
61 }
62
63 function lifeup()
64 {
65         sector.Tux.add_coins(100);
66 }
67
68 /**
69  * Display a list of functions in the roottable (or in the table specified)
70  */
71 function functions(...)
72 {
73         local obj = this;
74         if(vargc == 1)
75                 obj = vargv[0];
76         if(::type(obj) == "instance")
77                 obj = obj.getclass()
78
79         while(obj != null) {
80                 foreach(key, val in obj) {
81                         if(::type(val) == "function")
82                                 println(key);
83                 }
84                 obj = obj.parent;
85         }
86 }
87