ext_stores.nas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. #On verifie et on largue
  2. var dropTanks = func(){
  3. for(var i = 2 ;i < 5 ; i = i + 1 ){
  4. var select = getprop("sim/weight["~ i ~"]/selected");
  5. if(select == "droptank"){ load.dropLoad(i);}
  6. }
  7. }
  8. var Clean = func(){
  9. setprop("sim/weight[0]/selected", "NONE");
  10. setprop("sim/weight[1]/selected", "NONE");
  11. setprop("sim/weight[2]/selected", "NONE");
  12. setprop("sim/weight[3]/selected", "NONE");
  13. setprop("sim/weight[4]/selected", "NONE");
  14. setprop("sim/weight[5]/selected", "NONE");
  15. setprop("sim/weight[6]/selected", "NONE");
  16. setprop("sim/weight[7]/selected", "NONE");
  17. setprop("sim/weight[8]/selected", "NONE");
  18. }
  19. var Ferry = func(){
  20. setprop("consumables/fuel/tank[9]/selected", 0);
  21. setprop("consumables/fuel/tank[9]/capacity-gal_us", 0);
  22. setprop("consumables/fuel/tank[9]/level-gal_us", 0);
  23. setprop("consumables/fuel/tank[10]/selected", 0);
  24. setprop("consumables/fuel/tank[10]/capacity-gal_us", 0);
  25. setprop("consumables/fuel/tank[10]/level-gal_us", 0);
  26. setprop("consumables/fuel/tank[11]/selected", 0);
  27. setprop("consumables/fuel/tank[11]/capacity-gal_us", 0);
  28. setprop("consumables/fuel/tank[11]/level-gal_us", 0);
  29. setprop("sim/weight[0]/selected", "370_Gal_tank");
  30. setprop("sim/weight[1]/selected", "2xAIM-9");
  31. setprop("sim/weight[2]/selected", "NONE");
  32. setprop("sim/weight[3]/selected", "NONE");
  33. setprop("sim/weight[4]/selected", "600_Gal_tank");
  34. setprop("sim/weight[5]/selected", "NONE");
  35. setprop("sim/weight[6]/selected", "NONE");
  36. setprop("sim/weight[7]/selected", "2xAIM-9");
  37. setprop("sim/weight[8]/selected", "370_Gal_tank");
  38. setprop("consumables/fuel/tank[9]/selected", 1);
  39. setprop("consumables/fuel/tank[9]/capacity-gal_us", 370);
  40. setprop("consumables/fuel/tank[9]/level-gal_us", 370);
  41. setprop("consumables/fuel/tank[10]/selected", 1);
  42. setprop("consumables/fuel/tank[10]/capacity-gal_us", 600);
  43. setprop("consumables/fuel/tank[10]/level-gal_us", 600);
  44. setprop("consumables/fuel/tank[11]/selected", 1);
  45. setprop("consumables/fuel/tank[11]/capacity-gal_us", 370);
  46. setprop("consumables/fuel/tank[11]/level-gal_us", 370);
  47. }
  48. var QRA = func(){
  49. setprop("consumables/fuel/tank[9]/selected", 0);
  50. setprop("consumables/fuel/tank[9]/capacity-gal_us", 0);
  51. setprop("consumables/fuel/tank[9]/level-gal_us", 0);
  52. setprop("consumables/fuel/tank[11]/selected", 0);
  53. setprop("consumables/fuel/tank[11]/capacity-gal_us", 0);
  54. setprop("consumables/fuel/tank[11]/level-gal_us", 0);
  55. setprop("sim/weight[0]/selected", "370_Gal_tank");
  56. setprop("sim/weight[1]/selected", "2xAIM-9");
  57. setprop("sim/weight[2]/selected", "AIM-7");
  58. setprop("sim/weight[3]/selected", "AIM-7");
  59. setprop("sim/weight[4]/selected", "SUU-23A gun pod");
  60. setprop("sim/weight[5]/selected", "AIM-7");
  61. setprop("sim/weight[6]/selected", "AIM-7");
  62. setprop("sim/weight[7]/selected", "2xAIM-9");
  63. setprop("sim/weight[8]/selected", "370_Gal_tank");
  64. setprop("consumables/fuel/tank[9]/selected", 1);
  65. setprop("consumables/fuel/tank[9]/capacity-gal_us", 370);
  66. setprop("consumables/fuel/tank[9]/level-gal_us", 370);
  67. setprop("consumables/fuel/tank[11]/selected", 1);
  68. setprop("consumables/fuel/tank[11]/capacity-gal_us", 370);
  69. setprop("consumables/fuel/tank[11]/level-gal_us", 370);
  70. }
  71. var CAP = func(){
  72. setprop("sim/weight[0]/selected", "NONE");
  73. setprop("sim/weight[1]/selected", "2xAIM-9");
  74. setprop("sim/weight[2]/selected", "AIM-7");
  75. setprop("sim/weight[3]/selected", "AIM-7");
  76. setprop("sim/weight[4]/selected", "SUU-23A gun pod");
  77. setprop("sim/weight[5]/selected", "AIM-7");
  78. setprop("sim/weight[6]/selected", "AIM-7");
  79. setprop("sim/weight[7]/selected", "2xAIM-9");
  80. setprop("sim/weight[8]/selected", "NONE");
  81. }
  82. var bombrun = func(){
  83. setprop("consumables/fuel/tank[9]/selected", 0);
  84. setprop("consumables/fuel/tank[9]/capacity-gal_us", 0);
  85. setprop("consumables/fuel/tank[9]/level-gal_us", 0);
  86. setprop("consumables/fuel/tank[11]/selected", 0);
  87. setprop("consumables/fuel/tank[11]/capacity-gal_us", 0);
  88. setprop("consumables/fuel/tank[11]/level-gal_us", 0);
  89. setprop("sim/weight[0]/selected", "370_Gal_tank");
  90. setprop("sim/weight[1]/selected", "3xBL-755CB");
  91. setprop("sim/weight[2]/selected", "AIM-7");
  92. setprop("sim/weight[3]/selected", "AIM-7");
  93. setprop("sim/weight[4]/selected", "NONE");
  94. setprop("sim/weight[5]/selected", "AIM-7");
  95. setprop("sim/weight[6]/selected", "AIM-7");
  96. setprop("sim/weight[7]/selected", "3xBL-755CB");
  97. setprop("sim/weight[8]/selected", "370_Gal_tank");
  98. setprop("consumables/fuel/tank[9]/selected", 1);
  99. setprop("consumables/fuel/tank[9]/capacity-gal_us", 370);
  100. setprop("consumables/fuel/tank[9]/level-gal_us", 370);
  101. setprop("consumables/fuel/tank[11]/selected", 1);
  102. setprop("consumables/fuel/tank[11]/capacity-gal_us", 370);
  103. setprop("consumables/fuel/tank[11]/level-gal_us", 370);
  104. }
  105. var bombrunheavy = func(){
  106. setprop("consumables/fuel/tank[9]/selected", 0);
  107. setprop("consumables/fuel/tank[9]/capacity-gal_us", 0);
  108. setprop("consumables/fuel/tank[9]/level-gal_us", 0);
  109. setprop("consumables/fuel/tank[11]/selected", 0);
  110. setprop("consumables/fuel/tank[11]/capacity-gal_us", 0);
  111. setprop("consumables/fuel/tank[11]/level-gal_us", 0);
  112. setprop("sim/weight[0]/selected", "370_Gal_tank");
  113. setprop("sim/weight[1]/selected", "3xMK13-bomb");
  114. setprop("sim/weight[2]/selected", "AIM-7");
  115. setprop("sim/weight[3]/selected", "AIM-7");
  116. setprop("sim/weight[4]/selected", "NONE");
  117. setprop("sim/weight[5]/selected", "AIM-7");
  118. setprop("sim/weight[6]/selected", "AIM-7");
  119. setprop("sim/weight[7]/selected", "3xMK13-bomb");
  120. setprop("sim/weight[8]/selected", "370_Gal_tank");
  121. setprop("consumables/fuel/tank[9]/selected", 1);
  122. setprop("consumables/fuel/tank[9]/capacity-gal_us", 370);
  123. setprop("consumables/fuel/tank[9]/level-gal_us", 370);
  124. setprop("consumables/fuel/tank[11]/selected", 1);
  125. setprop("consumables/fuel/tank[11]/capacity-gal_us", 370);
  126. setprop("consumables/fuel/tank[11]/level-gal_us", 370);
  127. }
  128. var bombrunlong = func(){
  129. setprop("consumables/fuel/tank[9]/selected", 0);
  130. setprop("consumables/fuel/tank[9]/capacity-gal_us", 0);
  131. setprop("consumables/fuel/tank[9]/level-gal_us", 0);
  132. setprop("consumables/fuel/tank[10]/selected", 0);
  133. setprop("consumables/fuel/tank[10]/capacity-gal_us", 0);
  134. setprop("consumables/fuel/tank[10]/level-gal_us", 0);
  135. setprop("consumables/fuel/tank[11]/selected", 0);
  136. setprop("consumables/fuel/tank[11]/capacity-gal_us", 0);
  137. setprop("consumables/fuel/tank[11]/level-gal_us", 0);
  138. setprop("sim/weight[0]/selected", "370_Gal_tank");
  139. setprop("sim/weight[1]/selected", "3xBL-755CB");
  140. setprop("sim/weight[2]/selected", "AIM-7");
  141. setprop("sim/weight[3]/selected", "AIM-7");
  142. setprop("sim/weight[4]/selected", "370_Gal_tank");
  143. setprop("sim/weight[5]/selected", "AIM-7");
  144. setprop("sim/weight[6]/selected", "AIM-7");
  145. setprop("sim/weight[7]/selected", "3xBL-755CB");
  146. setprop("sim/weight[8]/selected", "370_Gal_tank");
  147. setprop("consumables/fuel/tank[9]/selected", 1);
  148. setprop("consumables/fuel/tank[9]/capacity-gal_us", 370);
  149. setprop("consumables/fuel/tank[9]/level-gal_us", 370);
  150. setprop("consumables/fuel/tank[10]/selected", 1);
  151. setprop("consumables/fuel/tank[10]/capacity-gal_us", 370);
  152. setprop("consumables/fuel/tank[10]/level-gal_us", 370);
  153. setprop("consumables/fuel/tank[11]/selected", 1);
  154. setprop("consumables/fuel/tank[11]/capacity-gal_us", 370);
  155. setprop("consumables/fuel/tank[11]/level-gal_us", 370);
  156. }
  157. var GA = func(){
  158. setprop("sim/weight[0]/selected", "NONE");
  159. setprop("sim/weight[1]/selected", "2xSNEB");
  160. setprop("sim/weight[2]/selected", "AIM-7");
  161. setprop("sim/weight[3]/selected", "AIM-7");
  162. setprop("sim/weight[4]/selected", "SUU-23A gun pod");
  163. setprop("sim/weight[5]/selected", "AIM-7");
  164. setprop("sim/weight[6]/selected", "AIM-7");
  165. setprop("sim/weight[7]/selected", "2xSNEB");
  166. setprop("sim/weight[8]/selected", "NONE");
  167. }
  168. var GAextended = func(){
  169. setprop("consumables/fuel/tank[9]/selected", 0);
  170. setprop("consumables/fuel/tank[9]/capacity-gal_us", 0);
  171. setprop("consumables/fuel/tank[9]/level-gal_us", 0);
  172. setprop("consumables/fuel/tank[11]/selected", 0);
  173. setprop("consumables/fuel/tank[11]/capacity-gal_us", 0);
  174. setprop("consumables/fuel/tank[11]/level-gal_us", 0);
  175. setprop("sim/weight[0]/selected", "370_Gal_tank");
  176. setprop("sim/weight[1]/selected", "2xSNEB");
  177. setprop("sim/weight[2]/selected", "AIM-7");
  178. setprop("sim/weight[3]/selected", "AIM-7");
  179. setprop("sim/weight[4]/selected", "SUU-23A gun pod");
  180. setprop("sim/weight[5]/selected", "AIM-7");
  181. setprop("sim/weight[6]/selected", "AIM-7");
  182. setprop("sim/weight[7]/selected", "2xSNEB");
  183. setprop("sim/weight[8]/selected", "370_Gal_tank");
  184. setprop("consumables/fuel/tank[9]/selected", 1);
  185. setprop("consumables/fuel/tank[9]/capacity-gal_us", 370);
  186. setprop("consumables/fuel/tank[9]/level-gal_us", 370);
  187. setprop("consumables/fuel/tank[11]/selected", 1);
  188. setprop("consumables/fuel/tank[11]/capacity-gal_us", 370);
  189. setprop("consumables/fuel/tank[11]/level-gal_us", 370);
  190. }
  191. #La boite de dialogue
  192. var ext_loads_dlg = gui.Dialog.new("dialog","Aircraft/FGR2/Dialogs/external-loads.xml");
  193. #Begining of the dropable function.
  194. #It has to be simplified and generic made
  195. #Need to know how to make a table
  196. dropLoad = func (number) {
  197. var select = getprop("sim/weight["~ number ~"]/selected");
  198. if(select != "none"){
  199. if(select == "Droptank"){
  200. tank_submodel(number,select);
  201. setprop("consumables/fuel/tank["~ number ~"]/selected", 0);
  202. settimer(func load.dropLoad_stop(number),2);
  203. setprop("controls/armament/station["~ number ~"]/release", 1);
  204. setprop("sim/weight["~ number ~"]/selected", "none");
  205. setprop("sim/weight["~ number ~"]/weight-lb", 0);
  206. }else{
  207. load.dropMissile(number);
  208. settimer(func load.dropLoad_stop(number),0.5);
  209. }
  210. }
  211. }
  212. #Need to be changed
  213. dropLoad_stop = func(n) {
  214. setprop("controls/armament/station["~ n ~"]/release", 0);
  215. }
  216. dropMissile = func (number) {
  217. var target = hud.closest_target();
  218. if(target == nil){ return;}
  219. #print(typeMissile);
  220. var typeMissile = getprop("sim/weight["~ number ~"]/selected");
  221. missile.Loading_missile(typeMissile);
  222. Current_missile = missile.MISSILE.new(number);
  223. Current_missile.status = 0;
  224. Current_missile.search(target);
  225. Current_missile.release();
  226. setprop("controls/armament/station["~ number ~"]/release", 1);
  227. setprop("sim/weight["~ number ~"]/selected", "none");
  228. setprop("sim/weight["~ number ~"]/weight-lb", 0);
  229. }
  230. var tank_submodel = func (pylone, select){
  231. #Drop Tanks
  232. if(pylone == 1 and select == "Droptank"){ setprop("controls/armament/station[1]/release-droptank", 1);}
  233. if(pylone == 4 and select == "Droptank"){ setprop("controls/armament/station[4]/release-droptank", 1);}
  234. if(pylone == 8 and select == "Droptank"){ setprop("controls/armament/station[8]/release-droptank", 1);}
  235. }