コード例 #1
0
        public void Load(ConfigNode node)
        {
            ConfigNode.LoadObjectFromConfig(this, node);

            allowedCrewedParts = new HashSet <string>();
            foreach (ConfigNode partsNode in node.GetNodes("ALLOWED_PARTS"))
            {
                foreach (string partName in partsNode.GetValues("part"))
                {
                    if (string.IsNullOrEmpty(partName))
                    {
                        continue;
                    }
                    allowedCrewedParts.Add(FixPartName(partName));
                }
            }

            bodyOverrides = new Dictionary <string, BodyOverride>();
            foreach (ConfigNode bodyNode in node.GetNodes("BODY"))
            {
                BodyOverride body = new BodyOverride();
                body.Load(bodyNode);
                bodyOverrides.Add(body.name, body);
            }
        }
コード例 #2
0
        public double GetMinPeriapsis(CelestialBody body)
        {
            int    minJitter    = periapsisMinJitter;
            double minPeriapsis = this.minPeriapsis;

            if (bodyOverrides.ContainsKey(body.name))
            {
                BodyOverride bodyOverride = bodyOverrides[body.name];
                if (bodyOverride.periapsisMinJitter >= 0)
                {
                    minJitter = bodyOverride.periapsisMinJitter;
                }

                if (bodyOverride.minPeriapsis >= 0)
                {
                    minPeriapsis = bodyOverride.minPeriapsis;
                }
            }

            if (body.atmosphere)
            {
                minPeriapsis = Math.Max(body.atmosphereDepth, minPeriapsis);
            }

            return(minPeriapsis + minJitter);
        }
コード例 #3
0
        public int GetJitter(CelestialBody body)
        {
            int minJitter = periapsisMinJitter;
            int maxJitter = periapsisMaxJitter;

            if (bodyOverrides.ContainsKey(body.name))
            {
                BodyOverride bodyOverride = bodyOverrides[body.name];
                if (bodyOverride.periapsisMinJitter >= 0)
                {
                    minJitter = bodyOverride.periapsisMinJitter;
                }

                if (bodyOverride.periapsisMaxJitter >= 0)
                {
                    maxJitter = bodyOverride.periapsisMaxJitter;
                }
            }

            return(Math.Max(0, maxJitter - minJitter));
        }