#	Warning lights
var mp_inhg = props.globals.getNode( "engines/engine[0]/mp-inhg-2", 1);
mp_inhg.setDoubleValue( 0.0 );
var mp_flash_sig = props.globals.initNode( "engines/engine[0]/mp-flash-signal", 0, "BOOL");
var mp_flash_sig_var = 0;

var mp_flash = aircraft.light.new( "engines/engine[0]/mp-flash", [ 0.3, 0.3 ], mp_flash_sig );

var time_takeoff_power = 0.0;

var check_mp = func {
	if( mp_inhg.getDoubleValue() > 34.0 ){
		if( time_takeoff_power > 300 ){
			mp_flash_sig.setBoolValue( 1 );
			mp_flash_sig_var = 1;
		} else {
			time_takeoff_power += 1.0;
			reset_mp_flash();
		}
	} else {
		time_takeoff_power -= 10.0;
		reset_mp_flash();
	}
}

var reset_takeoff_timer = func {
	if( mp_inhg.getDoubleValue() <= 34.0 ){
		time_takeoff_power = 0.0;
	}
}

var reset_mp_flash = func {
	if( mp_flash_sig_var == 1 ){
		mp_flash_sig.setBoolValue( 0 );
		mp_flash_sig_var = 0;
	}
}

var check_mp_loop = maketimer( 1.0, check_mp );
check_mp_loop.simulatedTime = 1;
check_mp_loop.start();

#	Magneto Switch Sound Effect

var last_magneto_value = getprop("/controls/engines/engine[0]/magnetos");

setlistener("/controls/engines/engine[0]/magnetos", func( i ) {
	if( i.getValue() != last_magneto_value ){
		last_magneto_value = i.getValue();
		setprop("/controls/engines/engine[0]/magneto-click", 1 );
		settimer( func() { setprop("/controls/engines/engine[0]/magneto-click", 0 ) }, 0.01 );
	}
});
