public static void RTFailureHandler(Part part, string type, bool failure) { foreach (PartModule m in part.FindModulesImplementing <PartModule>()) { if (RemoteTech.IsAntenna(m)) { RemoteTech.SetBroken(m, failure); } } }
// apply type-specific hacks to enable/disable the module void Apply(bool b) { switch (type) { case "ProcessController": if (b) { foreach (PartModule m in modules) { Lib.SetResourceFlow(part, (m as ProcessController).resource, false); } } break; case "ModuleDeployableSolarPanel": case "ModuleDeployableRadiator": if (b) { part.FindModelComponents <Animation>().ForEach(k => k.Stop()); } break; case "ModuleLight": if (b) { foreach (PartModule m in modules) { ModuleLight light = m as ModuleLight; if (light.animationName.Length > 0) { new Animator(part, light.animationName).Still(0.0f); } else { part.FindModelComponents <Light>().ForEach(k => k.enabled = false); } } } break; case "ModuleEngines": case "ModuleEnginesFX": if (b) { foreach (PartModule m in modules) { (m as ModuleEngines).Shutdown(); } } break; case "ModuleEnginesRF": if (b) { foreach (PartModule m in modules) { Lib.ReflectionCall(m, "Shutdown"); } } break; case "ModuleScienceExperiment": if (b) { foreach (PartModule m in modules) { (m as ModuleScienceExperiment).SetInoperable(); } } break; } if (RemoteTech.Enabled) { foreach (PartModule m in part.FindModulesImplementing <PartModule>()) { if (RemoteTech.IsAntenna(m)) { RemoteTech.SetBroken(m, b); } } } }