emu.nas 1.6 KB

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