######################################################################
###                                                                ###
###                Guns fire only if view is done                  ###
###                                                                ###
### BARANGER Emmanuel aka Helijah 04/10/2024                       ###
###                               03/01/2025                       ###
###                               26/01/2025                       ###
###                               02/02/2025 for B17               ###
###                               09/08/2025 for He 111            ###
###                               11/08/2025 for He 177            ###
######################################################################

fire_MG = func {
  var CurrentView = getprop("sim/current-view/view-number-raw");
  print("CurrentView = ",CurrentView);
  if ( CurrentView == 100 ) {
    # Nose
    #setprop("/controls/armament/trigger0", 1);
    setprop("sim/multiplay/generic/int[10]", 1);
  } elsif ( CurrentView == 101 ) {
    # Roof
    #setprop("/controls/armament/trigger1", 1);
    setprop("sim/multiplay/generic/int[11]", 1);
  } elsif ( CurrentView == 102 ) {
    # Rear nose
    #setprop("/controls/armament/trigger2", 1);
    setprop("sim/multiplay/generic/int[12]", 1);
  } elsif ( CurrentView == 103 ) {
    # Tail
    #setprop("/controls/armament/trigger3", 1);
    setprop("sim/multiplay/generic/int[13]", 1);
  }
}

stop_MG = func {
  #setprop("/controls/armament/trigger0", 0);
  setprop("sim/multiplay/generic/int[10]", 0);
  #setprop("/controls/armament/trigger1", 0);
  setprop("sim/multiplay/generic/int[11]", 0);
  #setprop("/controls/armament/trigger2", 0);
  setprop("sim/multiplay/generic/int[12]", 0);
  #setprop("/controls/armament/trigger3", 0);
  setprop("sim/multiplay/generic/int[13]", 0);
}
