doors.nas 758 B

12345678910111213141516171819202122232425262728293031323334
  1. # =====
  2. # Doors
  3. # =====
  4. Doors = {};
  5. Doors.new = func {
  6. obj = { parents : [Doors],
  7. crew : aircraft.door.new("instrumentation/doors/crew", 4.5)
  8. };
  9. return obj;
  10. };
  11. Doors.crewexport = func {
  12. if ( getprop("/velocities/airspeed-kt") < 70 or getprop("instrumentation/doors/crew/position-norm") > 0.05 ) {
  13. me.crew.toggle();
  14. } else {
  15. if ( getprop("/velocities/airspeed-kt") >= 70 ) {
  16. setprop("/tmp/alarm/beep_once",1);
  17. screen.log.write("Airspeed too high !!");
  18. }
  19. }
  20. }
  21. # ==============
  22. # Initialization
  23. # ==============
  24. # objects must be here, otherwise local to init()
  25. doorsystem = Doors.new();
  26. # without this toggle needs 2 calls after start
  27. # don't really understand why
  28. doorsystem.crewexport();