public static Vessel[] GetSpaceStations() { List <Vessel> ReturnVessels = new List <Vessel>(); Vessel[] SpaceStations = (Vessel[])FlightGlobals.Vessels.ToArray(); for (var i = 0; i < SpaceStations.Length; i++) { Vessel SpaceStation = SpaceStations[i]; if (SpaceStation.vesselType == VesselType.Station) { /** * Make sure it's not landed. If it is landed check to see if it's a celestial body- * If it's not, then you landed on an asteroid. good job! */ if (!SpaceStation.Landed || !BodyHelper.ACelestialBody(SpaceStation.landedAt)) { ReturnVessels.Add(SpaceStation); } } } return(ReturnVessels.ToArray()); }
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; } }