1
0

engines-yasim.nas 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #Initialise
  2. var engine1 = engines.Jet.new(0, 0, 0.01, 5.21, 3, 4, 2, 4);
  3. var engine2 = engines.Jet.new(1, 0, 0.01, 5.21, 3, 4, 2, 4);
  4. engine1.init();
  5. engine2.init();
  6. props.globals.initNode("/sim/autostart/started", 0, "BOOL");
  7. var eng1fuelon = func { setprop("/controls/engines/engine[0]/cutoff", 0); }
  8. var eng2fuelon = func { setprop("/controls/engines/engine[1]/cutoff", 0); }
  9. var eng1fueloff = func { setprop("/controls/engines/engine[0]/cutoff", 1); }
  10. var eng2fueloff = func { setprop("/controls/engines/engine[1]/cutoff", 1); }
  11. var eng1starter = func { setprop("/controls/engines/engine[0]/starter", 1); }
  12. var eng2starter = func { setprop("/controls/engines/engine[1]/starter", 1); }
  13. var eng1start = func {
  14. gui.popupTip("*** Engine start 1 left ***");
  15. eng1fueloff();
  16. eng1starter();
  17. settimer(eng1fuelon, 2);
  18. setprop("/controls/engines/engine[0]/condition", 1);
  19. }
  20. var eng2start = func {
  21. gui.popupTip("*** Engine start 2 right ***");
  22. eng2fueloff();
  23. eng2starter();
  24. settimer(eng2fuelon, 2);
  25. setprop("/controls/engines/engine[1]/condition", 1);
  26. }
  27. var engstart = func {
  28. settimer(eng1start, 2);
  29. settimer(eng2start, 10);
  30. }
  31. var engstop = func {
  32. eng1fueloff();
  33. setprop("/controls/engines/engine[0]/throttle", 0);
  34. setprop("/controls/engines/engine[0]/condition", 0);
  35. eng2fueloff();
  36. setprop("/controls/engines/engine[1]/throttle", 0);
  37. setprop("/controls/engines/engine[1]/condition", 0);
  38. }
  39. var autostart = func {
  40. var startstatus = getprop("/sim/autostart/started");
  41. if ( startstatus == 0 ) {
  42. gui.popupTip("Autostarting...");
  43. setprop("/sim/model/autostart", 1);
  44. setprop("/sim/autostart/started", 1);
  45. setprop("/controls/electric/battery-switch", 1);
  46. settimer(engstart, 0.4);
  47. gui.popupTip("Starting Engines");
  48. }
  49. if ( startstatus == 1 ) {
  50. gui.popupTip("Shutting Down...");
  51. setprop("/sim/model/autostart", 0);
  52. setprop("/sim/autostart/started", 0);
  53. engstop();
  54. }
  55. }
  56. var autostop = func {
  57. engstopf();
  58. apufueloff();
  59. }