/// <summary> /// Checks if the config for this TweakScale instance is valid. If not, logs it and returns false. /// </summary> /// <returns>True if the config is invalid, false otherwise.</returns> private bool CheckForInvalidCfg() { if (ScaleFactors.Length != 0) { return(false); } if (_invalidCfg) { return(true); } _invalidCfg = true; Tools.LogWf("{0}({1}) has no valid scale factors. This is probably caused by an invalid TweakScale configuration for the part.", part.name, part.partInfo.title); Debug.Log("[TweakScale]" + this.ToString()); Debug.Log("[TweakScale]" + ScaleType.ToString()); return(true); }
/// <summary> /// Disable TweakScale module if something is wrong. /// </summary> /// <returns>True if something is wrong, false otherwise.</returns> private bool CheckIntegrity() { if (ScaleFactors.Length == 0) { enabled = false; // disable TweakScale module Tools.LogWf("{0}({1}) has no valid scale factors. This is probably caused by an invalid TweakScale configuration for the part.", part.name, part.partInfo.title); Debug.Log("[TweakScale]" + this.ToString()); Debug.Log("[TweakScale]" + ScaleType.ToString()); return(true); } if (this != part.GetComponent <TweakScale>()) { enabled = false; // disable TweakScale module Tools.LogWf("Duplicate TweakScale module on part [{0}] {1}", part.partInfo.name, part.partInfo.title); Fields["tweakScale"].guiActiveEditor = false; Fields["tweakName"].guiActiveEditor = false; return(true); } return(false); }
/// <summary> /// Disable TweakScale module if something is wrong. /// </summary> /// <returns>True if something is wrong, false otherwise.</returns> private bool FailsIntegrity() { if (this != part.Modules.GetModules <TweakScale>().First()) { enabled = false; // disable TweakScale module this.is_duplicate = true; // Flags this as not persistent Fields["tweakScale"].guiActiveEditor = false; Fields["tweakName"].guiActiveEditor = false; Log.warn("Duplicate TweakScale module on part [{0}] {1}", part.partInfo.name, part.partInfo.title); return(true); } if (ScaleFactors.Length == 0) { enabled = false; // disable TweakScale module Log.warn("{0}({1}) has no valid scale factors. This is probably caused by an invalid TweakScale configuration for the part.", part.name, part.partInfo.title); Log.dbg(this.ToString()); Log.dbg(ScaleType.ToString()); return(true); } return(false); }