emu.nas 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. props.globals.initNode("/sim/autostart/started", 0, "BOOL");
  2. var spool = props.globals.initNode("/engines/engine/spoolup", 0, "DOUBLE");
  3. var outside_volume = props.globals.initNode("/sound/outsidevolume", 0, "DOUBLE");
  4. var outside_volume = props.globals.initNode("/sound/insidevolume", 1, "DOUBLE");
  5. var eng1fuelon = func { setprop("/controls/engines/engine[0]/cutoff", 0); }
  6. var eng1fueloff = func { setprop("/controls/engines/engine[0]/cutoff", 1); setprop("/controls/engines/engine[0]/running", 0); }
  7. var eng1starter = func { setprop("/controls/engines/engine[0]/starter", 1); setprop("/controls/engines/engine[0]/running", 1); }
  8. var eng1start = func {
  9. interpolate(spool, 1, 40);
  10. eng1starter();
  11. }
  12. var engstop = func {
  13. eng1fueloff();
  14. }
  15. var autostart = func {
  16. var startstatus = getprop("/sim/autostart/started");
  17. if ( startstatus == 0 ) {
  18. gui.popupTip("Autostarting...");
  19. setprop("/sim/autostart/started", 1);
  20. setprop("/controls/electric/battery-switch", 1);
  21. settimer(eng1start, 2);
  22. gui.popupTip("Starting Engines");
  23. }
  24. if ( startstatus == 1 ) {
  25. gui.popupTip("Shutting Down...");
  26. setprop("/sim/autostart/started", 0);
  27. eng1fueloff();
  28. }
  29. }
  30. var autostop = func {
  31. eng1fueloff();
  32. apufueloff();
  33. }
  34. eng1fueloff();
  35. var switchinside = getprop("/sim/current-view/internal");
  36. var switch_listen = setlistener("/sim/current-view/internal",
  37. func {
  38. if( getprop("/sim/current-view/internal") ) {
  39. setprop("/sound/outsidevolume", 0);
  40. setprop("/sound/insidevolume", 1);
  41. }else {
  42. setprop("/sound/outsidevolume", 1);
  43. setprop("/sound/insidevolume", 0);
  44. }
  45. }
  46. );