コード例 #1
0
        private double ExecuteManufacturing(double deltaTime)
        {
            var resourceToProduce = _processedBlueprint.First(r => r.Processed < r.Units);
            var unitsToProduce    = Math.Min(resourceToProduce.Units - resourceToProduce.Processed, deltaTime * adjustedProductivity);

            if (part.protoModuleCrew.Count < MinimumCrew)
            {
                Status = "Not enough Crew to operate";
            }
            else if (_broker.AmountAvailable(part, UpkeepResource, TimeWarp.deltaTime, ResourceFlowMode.ALL_VESSEL) < TimeWarp.deltaTime)
            {
                Status = "Not enough " + UpkeepResource;
            }
            else
            {
                Status = "Recycling " + _processedItem.Part.title;
                _broker.RequestResource(part, UpkeepResource, UpkeepAmount, TimeWarp.deltaTime, ResourceFlowMode.ALL_VESSEL);
                _broker.StoreResource(part, resourceToProduce.Name, unitsToProduce, TimeWarp.deltaTime, ResourceFlowMode.ALL_VESSEL);
                resourceToProduce.Processed += unitsToProduce;
                progress = (float)(_processedBlueprint.GetProgress() * 100);
            }

            //Return time remaining
            return(deltaTime - unitsToProduce);
        }
コード例 #2
0
        public void AddResource(string resourceName, double amount)
        {
            var storage = _broker.StorageAvailable(
                _vessel.rootPart,
                resourceName,
                TimeWarp.fixedDeltaTime,
                ResourceFlowMode.ALL_VESSEL,
                1d);
            var amountToStore = Math.Min(storage, amount);

            _broker.StoreResource(
                _vessel.rootPart,
                resourceName,
                amountToStore,
                TimeWarp.fixedDeltaTime,
                ResourceFlowMode.ALL_VESSEL);
        }
コード例 #3
0
 private void SpawnExtraSupplies(float sup)
 {
     ResourceBroker.StoreResource(vessel.rootPart, "Supplies", sup, TimeWarp.deltaTime, ResourceFlowMode.ALL_VESSEL);
 }