Exemplo n.º 1
0
        void SetSymmetryValues(int balloonSize, ModuleKerBalloon mkb, BalloonInfo b, int selectedPlanet, string payload)
        {
            Log.Info("SetSymmetryValues, persistentId: " + mkb.part.persistentId);

            mkb.balloonSize     = balloonSize;
            mkb.lastBalloonSize = lastBalloonSize;
            mkb.recommendedBody = b.recommendedBody;
            mkb.bodyG           = GetBodyG(recommendedBody);
            //Log.Info("recommendedBody: " + b.recommendedBody + ", bodyName: " + recommendedBody + ", bodyG: " + bodyG);
            mkb.minAtmoPressure       = b.minAtmoPressure;
            mkb.maxAtmoPressure       = b.maxAtmoPressure;
            mkb.minScale              = b.minScale;
            mkb.maxScale              = b.maxScale;
            mkb.minLift               = b.minLift;
            mkb.maxLift               = b.maxLift;
            mkb.targetTWR             = b.targetTWR;
            mkb.liftLimit             = liftLimit;
            mkb.speedLimiter          = b.speedLimiter;
            mkb.maxSpeed              = b.maxSpeed;
            mkb.maxSpeedTolerence     = b.maxSpeedTolerence;
            mkb.speedAdjustStep       = b.speedAdjustStep;
            mkb.speedAdjustMin        = b.speedAdjustMin;
            mkb.speedAdjustMax        = b.speedAdjustMax;
            mkb.CFGballoonObject      = b.CFGballoonObject;
            mkb.CFGropeObject         = b.CFGropeObject;
            mkb.CFGcapObject          = b.CFGcapObject;
            mkb.CFGliftPointObject    = b.CFGliftPointObject;
            mkb.CFGballoonPointObject = b.CFGballoonPointObject;


            mkb.payload         = payload;
            mkb.selectedPayload = selectedPayload;
            mkb.bodyName        = b.recommendedBody;
        }
Exemplo n.º 2
0
        void UpdatePersistentData()
        {
            Log.Info("UpdatePersistentData, bodyName: " + bodyName);
            string size = "Size" + balloonSize.ToString();

            if (Statics.balloonSizes.ContainsKey(size))
            {
                var    sizeDict = Statics.balloonSizes[size].balloonInfoDict;
                string key      = BalloonInfo.MakeKey(size, payload, bodyName);
                if (sizeDict.ContainsKey(key))
                {
                    var binfo = sizeDict[key];
                    // if (binfo.recommendedBody != recommendedBody)
                    SetValues(binfo);
                }
                else
                {
                    Log.Info("balloonSizes, key: " + key + ", not found");
                }
            }
            else
            {
                Log.Info("balloonSizes, size: " + size + ", not found");
            }
        }
Exemplo n.º 3
0
        void SetValues(BalloonInfo b)
        {
            Log.Info("SetValues");
            //Log.Info("payload: " + b.payload + ", body: " + b.recommendedBody + ", techRequired: " + b.techRequired +
            //    ", minAtmoP: " + b.minAtmoPressure.ToString("F3") + ", maxAtmoP: " + b.maxAtmoPressure.ToString("F3") +
            //    ", minScale: " + b.minScale + ", maxScale: " + b.maxScale + ", minLift: " + b.minLift + ", maxLift: " + b.maxLift +
            //  ", speedlimiter: " + b.speedLimiter + ", maxSpeed: " + b.maxSpeed + ", maxSpeedTolerence: " + b.maxSpeedTolerence +
            //  ", speedAdjustMin: " + b.speedAdjustMin + ", speedAdjustMax: " + b.speedAdjustMax);

            foreach (var p in part.symmetryCounterparts)
            {
                var m = p.FindModuleImplementing <ModuleKerBalloon>();
                SetSymmetryValues(balloonSize, m, b, selectedPlanet, payload);
            }
            SetSymmetryValues(balloonSize, this, b, selectedPlanet, payload);
        }
Exemplo n.º 4
0
        public static void LoadBalloonInfo()
        {
            string filename = KSPUtil.ApplicationRootPath + "/GameData/KerBalloons/PluginData/balloonSpecs.csv";

            filename = filename.Replace('/', Path.DirectorySeparatorChar);
            var binfolist = File.ReadAllLines(filename)
                            .Skip(2)
                            .Select(v => BalloonInfo.FromCsv(v))
                            .ToList();

            Log.Info("binfolist.Count: " + binfolist.Count());
            foreach (var b in binfolist)
            {
                if (!balloonSizes.ContainsKey(b.size))
                {
                    balloonSizes.Add(b.size, new BalloonSize(b.size));
                }
                balloonSizes[b.size].balloonInfoDict.Add(BalloonInfo.MakeKey(b.size, b.payload, b.recommendedBody), b);
            }
            Log.Info("balloonSizes.Count: " + balloonSizes.Count());
        }
Exemplo n.º 5
0
        public static BalloonInfo FromCsv(string csvLine)
        {
            string[] values = csvLine.Split(',');
            Statics.Log.Info("csvLine: " + csvLine);
            BalloonInfo info = new BalloonInfo();

            info.payload               = values[0];
            info.size                  = values[1];
            info.recommendedBody       = values[2];
            info.techRequired          = values[3];
            info.minAtmoPressure       = Statics.SafeParse(values[4], 0f);
            info.maxAtmoPressure       = Statics.SafeParse(values[5], 0f);
            info.minScale              = Statics.SafeParse(values[6], 0f);
            info.maxScale              = Statics.SafeParse(values[7], 0f);
            info.minLift               = Statics.SafeParse(values[8], 0f);
            info.maxLift               = Statics.SafeParse(values[9], 0f);
            info.targetTWR             = Statics.SafeParse(values[10], 0f);
            info.speedLimiter          = Statics.SafeParse(values[11], false);
            info.maxSpeed              = Statics.SafeParse(values[12], 0f);
            info.maxSpeedTolerence     = Statics.SafeParse(values[13], 0f);
            info.speedAdjustStep       = Statics.SafeParse(values[14], 0f);
            info.speedAdjustMin        = Statics.SafeParse(values[15], 0f);
            info.speedAdjustMax        = Statics.SafeParse(values[16], 0f);
            info.CFGballoonObject      = values[17];
            info.CFGropeObject         = values[18];
            info.CFGcapObject          = values[19];
            info.CFGliftPointObject    = values[20];
            info.CFGballoonPointObject = values[21];

            Statics.Log.Info("payload: " + info.payload + ", body: " + info.recommendedBody + ", techRequired: " + info.techRequired +
                             ", minAtmoP: " + info.minAtmoPressure.ToString("F3") + ", maxAtmoP: " + info.maxAtmoPressure.ToString("F3") +
                             ", minScale: " + info.minScale + ", maxScale: " + info.maxScale + ", minLift: " + info.minLift + ", maxLift: " + info.maxLift +
                             ", speedlimiter: " + info.speedLimiter + ", maxSpeed: " + info.maxSpeed + ", maxSpeedTolerence: " + info.maxSpeedTolerence +
                             ", speedAdjustMin: " + info.speedAdjustMin + ", speedAdjustMax: " + info.speedAdjustMax);
            return(info);
        }