###############################################
# Drogues system by Jano. Thanks to him. 2010 #
# Updated for MP Helijah 01/2025              #
###############################################

toggle_refuelling_drogues = func {

  # if (getprop("controls/refuelling/refuelling-drogues-pos-norm") > 0) {
  if (getprop("sim/multiplay/generic/float[2]") > 0) {

    # interpolate("controls/refuelling/refuelling-drogues-pos-norm", 0, 5);
    interpolate("sim/multiplay/generic/float[2]", 0, 5);

    settimer( func() {
      setprop("tanker", 0);
    }, 0);

  } else {

    # interpolate("controls/refuelling/refuelling-drogues-pos-norm", 1, 5);
    interpolate("sim/multiplay/generic/float[2]", 1, 5);

    settimer( func() {
      # if (getprop("controls/refuelling/refuelling-drogues-pos-norm") == 1 ) {
      if (getprop("sim/multiplay/generic/float[2]") == 1 ) {
        setprop("tanker", 1);
      } else {
        setprop("tanker", 0);
      }
    }, 6);
  }
}
