コード例 #1
0
 private void UpdateStatus(VesselSupplyStatus v)
 {
     v.RecyclerMultiplier  = (float)LifeSupportManager.GetRecyclerMultiplier(vessel);
     v.ExtraHabSpace       = (float)LifeSupportManager.CalculateVesselHabExtraTime(vessel);
     v.VesselHabMultiplier = (float)LifeSupportManager.CalculateVesselHabMultiplier(vessel, _currentCrew);
     LifeSupportManager.Instance.TrackVessel(v);
 }
コード例 #2
0
        private void UpdateStatus(VesselSupplyStatus supplyStatus)
        {
            var now = Planetarium.GetUniversalTime();

            if (_lastUpdate < ResourceUtilities.FLOAT_TOLERANCE)
            {
                _lastUpdate = now;
            }

            // Give converters time to catch up before we start using calculated values
            bool fullRefresh = false;

            if (now > _lastUpdate + 5d)
            {
                fullRefresh = true;
                _lastUpdate = now;
            }

            var calcRecyclerMultiplier = (float)LifeSupportManager.GetRecyclerMultiplier(vessel);
            var calcHabTime            = (float)LifeSupportManager.CalculateVesselHabExtraTime(vessel);
            var calcHabMultiplier      = (float)LifeSupportManager.CalculateVesselHabMultiplier(vessel, _currentCrewCount);

            // If we're the active vessel, and we're past easing, use calculated values.
            //  Otherwise, use the cache.
            var useCalculated = fullRefresh && vessel.id == FlightGlobals.ActiveVessel.id;

            //Start with intelligent defaults.
            if (supplyStatus.RecyclerMultiplier < ResourceUtilities.FLOAT_TOLERANCE)
            {
                supplyStatus.RecyclerMultiplier = 1f;
            }
            if (calcRecyclerMultiplier < ResourceUtilities.FLOAT_TOLERANCE)
            {
                calcRecyclerMultiplier = 1f;
            }

            //And take the lowest (non-zero)
            if (useCalculated || calcRecyclerMultiplier < supplyStatus.RecyclerMultiplier)
            {
                supplyStatus.RecyclerMultiplier = calcRecyclerMultiplier;
            }

            //Hab we want the best ones.
            if (useCalculated || calcHabTime > supplyStatus.ExtraHabSpace)
            {
                supplyStatus.ExtraHabSpace = calcHabTime;
            }

            if (useCalculated || calcHabMultiplier > supplyStatus.VesselHabMultiplier)
            {
                supplyStatus.VesselHabMultiplier = calcHabMultiplier;
            }

            LifeSupportManager.Instance.TrackVessel(supplyStatus);
        }
コード例 #3
0
        private void UpdateStatus(VesselSupplyStatus v)
        {
            if (_lastUpdate < ResourceUtilities.FLOAT_TOLERANCE)
            {
                _lastUpdate = Planetarium.GetUniversalTime();
            }

            bool fullRefresh = false;

            if (Planetarium.GetUniversalTime() > _lastUpdate + 5d) //A reasonable time for easing in everything
            {
                fullRefresh = true;
                _lastUpdate = Planetarium.GetUniversalTime();
            }

            var newRecMult = (float)LifeSupportManager.GetRecyclerMultiplier(vessel);
            var newSpace   = (float)LifeSupportManager.CalculateVesselHabExtraTime(vessel);
            var newHabMult = (float)LifeSupportManager.CalculateVesselHabMultiplier(vessel, _currentCrew);
            //If we're the active vessel, and we're past easing, we always take calc values.
            //Otherwise, let's use the cache.
            var useCur = fullRefresh && vessel.id == FlightGlobals.ActiveVessel.id;

            //Start with intelligent defaults.
            if (v.RecyclerMultiplier < ResourceUtilities.FLOAT_TOLERANCE)
            {
                v.RecyclerMultiplier = 1f;
            }
            if (newRecMult < ResourceUtilities.FLOAT_TOLERANCE)
            {
                newRecMult = 1f;
            }
            //And take the lowest (non-zero)
            if (useCur || newRecMult < v.RecyclerMultiplier)
            {
                v.RecyclerMultiplier = newRecMult;
            }

            //Hab we want the best ones.
            if (useCur || newSpace > v.ExtraHabSpace)
            {
                v.ExtraHabSpace = newSpace;
            }

            if (useCur || newHabMult > v.VesselHabMultiplier)
            {
                v.VesselHabMultiplier = newHabMult;
            }

            LifeSupportManager.Instance.TrackVessel(v);
        }