예제 #1
0
        public bool UpdateBoosterCount(int boosterCount)
        {
            if (boosterCount > MaxBoosters)
            {
                return(false);
            }

            if (lastKnownBioBooster == boosterCount)
            {
                return(false);
            }

            var nextStats = ReactorStats.GetStatsForBoosterCount(boosterCount);

            Battery._capacity = nextStats.Capacity;

            if (!isLoadingSaveData)
            {
                Battery._charge = Mathf.Min(Battery._charge, Battery._capacity);

                if (lastKnownBioBooster > boosterCount) // Getting smaller
                {
                    int nextAvailableSpace = nextStats.TotalSpaces;
                    while (this.MaterialsProcessing.SpacesOccupied > nextAvailableSpace)
                    {
                        BioEnergy material = this.MaterialsProcessing.GetCandidateForRemoval();

                        if (material == null)
                        {
                            break;
                        }

                        QuickLogger.Debug($"Removing material of size {material.Size}", true);
                        this.MaterialsProcessing.Remove(material, Container);
                    }
                }
            }

            Container.Resize(this.StorageWidth = nextStats.Width, this.StorageHeight = nextStats.Height);
            Container.Sort();

            ChargePerSecondPerItem = baselineChargeRate / this.TotalContainerSpaces * 2;

            lastKnownBioBooster = boosterCount;

            return(true);
        }
예제 #2
0
        public bool HasRoomToShrink()
        {
            var nextStats = ReactorStats.GetStatsForBoosterCount(lastKnownBioBooster - 1);

            return(nextStats.TotalSpaces >= this.MaterialsProcessing.SpacesOccupied);
        }