// Specific support for some stock modules, mainly used to reset state when disabling modules. private ConfigNode ApplyEarlySpecifics(PartModule module) { if (module is ModuleEngines || module is ModuleEnginesFX) { module.part.stackIcon.ClearInfoBoxes(); } if (disableModule) { if (module is ModuleColorChanger) { moduleNode.SetValue("animState", false, true); } else if (module is ModuleLight) { // Doesn't work in flight moduleNode.SetValue("IsOn", false, true); ((ModuleLight)module).SetLightState(false); } else if (module is ModuleAnimateGeneric) { moduleNode.SetValue("aniState", "LOCKED", true); moduleNode.SetValue("animTime", 0f, true); } else if (module is ModuleAnimationGroup) { moduleNode.SetValue("isDeployed", false, true); } else if (module is ModuleDeployablePart) { // This one is tricky because the animation is private and is handled trough FixedUpdate moduleNode.SetValue("storedAnimationTime", 0f, true); moduleNode.SetValue("deployState", "RETRACTED", true); Animation[] anims = module.GetComponentsInChildren <Animation>(); string animName = ((ModuleDeployablePart)module).animationName; Animation deployAnim = null; for (int k = 0; k < anims.Count(); k++) { if (anims[k].GetClip(animName) != null) { deployAnim = anims[k]; } } if (deployAnim == null && anims.Count() > 0) { deployAnim = anims[0]; } if (deployAnim != null) { ((ModuleDeployablePart)module).panelRotationTransform.localRotation = ((ModuleDeployablePart)module).originalRotation; deployAnim[animName].normalizedTime = 0; deployAnim.Play(animName); deployAnim.Sample(); } } } return(moduleNode); }