fgr2.nas 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. ################################
  2. ## English Electric Lightning F6
  3. ## Master Nasal
  4. ################################
  5. ## Settings
  6. ###
  7. # Owner Options
  8. var difficulty = 0; # Set to 1 for advanced handling options e.g. engine overspeed, mach trim etc.
  9. var real_maintenance = 1; # Set to 1 for real maintenance conditions
  10. var maintenance_report = 1; # Set to 1 for a console maintenance report at startup
  11. ###
  12. # Propery Roots - usually no need to change these
  13. var diff_root = "sim/difficulty";
  14. var rm_root = "sim/maintenance";
  15. var doorpath = "canopy";
  16. var doorpos = 1;
  17. ###
  18. # Presets
  19. var acname = "FGR2"; # Script Display Name
  20. var main_loop_interval = 1; # Main loop update period in seconds
  21. var aux_loop_interval = 60; # Auxiliary loop update period in seconds
  22. ################################
  23. ## Objects
  24. ###
  25. # Engines
  26. var engines = {
  27. # Arguments: ( number, running, idle_throttle, max_start_n1, start_threshold, spool_time, start_time, shutdown_time)
  28. #Jet.new(4 , 0 , 0.105 , 10 , 6 , 1 , 0.05 , 3);
  29. engine1: yasimengines.Jet.new(0 , 0 , 0.005 , 12.8 , 10 , 1.9 , 0.05 , 1),
  30. engine2: yasimengines.Jet.new(1 , 0 , 0.005 , 12.8 , 10 , 1.9 , 0.05 , 1),
  31. };
  32. ###
  33. # Doors ( & Canopies )
  34. # Arguments: ( property path, seconds, start position )
  35. var canopy = aircraft.door.new(doorpath, 5, 1);
  36. ###
  37. # Lights
  38. var lightpath = "sim/model/lights";
  39. ###
  40. # Airbrakes
  41. ###
  42. # Saved Data
  43. aircraft.data.load();
  44. var savedata = [
  45. # This is a list of properties saved to disk every 60 seconds
  46. "sim/maintenance/airframe-seconds",
  47. "sim/maintenance/engine[0]/operating-seconds",
  48. "sim/maintenance/engine[1]/operating-seconds",
  49. ];
  50. aircraft.data.add(savedata);
  51. ################################
  52. ## Initialisation & Internals
  53. ###
  54. # Loading Message
  55. print("Loading "~acname~" Master Nasal");
  56. # Check installed modules
  57. var eng_loaded = props.globals.getNode("nasal/yasimengines/loaded").getBoolValue();
  58. var rm_loaded = props.globals.getNode("nasal/maintenance/loaded").getBoolValue();
  59. var el_loaded = 0;
  60. ###
  61. # Main Initialise Function
  62. var init = func {
  63. print("Initialising "~acname~" Master Nasal...");
  64. var diff_status = "Easy";
  65. var rm_status = "Off";
  66. if ( props.globals.getNode(diff_root~"/difficult-mode",1).getBoolValue() ) {
  67. difficulty = 1;
  68. }
  69. if ( difficulty ) { var diff_status = "Difficult" };
  70. # Check loaded modules
  71. if ( rm_loaded ) {
  72. print("Maintenance module loaded");
  73. if ( real_maintenance ) {
  74. var rm_status = "On";
  75. #print(" - Airframe Hours: " ~afhours);
  76. maintenance.init();
  77. maintenance.airframe_hours();
  78. if ( maintenance_report ) {
  79. print("\nMaintenance Report:\n==================\n");
  80. var mrep = maintenance.report();
  81. print (mrep);
  82. }
  83. }
  84. }
  85. if ( el_loaded ) {
  86. print("Electrical System module loaded");
  87. }
  88. print(" - Difficulty setting: "~diff_status);
  89. print(" - Maintenance Mode: "~rm_status);
  90. props.globals.getNode(diff_root~"/difficult-mode",1).setBoolValue(difficulty);
  91. props.globals.getNode(rm_root~"/enabled",1).setBoolValue(real_maintenance);
  92. eno.init();
  93. engines.engine1.init();
  94. engines.engine2.init();
  95. auxloop.start();
  96. }
  97. ###
  98. # Difficulty
  99. var diffprop = props.globals.getNode( diff_root~"/difficult-mode",1 );
  100. if ( diffprop.getBoolValue() ) { difficulty = 1 };
  101. diffprop.setBoolValue(difficulty);
  102. ###
  103. # Maintenance
  104. ###
  105. # Loops
  106. var loops = {
  107. main: func {
  108. },
  109. aux: func {
  110. # print("Aux Loop Looping!"); #Debug
  111. if ( props.globals.getNode(rm_root~"/enabled",1).getBoolValue() ) { maintenance.rm_loop(); }
  112. # Save
  113. aircraft.data.save();
  114. },
  115. };
  116. ###
  117. # Timers
  118. var auxloop = maketimer(aux_loop_interval,loops.aux);
  119. ###
  120. # Go!
  121. setlistener("sim/signals/fdm-initialized", func {
  122. settimer( init, 2);
  123. });