Beispiel #1
0
        public override void Update()
        {
            Log.Info("Updating Bases");

            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("Review.UpdateBases, GameInstance is null");
                return;
            }

            Vessel[] _Bases = VesselHelper.GetBases();
            variables.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.mainBody.name;

                _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)((Base.mainBody.Radius / StateFundingGlobal.refRadius) * (_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.scModifier);
                }

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

                variables.Bases[i] = _BaseReport;
            }
        }
Beispiel #2
0
        public override void Update()
        {
            Log.Info("Updating Space Stations");

            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("Review.UpdateSpaceStations, GameInstance is null");
                return;
            }

            Vessel[] vessels = VesselHelper.GetSpaceStations();
            variables.SpaceStations = new SpaceStationReport[vessels.Length];

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

                SpaceStationReport SpcStationReport = new SpaceStationReport();
                SpcStationReport.name          = SpcStation.vesselName;
                SpcStationReport.crew          = VesselHelper.GetCrew(SpcStation).Length;
                SpcStationReport.crewCapacity  = VesselHelper.GetCrewCapactiy(SpcStation);
                SpcStationReport.dockedVessels = VesselHelper.GetDockedVesselsCount(SpcStation);
                SpcStationReport.dockingPorts  = VesselHelper.GetDockingPorts(SpcStation).Length;
                SpcStationReport.drill         = VesselHelper.VesselHasModuleAlias(SpcStation, "Drill");
                SpcStationReport.scienceLab    = VesselHelper.VesselHasModuleAlias(SpcStation, "ScienceLab");
                SpcStationReport.fuel          = VesselHelper.GetResourceCount(SpcStation, "LiquidFuel");
                SpcStationReport.ore           = VesselHelper.GetResourceCount(SpcStation, "Ore");
                SpcStationReport.onAsteroid    = VesselHelper.OnAsteroid(SpcStation);

                if (SpcStation.Landed)
                {
                    SpcStationReport.entity = SpcStation.landedAt;
                }
                else
                {
                    SpcStationReport.entity = SpcStation.GetOrbit().referenceBody.GetName();
                }

                SpcStationReport.po = 0;
                SpcStationReport.sc = 0;

                SpcStationReport.po += (int)(5 * SpcStationReport.crew * GameInstance.Gov.poModifier);
                SpcStationReport.po += (int)(5 * SpcStationReport.dockedVessels * GameInstance.Gov.poModifier);

                if (SpcStationReport.onAsteroid)
                {
                    SpcStationReport.po += (int)(30 * GameInstance.Gov.poModifier);

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

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

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

                variables.SpaceStations[i] = SpcStationReport;
            }
        }