##############################################################################
#                                  pylons                                    #
#                                                                            #
# BARANGER Emmanuel (Helijah) 04/2025                                        #
##############################################################################

var updatepylons = func {

  #                                       sim/model/show-tank
  var hidetanks  = props.globals.getNode("sim/multiplay/generic/bool[7]",1);
  var wingstanks = hidetanks.getBoolValue();
  if ( wingstanks == 1 ) {
    var running = props.globals.getNode("/controls/switches/starterkey-insert",1);
    var runningstate = running.getBoolValue();
    if ( runningstate == 1 ) {
      setprop("/consumables/fuel/tank[3]/selected",1);
      setprop("/consumables/fuel/tank[4]/selected",1);
      setprop("/consumables/fuel/tank[5]/selected",1);
      setprop("/consumables/fuel/tank[6]/selected",1);
    }
    setprop("/consumables/fuel/tank[3]/level-lbs",2016);
    setprop("/consumables/fuel/tank[4]/level-lbs",2016);
    setprop("/consumables/fuel/tank[5]/level-lbs",2016);
    setprop("/consumables/fuel/tank[6]/level-lbs",2016);
  } else {
    setprop("/consumables/fuel/tank[3]/selected",0);
    setprop("/consumables/fuel/tank[4]/selected",0);
    setprop("/consumables/fuel/tank[5]/selected",0);
    setprop("/consumables/fuel/tank[6]/selected",0);

    setprop("/consumables/fuel/tank[3]/level-lbs",0);
    setprop("/consumables/fuel/tank[4]/level-lbs",0);
    setprop("/consumables/fuel/tank[5]/level-lbs",0);
    setprop("/consumables/fuel/tank[6]/level-lbs",0);
  }

}

updatepylons();
