RDR160.nas 997 B

123456789101112131415161718192021222324252627282930313233343536
  1. # This file should be loaded in the aircraft set file like so:
  2. # <nasal>
  3. # <radar>
  4. # <file>Aircraft/Instruments-3d/RDR-160/RDR160.nas</file>
  5. # </radar>
  6. #</nasal>
  7. #
  8. #
  9. var switch_mode=["off","stby","tst","on"];
  10. var s_pos =props.globals.initNode("instrumentation/radar/switch-pos",0,"INT");
  11. var r_rng =props.globals.initNode("instrumentation/radar/range",10,"DOUBLE");
  12. var r_sw =props.globals.initNode("instrumentation/radar/switch","off");
  13. var set_range=func(rng){
  14. var Rng = r_rng.getValue();
  15. if(rng==1){
  16. Rng=Rng*2;
  17. if(Rng >160)Rng=160;
  18. }elsif(rng==-1){
  19. Rng=Rng*0.5;
  20. if(Rng <10)Rng=10;
  21. }
  22. r_rng.setValue(Rng);
  23. };
  24. var set_switch=func(sw){
  25. var switchpos=s_pos.getValue() or 0;
  26. switchpos+=sw;
  27. if(switchpos>3)switchpos=3;
  28. if(switchpos<0)switchpos=0;
  29. s_pos.setValue(switchpos);
  30. r_sw.setValue(switch_mode[switchpos]);
  31. };