setlistener("/controls/engines/engine/extend-propeller", func{
	if(getprop("/controls/electric/engine-battery-switch") and !getprop("/engines/engine/running")){
		if(getprop("/controls/engines/engine/extend-propeller")){
			interpolate("/engines/engine/prop-pos-norm", 1.00, 5);
		}else{
			interpolate("/engines/engine/prop-pos-norm", 0.00, 5);
		}
	}
	
});
setlistener("/controls/engines/engine/magnetos", func{
	if(getprop("/controls/engines/engine/magnetos")<3){
		setprop("/consumables/fuel/tank/selected", 0);
	}else{
		setprop("/consumables/fuel/tank/selected", 1);	
	}
});

setlistener("/sim/signals/fdm-initialized", func{
	setprop("/consumables/fuel/tank/selected", 0);
	print("Hourmeter initialized");
	settimer(update_hourmeter, 36);
});

var update_hourmeter = func{
	
	if(getprop("/engines/engine/running")){
		setprop("/instrumentation/ilec/hours", (getprop("/instrumentation/ilec/hours") or 0)+0.01);
	}
	
	settimer(update_hourmeter, 36);
}
