public override void OnUpdate() { base.OnUpdate(); double dElectric_Draw = 10.0 * dW_to_EC; double elecAvail = part.RequestResource("ElectricCharge", dElectric_Draw) / dElectric_Draw; bool bPowered = (elecAvail > 0.90); dIndicated_Deviation = -10.0; sStation_ID = "---"; if (bPowered) { cNav_Select = null; foreach (Part p in vessel.Parts) { //string sMsg1 = "VI: " + p.name; //print(sMsg1); foreach (PartModule m in p.Modules) { //string sMsg2 = "VIm: " + m.name; //print(sMsg2); VHF_NAV_Receiver cNav = m as VHF_NAV_Receiver; if (cNav != null) { cNav_Select = cNav; } } } if (cNav_Select != null) { //string sMsg = "GLS indicator found receiver " + cNav_Select.moduleName; //print(sMsg); GLS cGLS = cNav_Select.getTunedGLS(); if (cGLS != null) { dIndicated_Deviation = cGLS.getOffset(cNav_Select.getPosition()); sStation_ID = cGLS.sStation_ID; } else { sStation_ID = "---"; } } else { sStation_ID = "---"; } } }