Exemple #1
0
        /// <summary>
        /// Load the values from the config node of the persistence file.
        /// Put your loading logic in DI_OnLoad()
        /// </summary>
        public override void OnLoad(ConfigNode node)
        {
            try
            {
                // Load all the internal state variables
                this.HasInitted           = DangIt.Parse <bool>(node.GetValue("HasInitted"), false);
                this.Age                  = DangIt.Parse <float>(node.GetValue("Age"), defaultTo: 0f);
                this.TimeOfLastReset      = DangIt.Parse <float>(node.GetValue("TimeOfLastReset"), defaultTo: float.PositiveInfinity);
                this.TimeOfLastInspection = DangIt.Parse <float>(node.GetValue("TimeOfLastInspection"), defaultTo: float.NegativeInfinity);
                this.LastFixedUpdate      = DangIt.Parse <float>(node.GetValue("LastFixedUpdate"), defaultTo: 0f);
                this.CurrentMTBF          = DangIt.Parse <float>(node.GetValue("CurrentMTBF"), defaultTo: float.PositiveInfinity);
                this.LifeTimeSecs         = DangIt.Parse <float>(node.GetValue("LifeTimeSecs"), defaultTo: float.PositiveInfinity);
                this.HasFailed            = DangIt.Parse <bool>(node.GetValue("HasFailed"), defaultTo: false);

                print("FailureModule.OnLoad");
                // Run the subclass' custom onload
                this.DI_OnLoad(node);

                // If OnLoad is called during flight, call the start again
                // so that modules can be rescanned
                if (HighLogic.LoadedSceneIsFlight)
                {
                    this.DI_Start(StartState.Flying);
                }

                base.OnLoad(node);
            }
            catch (Exception e)
            {
                this.OnError(e);
            }
        }
Exemple #2
0
 // Get the max servicing temp from DANGIT_SETTINGS
 public int GetMaxServicingTemp()
 {
     UrlDir.UrlConfig[] node = GameDatabase.Instance.GetConfigs("DANGIT_SETTINGS");
     foreach (UrlDir.UrlConfig curSet in node)
     {
         int val = DangIt.Parse <int> (curSet.config.GetValue("MaxServicingTemp"), 400);
         DangIt.Instance.Log("Found a DANGIT_SETTINGS, its MaxServiceTemp is " + val.ToString());
         return(val);
     }
     return(400);
 }
Exemple #3
0
        protected override void DI_OnLoad(ConfigNode node)
        {
            if (part != null && part.partInfo != null)
            {
                Logger.Info("ModuleTankReliability.DI_OnLoad, part: " + part.partInfo.title);
            }
            else
            {
                Logger.Info("ModuleTankReliability.DI_OnLoad, no part");
            }
            this.pole = DangIt.Parse <float>("pole", 0.01f);

            this.leakName = node.GetValue("leakName");

            if (string.IsNullOrEmpty(leakName))
            {
                leakName = "none"; // null;;
            }
            this.FailureLog("OnLoad: loaded leakName " + ((leakName == null) ? "none" : leakName));
        }
 protected override void DI_OnLoad(ConfigNode node)
 {
     this.ignorePitch = DangIt.Parse <bool>(node.GetValue("ignorePitch"), defaultTo: false);
     this.ignoreRoll  = DangIt.Parse <bool>(node.GetValue("ignoreRoll"), defaultTo: false);
     this.ignoreYaw   = DangIt.Parse <bool>(node.GetValue("ignoreYaw"), defaultTo: false);
 }