console.nut 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. function flip()
  7. {
  8. Level.flip_vertically();
  9. }
  10. function finish()
  11. {
  12. Level.finish(true);
  13. }
  14. function edit()
  15. {
  16. Level.edit(true);
  17. }
  18. function play()
  19. {
  20. Level.edit(false);
  21. }
  22. function worldmapfinish()
  23. {
  24. foreach(world in state.worlds) {
  25. foreach(levelname, level in world.levels) {
  26. level.solved = true;
  27. }
  28. }
  29. load_state();
  30. }
  31. function grow()
  32. {
  33. sector.Tux.add_bonus("grow");
  34. }
  35. function fire()
  36. {
  37. sector.Tux.add_bonus("fireflower");
  38. }
  39. function ice()
  40. {
  41. sector.Tux.add_bonus("iceflower");
  42. }
  43. function shrink()
  44. {
  45. sector.Tux.add_bonus("none");
  46. }
  47. function kill()
  48. {
  49. sector.Tux.kill(true);
  50. }
  51. function lifeup()
  52. {
  53. sector.Tux.add_coins(100);
  54. }
  55. /**
  56. * Display a list of functions in the roottable (or in the table specified)
  57. */
  58. function functions(...)
  59. {
  60. local obj = this;
  61. if(vargc == 1)
  62. obj = vargv[0];
  63. if(::type(obj) == "instance")
  64. obj = obj.getclass()
  65. while(obj != null) {
  66. foreach(key, val in obj) {
  67. if(::type(val) == "function")
  68. println(key);
  69. }
  70. obj = obj.parent;
  71. }
  72. }