Exemple #1
0
        private void UpdateCoverage()
        {
            for (int i = 0; i < Coverages.Length; i++)
            {
                Coverages [i].satCount = 0;
            }

            Vessel[] Satellites = VesselHelper.GetSatellites();

            for (int i = 0; i < Satellites.Length; i++)
            {
                Vessel Satellite = Satellites [i];

                CelestialBody  Body   = Satellite.GetOrbit().referenceBody;
                CoverageReport Report = GetReport(Body.GetName());
                Report.satCount++;
                Report.Update();
            }

            float totalCoverage = 0;

            for (int i = 0; i < Coverages.Length; i++)
            {
                totalCoverage += Coverages [i].coverage;
            }

            satelliteCoverage = (float)totalCoverage / (float)Coverages.Length;
        }
 public void OnCrash(EventReport Evt)
 {
     Log.Info("OnCrash, part: " + Evt.origin.partInfo.title);
     if (VesselHelper.PartHasModuleAlias(Evt.origin, "Command") || VesselHelper.PartHasModuleAlias(Evt.origin, "AutonomousCommand"))
     {
         ModuleStateFundingDisposable m = null;
         if (Evt.origin.Modules.Contains("ModuleStateFundingDisposable"))
         {
             m = Evt.origin.Modules["ModuleStateFundingDisposable"] as ModuleStateFundingDisposable;
         }
         if (m == null)
         {
             Log.Info("OnCrash, m is null");
         }
         else
         if (m.disposable)
         {
             Log.Warning("EXPENDABLE VESSEL DESTROYED");
         }
         else
         {
             Log.Warning("VESSEL DESTROYED");
             GameInstance.ActiveReview.variables.vesselsDestroyed++;
         }
         //InstanceConf.saveInstance (GameInstance);
     }
 }
        public static Vessel[] GetMiningRigs()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] MiningRigs = VesselHelper.GetVesselsWithModuleAliases(new string[] {
                "Drill"
            });

            for (var i = 0; i < MiningRigs.Length; i++)
            {
                Vessel MiningRig = MiningRigs[i];
                if ((MiningRig.Landed || OnAsteroid(MiningRig)) &&
                    MiningRig.vesselType != VesselType.Station &&
                    MiningRig.vesselType != VesselType.Base &&
                    MiningRig.landedAt != SpaceCenter.Instance.cb.GetName() &&
                    VesselHelper.HasEnergy(MiningRig) &&
                    VesselHelper.GeneratesEnergy(MiningRig) &&
                    VesselHelper.HasCommunication(MiningRig))
                {
                    ReturnVessels.Add(MiningRig);
                }
            }

            return(ReturnVessels.ToArray());
        }
        public static Vessel[] GetLandedScienceStations()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] ScienceLabs = VesselHelper.GetVesselsWithModuleAliases(new string[] {
                "ScienceLab"
            });

            for (var i = 0; i < ScienceLabs.Length; i++)
            {
                Vessel ScienceLab = ScienceLabs[i];

                if (VesselHelper.HasCrew(ScienceLab) &&
                    ScienceLab.Landed &&
                    ScienceLab.vesselType != VesselType.Station &&
                    ScienceLab.vesselType != VesselType.Base &&
                    ScienceLab.landedAt != SpaceCenter.Instance.cb.GetName() &&
                    VesselHelper.HasEnergy(ScienceLab) &&
                    VesselHelper.GeneratesEnergy(ScienceLab) &&
                    VesselHelper.HasCommunication(ScienceLab))
                {
                    ReturnVessels.Add(ScienceLab);
                }
            }

            return(ReturnVessels.ToArray());
        }
        public static Vessel[] GetSatellites()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] Satellites = VesselHelper.GetVesselsWithModuleAliases(new string[] {
                "Energy",
                "Communication",
                "AutonomousCommand"
            });

            for (int i = 0; i < Satellites.Length; i++)
            {
                Vessel Satellite = Satellites[i];

                if (!Satellite.Landed &&
                    (Satellite.vesselType == VesselType.Probe || Satellite.vesselType == VesselType.Relay) &&
                    Satellite.GetOrbit() != null &&
                    Satellite.GetOrbit().referenceBody != Planetarium.fetch.Sun &&
                    !VesselHelper.HasCrew(Satellite))
                {
                    ReturnVessels.Add(Satellite);
                }
            }

            return(ReturnVessels.ToArray());
        }
Exemple #6
0
        public static Vessel[] GetSatellites()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] Satellites = VesselHelper.GetVesselsWithModules(new string[] {
                "ModuleDeployableSolarPanel",
                "ModuleDataTransmitter",
                "ModuleSAS"
            });

            for (int i = 0; i < Satellites.Length; i++)
            {
                Vessel Satellite = Satellites [i];

                if (!Satellite.Landed)
                {
                    if (Satellite.GetOrbit() != null && Satellite.GetOrbit().referenceBody.GetName() != "Sun")
                    {
                        if (!VesselHelper.HasCrew(Satellite))
                        {
                            ReturnVessels.Add(Satellite);
                        }
                    }
                }
            }

            return(ReturnVessels.ToArray());
        }
        private void LoadMiningRigs()
        {
            reloadBase();

            Window.title = "Mining Rigs";
            Instance GameInstance = StateFundingGlobal.fetch.GameInstance;
            Review   Rev          = GameInstance.ActiveReview;

            Rev.touch();

            string Description = "Below is a list of existing Mining Rigs. Having more Mining Rigs increases State " +
                                 "Confidence. To have a qualified Mining Rig is must have an antenna, drill, be able to generate power, " +
                                 "and be Landed on a body other than Kerbin.";

            ViewLabel DescriptionLabel = new ViewLabel(Description);

            DescriptionLabel.setRelativeTo(Window);
            DescriptionLabel.setLeft(140);
            DescriptionLabel.setTop(20);
            DescriptionLabel.setColor(Color.white);
            DescriptionLabel.setHeight(100);
            DescriptionLabel.setWidth(Window.getWidth() - 140);

            this.addComponent(DescriptionLabel);

            ViewLabel TotalCoverage = new ViewLabel("Mining Rigs: " + Rev.miningRigs);

            TotalCoverage.setRelativeTo(Window);
            TotalCoverage.setLeft(140);
            TotalCoverage.setTop(130);
            TotalCoverage.setColor(Color.white);
            TotalCoverage.setHeight(30);
            TotalCoverage.setWidth(Window.getWidth() - 140);

            this.addComponent(TotalCoverage);

            Vessel[] MiningRigs = VesselHelper.GetMiningRigs();

            int offsetY     = 150;
            int labelHeight = 20;

            for (int i = 0; i < MiningRigs.Length; i++)
            {
                Vessel MiningRig = MiningRigs [i];

                string label = MiningRig.GetName() + " is Landed At " + MiningRig.mainBody.GetName();;

                ViewLabel MiningLabel = new ViewLabel(label);
                MiningLabel.setRelativeTo(Window);
                MiningLabel.setTop(offsetY + labelHeight + (labelHeight + 5) * i);
                MiningLabel.setLeft(140);
                MiningLabel.setHeight(labelHeight);
                MiningLabel.setWidth(Window.getWidth() - 140);
                MiningLabel.setColor(Color.white);

                this.addComponent(MiningLabel);
            }
        }
 public void OnCrashSplashdown(EventReport Evt)
 {
     if (VesselHelper.PartHasModuleAlias(Evt.origin, "Command") || VesselHelper.PartHasModuleAlias(Evt.origin, "AutonomousCommand"))
     {
         Debug.LogWarning("VESSEL DESTROYED");
         GameInstance.ActiveReview.vesselsDestroyed++;
         InstanceConf.saveInstance(GameInstance);
     }
 }
 public void OnCrashSplashdown(EventReport Evt)
 {
     Log.Info("OnCrashSplashdown, part: " + Evt.origin.partInfo.title);
     if (VesselHelper.PartHasModuleAlias(Evt.origin, "Command") || VesselHelper.PartHasModuleAlias(Evt.origin, "AutonomousCommand"))
     {
         Log.Warning("VESSEL DESTROYED");
         GameInstance.ActiveReview.vesselsDestroyed++;
         //InstanceConf.saveInstance (GameInstance);
     }
 }
 public void load()
 {
     Debug.Log("StateFunding Mod Loading");
     AppLauncher = new StateFundingApplicationLauncher();
     InitGovernments();
     InitEvents();
     InstanceConf = new InstanceConfig();
     ReviewMgr    = new ReviewManager();
     VesselHelper.LoadAliases();
     loadSave();
     Debug.Log("StateFunding Mod Loaded");
 }
Exemple #11
0
        private void UpdateBases()
        {
            Debug.Log("Updating Bases");

            Instance GameInstance = StateFundingGlobal.fetch.GameInstance;

            Vessel[] _Bases = VesselHelper.GetBases();
            Bases = new BaseReport[_Bases.Length];

            for (int i = 0; i < _Bases.Length; i++)
            {
                Vessel     Base        = _Bases [i];
                BaseReport _BaseReport = new BaseReport();
                _BaseReport.name          = Base.vesselName;
                _BaseReport.crew          = VesselHelper.GetCrew(Base).Length;
                _BaseReport.crewCapacity  = VesselHelper.GetCrewCapactiy(Base);
                _BaseReport.dockedVessels = VesselHelper.GetDockedVesselsCount(Base);
                _BaseReport.dockingPorts  = VesselHelper.GetDockingPorts(Base).Length;
                _BaseReport.drill         = VesselHelper.VesselHasModuleAlias(Base, "Drill");
                _BaseReport.scienceLab    = VesselHelper.VesselHasModuleAlias(Base, "ScienceLab");
                _BaseReport.fuel          = VesselHelper.GetResourceCount(Base, "LiquidFuel");
                _BaseReport.ore           = VesselHelper.GetResourceCount(Base, "Ore");
                _BaseReport.entity        = Base.landedAt;

                _BaseReport.po = 0;
                _BaseReport.sc = 0;

                _BaseReport.po += (int)(5 * _BaseReport.crew * GameInstance.Gov.poModifier);
                _BaseReport.po += (int)(5 * _BaseReport.dockedVessels * GameInstance.Gov.poModifier);
                _BaseReport.po += (int)((BodyHelper.GetBody(Base.landedAt).Radius / 60000f) * (_BaseReport.dockedVessels + 1) * GameInstance.Gov.poModifier);

                _BaseReport.sc += (int)(2 * _BaseReport.crewCapacity * GameInstance.Gov.scModifier);
                _BaseReport.sc += (int)(_BaseReport.fuel / 200f * GameInstance.Gov.scModifier);
                _BaseReport.sc += (int)(_BaseReport.ore / 200f * GameInstance.Gov.scModifier);
                _BaseReport.sc += (int)(2 * _BaseReport.dockingPorts * GameInstance.Gov.scModifier);
                _BaseReport.sc += (int)(2 * _BaseReport.crewCapacity * GameInstance.Gov.scModifier);

                if (_BaseReport.scienceLab)
                {
                    _BaseReport.po += (int)(10 * GameInstance.Gov.poModifier);
                    _BaseReport.sc += (int)(10 * GameInstance.Gov.poModifier);
                }

                if (_BaseReport.drill)
                {
                    _BaseReport.po += (int)(10 * GameInstance.Gov.poModifier);
                    _BaseReport.sc += (int)(10 * GameInstance.Gov.poModifier);
                }

                Bases [i] = _BaseReport;
            }
        }
        public void load()
        {
            Log.Info("StateFunding Mod Loading");
            //AppLauncher = new StateFundingApplicationLauncher();
            AppLauncher = OnSpaceCentre.Instance.gameObject.AddComponent <StateFundingApplicationLauncher>();


            InitGovernments();
            InitEvents();
            VesselHelper.LoadAliases();
            StateFundingGlobal.isLoaded = true;

            //StateFundingGlobal.Sun = Planetarium.fetch.Sun.GetName();

            Log.Info("StateFunding Mod Loaded");

            if (StateFundingGlobal.needsDataInit)
            {
                Log.Info("StateFunding performing data init");
                var NewView = new NewInstanceConfigView();
                NewView.OnCreate((InstanceData Inst) =>
                {
                    for (int i = 0; i < StateFundingGlobal.fetch.Governments.ToArray().Length; i++)
                    {
                        Government Gov = StateFundingGlobal.fetch.Governments.ToArray()[i];
                        if (Gov.name == Inst.govName)
                        {
                            Inst.Gov = Gov;
                            break;
                        }
                    }
                    HighLogic.CurrentGame.Parameters.CustomParams <StateFundingSettings>().budgetPeriodsPerYear = Inst.Gov.budgetPeriodsPerYear;

                    StateFundingScenario.Instance.data   = Inst;
                    StateFundingScenario.Instance.isInit = true;
                    StateFundingGlobal.needsDataInit     = false;
                    Log.Info("StateFunding data init completed");
                    ReviewMgr.CompleteReview();
                });
            }
            else
            {
                for (int i = 0; i < StateFundingGlobal.fetch.Governments.ToArray().Length; i++)
                {
                    Government Gov = StateFundingGlobal.fetch.Governments.ToArray()[i];
                    if (Gov.name == StateFundingScenario.Instance.data.govName)
                    {
                        StateFundingScenario.Instance.data.Gov = Gov;
                    }
                }
            }
        }
Exemple #13
0
        public static bool HasLiquidFuel(Vessel Vsl)
        {
            ProtoPartModuleSnapshot[] LiquidFuelModules = VesselHelper.GetModules(Vsl, "LiquidFuel");
            for (var i = 0; i < LiquidFuelModules.Length; i++)
            {
                ProtoPartModuleSnapshot LiquidFuelModule = LiquidFuelModules [i];
                if (int.Parse(LiquidFuelModule.moduleValues.GetValue("amount")) > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
        public static bool WorkingWheels(Vessel Vsl)
        {
            ProtoPartModuleSnapshot[] Wheels = VesselHelper.GetModulesWithAlias(Vsl, "Wheel");
            if (Wheels.Length >= 4)
            {
                return(true);
            }

            return(false);

            // TODO: Check to see if they're borken

            /*
             * for (int i = 0; i < Wheels.Length; i++) {
             * ProtoPartSnapshot Wheel = Wheels [i];
             * }*/
        }
Exemple #15
0
        public static bool IsStranded(ProtoCrewMember Kerb)
        {
            Vessel Vsl = GetVessel(Kerb);

            if (Vsl != null)
            {
                if (!VesselHelper.HasLiquidFuel(Vsl))
                {
                    if (!VesselHelper.VesselHasModule(Vsl, "ModuleScienceLab"))
                    {
                        if (!VesselHelper.VesselHasModule(Vsl, "ModuleResourceHarvester"))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Exemple #16
0
        public static Vessel[] GetOrbitingScienceStations()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] ScienceLabs = VesselHelper.GetVesselsWithModules(new string[] {
                "ModuleDeployableSolarPanel",
                "ModuleDataTransmitter",
                "ModuleScienceLab"
            });

            for (var i = 0; i < ScienceLabs.Length; i++)
            {
                Vessel ScienceLab = ScienceLabs [i];

                if (VesselHelper.HasCrew(ScienceLab) && !ScienceLab.Landed)
                {
                    ReturnVessels.Add(ScienceLab);
                }
            }

            return(ReturnVessels.ToArray());
        }
        public static Vessel[] GetRovers()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] Rovers = (Vessel[])FlightGlobals.Vessels.ToArray();

            for (var i = 0; i < Rovers.Length; i++)
            {
                Vessel Rover = Rovers[i];
                if (Rover.vesselType == VesselType.Rover)
                {
                    if (Rover.Landed && Rover.landedAt != SpaceCenter.Instance.cb.GetName() &&
                        VesselHelper.HasEnergy(Rover) &&
                        VesselHelper.WorkingWheels(Rover))
                    {
                        ReturnVessels.Add(Rover);
                    }
                }
            }

            return(ReturnVessels.ToArray());
        }
        public static Vessel[] GetBases()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] Bases = (Vessel[])FlightGlobals.Vessels.ToArray();

            for (var i = 0; i < Bases.Length; i++)
            {
                Vessel Base = Bases[i];
                if (Base.vesselType == VesselType.Base)
                {
                    if (Base.Landed && Base.landedAt != SpaceCenter.Instance.cb.GetName() &&
                        VesselHelper.HasEnergy(Base) &&
                        VesselHelper.GeneratesEnergy(Base) &&
                        VesselHelper.HasCommunication(Base))
                    {
                        ReturnVessels.Add(Base);
                    }
                }
            }

            return(ReturnVessels.ToArray());
        }
Exemple #19
0
        public static Vessel[] GetMiningRigs()
        {
            List <Vessel> ReturnVessels = new List <Vessel>();

            Vessel[] MiningRigs = VesselHelper.GetVesselsWithModules(new string[] {
                "ModuleDeployableSolarPanel",
                "ModuleDataTransmitter",
                "ModuleResourceHarvester"
            });

            for (var i = 0; i < MiningRigs.Length; i++)
            {
                Vessel MiningRig = MiningRigs [i];
                // Planetary science station

                if (MiningRig.Landed && MiningRig.landedAt != SpaceCenter.Instance.cb.GetName())
                {
                    ReturnVessels.Add(MiningRig);
                }
            }

            return(ReturnVessels.ToArray());
        }
        public static bool QualifiedStranded(ProtoCrewMember Kerb)
        {
            Vessel Vsl = GetVessel(Kerb);

            if (Vsl != null &&
                Vsl.protoVessel.vesselType != VesselType.Base &&
                Vsl.protoVessel.vesselType != VesselType.Rover &&
                Vsl.protoVessel.vesselType != VesselType.Station)
            {
                if (!VesselHelper.HasLiquidFuel(Vsl) || !VesselHelper.HasEnergy(Vsl))
                {
                    if (!VesselHelper.VesselHasModuleAlias(Vsl, "ScienceLab"))
                    {
                        if (!VesselHelper.VesselHasModuleAlias(Vsl, "Drill"))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
 public static bool HasEnergy(Vessel Vsl)
 {
     return(VesselHelper.HasResource(Vsl, "ElectricCharge"));
 }
 public static ProtoPartSnapshot[] GetDockingPorts(Vessel Vsl)
 {
     return(VesselHelper.GetPartsWithAlias(Vsl, "DockingPort"));
 }
 public static bool HasCommunication(Vessel Vsl)
 {
     return(VesselHelper.VesselHasModuleAlias(Vsl, "Communication"));
 }
Exemple #24
0
        public void draw(View Vw, ViewWindow Window, Review review)
        {
            Window.title = "Mining Rigs";

            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("StateFundingHubMiningView.draw, Inst is null");
                return;
            }

            string Description = "Below is a list of existing Mining Rigs. Having more Mining Rigs increases State " +
                                 "Confidence. To have a qualified Mining Rig is must have an antenna, drill, be able to generate power, " +
                                 "and be Landed on a body other than Kerbin.";

            ViewLabel DescriptionLabel = new ViewLabel(Description);

            DescriptionLabel.setRelativeTo(Window);
            DescriptionLabel.setLeft(140);
            DescriptionLabel.setTop(20);
            DescriptionLabel.setColor(Color.white);
            DescriptionLabel.setHeight(100);
            DescriptionLabel.setWidth(Window.getWidth() - 140);

            Vw.addComponent(DescriptionLabel);

            ViewLabel TotalCoverage = new ViewLabel("Mining Rigs: " + review.variables.miningRigs);

            TotalCoverage.setRelativeTo(Window);
            TotalCoverage.setLeft(140);
            TotalCoverage.setTop(130);
            TotalCoverage.setColor(Color.white);
            TotalCoverage.setHeight(30);
            TotalCoverage.setWidth(Window.getWidth() - 140);

            Vw.addComponent(TotalCoverage);

            ViewScroll RigsScroll = new ViewScroll();

            RigsScroll.setRelativeTo(Window);
            RigsScroll.setWidth(Window.getWidth() - 140);
            RigsScroll.setHeight(Window.getHeight() - 160);
            RigsScroll.setLeft(140);
            RigsScroll.setTop(150);

            Vw.addComponent(RigsScroll);

            Vessel[] MiningRigs = VesselHelper.GetMiningRigs();

            int labelHeight = 20;

            for (int i = 0; i < MiningRigs.Length; i++)
            {
                Vessel MiningRig = MiningRigs[i];

                string label = MiningRig.GetName() + " is Landed At " + MiningRig.mainBody.GetName();;

                ViewLabel MiningLabel = new ViewLabel(label);
                MiningLabel.setRelativeTo(RigsScroll);
                MiningLabel.setTop(labelHeight + (labelHeight + 5) * i);
                MiningLabel.setLeft(0);
                MiningLabel.setHeight(labelHeight);
                MiningLabel.setWidth(RigsScroll.getWidth() - 20);
                MiningLabel.setColor(Color.white);

                RigsScroll.Components.Add(MiningLabel);
            }
        }
Exemple #25
0
 private void UpdateScienceStations()
 {
     orbitalScienceStations   = VesselHelper.GetOrbitingScienceStations().Length;
     planetaryScienceStations = VesselHelper.GetLandedScienceStations().Length;
 }
Exemple #26
0
 private void UpdateMiningRigs()
 {
     miningRigs = VesselHelper.GetMiningRigs().Length;
 }
Exemple #27
0
        public void draw(View Vw, ViewWindow Window, Review review)
        {
            Window.title = "Science Stations";

            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("StateFundingHubLabView.draw, Inst is null");
                return;
            }

            string Description = "Below is a list of existing Science Sations. Having more Science Stations increases State " +
                                 "Confidence. Landed stations on other Celestial Bodies counts higher than Orbiting Stations. " +
                                 "To have a qualified Science Station you must have an antenna, a science lab, be able to generate " +
                                 "power, and have at least one Kerbal on board.";

            ViewLabel DescriptionLabel = new ViewLabel(Description);

            DescriptionLabel.setRelativeTo(Window);
            DescriptionLabel.setLeft(140);
            DescriptionLabel.setTop(20);
            DescriptionLabel.setColor(Color.white);
            DescriptionLabel.setHeight(100);
            DescriptionLabel.setWidth(Window.getWidth() - 140);

            Vw.addComponent(DescriptionLabel);

            ViewLabel TotalCoverage = new ViewLabel("Orbiting Stations: " + (int)review.variables.orbitalScienceStations + ". " +
                                                    "Landed Stations: " + (int)review.variables.planetaryScienceStations + ".");

            TotalCoverage.setRelativeTo(Window);
            TotalCoverage.setLeft(140);
            TotalCoverage.setTop(130);
            TotalCoverage.setColor(Color.white);
            TotalCoverage.setHeight(30);
            TotalCoverage.setWidth(Window.getWidth() - 140);

            Vw.addComponent(TotalCoverage);

            ViewScroll StationsScroll = new ViewScroll();

            StationsScroll.setRelativeTo(Window);
            StationsScroll.setWidth(Window.getWidth() - 140);
            StationsScroll.setHeight(Window.getHeight() - 160);
            StationsScroll.setLeft(140);
            StationsScroll.setTop(150);

            Vw.addComponent(StationsScroll);

            Vessel[] ScienceStations = VesselHelper.GetScienceStations();

            int labelHeight = 20;

            for (int i = 0; i < ScienceStations.Length; i++)
            {
                Vessel ScienceStation = ScienceStations[i];
                string action;
                string target;

                if (ScienceStation.Landed)
                {
                    action = "Landed At";
                    target = ScienceStation.mainBody.GetName();
                }
                else
                {
                    action = "Orbiting";
                    target = ScienceStation.GetOrbit().referenceBody.GetName();
                }

                string label = ScienceStation.GetName() + " is " + action + " " + target;

                ViewLabel StationLabel = new ViewLabel(label);
                StationLabel.setRelativeTo(StationsScroll);
                StationLabel.setTop(labelHeight + (labelHeight + 5) * i);
                StationLabel.setLeft(0);
                StationLabel.setHeight(labelHeight);
                StationLabel.setWidth(StationsScroll.getWidth() - 20);
                StationLabel.setColor(Color.white);

                StationsScroll.Components.Add(StationLabel);
            }
        }
 public static bool HasLiquidFuel(Vessel Vsl)
 {
     return(VesselHelper.HasResource(Vsl, "LiquidFuel"));
 }
        public void draw(View Vw, ViewWindow Window, Review review)
        {
            Window.title = "Rovers";

            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("StateFundingHubRoversView.draw, Inst is null");
                return;
            }

            string Description = "Below is a list of existing Rovers. Having more Rovers increases Public Opinion." +
                                 "Vessels that are rovers should be labeled as a Rover. They should have at least 4 wheels but can have more." +
                                 "If any wheels on the rover are broken they must be repaired. Rovers must has energy and be landed on a body other " +
                                 "than the home planet (Kerbin in most cases) to count.";

            ViewLabel DescriptionLabel = new ViewLabel(Description);

            DescriptionLabel.setRelativeTo(Window);
            DescriptionLabel.setLeft(140);
            DescriptionLabel.setTop(20);
            DescriptionLabel.setColor(Color.white);
            DescriptionLabel.setHeight(100);
            DescriptionLabel.setWidth(Window.getWidth() - 140);

            Vw.addComponent(DescriptionLabel);

            ViewLabel TotalRovers = new ViewLabel("Total Rovers: " + review.variables.rovers);

            TotalRovers.setRelativeTo(Window);
            TotalRovers.setLeft(140);
            TotalRovers.setTop(130);
            TotalRovers.setColor(Color.white);
            TotalRovers.setHeight(30);
            TotalRovers.setWidth(Window.getWidth() - 140);

            Vw.addComponent(TotalRovers);

            ViewScroll RoversScroll = new ViewScroll();

            RoversScroll.setRelativeTo(Window);
            RoversScroll.setWidth(Window.getWidth() - 140);
            RoversScroll.setHeight(Window.getHeight() - 160);
            RoversScroll.setLeft(140);
            RoversScroll.setTop(150);

            Vw.addComponent(RoversScroll);

            Vessel[] Rovers = VesselHelper.GetRovers();

            int labelHeight = 20;

            for (int i = 0; i < Rovers.Length; i++)
            {
                Vessel Rover = Rovers[i];
                //string target;

                string label = Rover.GetName() + " is Landed at " + Rover.mainBody.GetName();

                ViewLabel RoverLabel = new ViewLabel(label);
                RoverLabel.setRelativeTo(RoversScroll);
                RoverLabel.setTop(labelHeight + (labelHeight + 5) * i);
                RoverLabel.setLeft(0);
                RoverLabel.setHeight(labelHeight);
                RoverLabel.setWidth(RoversScroll.getWidth() - 20);
                RoverLabel.setColor(Color.white);

                RoversScroll.Components.Add(RoverLabel);
            }
        }
 public static bool GeneratesEnergy(Vessel Vsl)
 {
     return(VesselHelper.VesselHasModuleAlias(Vsl, "Energy"));
 }