public void ExtractResource(string ResourceName, RPLocation location, double amount)
 {
     var cell = GetCellUnder.Invoke (null, new object[] { location.body, location.location});
     var kd = KDCurrent.GetValue (null, null);
     var rd = KDIndexer.GetValue (kd, new object[] {ResourceName});
     var brd = RDIndexer.GetValue (rd, new object[] {location.body});
     var bodyResources = BRDResources.GetValue (brd, null);
     Extract = bodyResources.GetType().GetMethod ("Extract");
     Extract.Invoke (bodyResources, new object[] {cell, amount});
 }
 public void ExtractResource(string ResourceName, RPLocation location, double amount)
 {
     //			if (CausesDepletion) {
     //				float factor = (float)Math.Min(1, result.TimeFactor / deltaTime);
     //				Vector2 depletionNode = ResourceMap.Instance.GetDepletionNode(location.latitude, location.longitude);
     //				float depletionNodeValue = ResourceMap.Instance.GetDepletionNodeValue(location.bodyIndex, ResourceName, (int)depletionNode.x, (int)depletionNode.y);
     //				float depletionAmount = DepletionRate * factor;
     //				float value = depletionNodeValue - depletionNodeValue * depletionAmount;
     //				ResourceMap.Instance.SetDepletionNodeValue(location.bodyIndex, ResourceName, (int)depletionNode.x, (int)depletionNode.y, value);
     //			}
 }
        public void ExtractResource(string ResourceName, RPLocation location, double amount)
        {
//			if (CausesDepletion) {
//				float factor = (float)Math.Min(1, result.TimeFactor / deltaTime);
//				Vector2 depletionNode = ResourceMap.Instance.GetDepletionNode(location.latitude, location.longitude);
//				float depletionNodeValue = ResourceMap.Instance.GetDepletionNodeValue(location.bodyIndex, ResourceName, (int)depletionNode.x, (int)depletionNode.y);
//				float depletionAmount = DepletionRate * factor;
//				float value = depletionNodeValue - depletionNodeValue * depletionAmount;
//				ResourceMap.Instance.SetDepletionNodeValue(location.bodyIndex, ResourceName, (int)depletionNode.x, (int)depletionNode.y, value);
//			}
        }
        public void ExtractResource(string ResourceName, RPLocation location, double amount)
        {
            var cell          = GetCellUnder.Invoke(null, new object[] { location.body, location.location });
            var kd            = KDCurrent.GetValue(null, null);
            var rd            = KDIndexer.GetValue(kd, new object[] { ResourceName });
            var brd           = RDIndexer.GetValue(rd, new object[] { location.body });
            var bodyResources = BRDResources.GetValue(brd, null);

            Extract = bodyResources.GetType().GetMethod("Extract");
            Extract.Invoke(bodyResources, new object[] { cell, amount });
        }
 public double GetAmount(string ResourceName, RPLocation location, double rate)
 {
     AbundanceRequest request = new AbundanceRequest {
         Altitude = location.altitude,
         BodyId = location.bodyIndex,
         CheckForLock = false,
         Latitude = location.latitude,
         Longitude = location.longitude,
         ResourceType = 0,
         ResourceName = ResourceName
     };
     return ResourceMap.Instance.GetAbundance(request) * rate;
 }
 public double GetAmount(string ResourceName, RPLocation location, double rate)
 {
     var cell = GetCellUnder.Invoke (null, new object[] { location.body, location.location});
     var kd = KDCurrent.GetValue (null, null);
     var rd = KDIndexer.GetValue (kd, new object[] {ResourceName});
     var brd = RDIndexer.GetValue (rd, new object[] {location.body});
     var bodyResources = BRDResources.GetValue (brd, null);
     GetQuantity = bodyResources.GetType().GetMethod ("GetQuantity");
     var deposit = (double?) GetQuantity.Invoke (bodyResources, new object[] {cell});
     if (deposit == null) {
         return 0;
     }
     return (float) Math.Min(rate, deposit.Value);
 }
        public double GetAmount(string ResourceName, RPLocation location, double rate)
        {
            AbundanceRequest request = new AbundanceRequest {
                Altitude     = location.altitude,
                BodyId       = location.bodyIndex,
                CheckForLock = false,
                Latitude     = location.latitude,
                Longitude    = location.longitude,
                ResourceType = 0,
                ResourceName = ResourceName
            };

            return(ResourceMap.Instance.GetAbundance(request) * rate);
        }
        public double GetAmount(string ResourceName, RPLocation location, double rate)
        {
            var cell          = GetCellUnder.Invoke(null, new object[] { location.body, location.location });
            var kd            = KDCurrent.GetValue(null, null);
            var rd            = KDIndexer.GetValue(kd, new object[] { ResourceName });
            var brd           = RDIndexer.GetValue(rd, new object[] { location.body });
            var bodyResources = BRDResources.GetValue(brd, null);

            GetQuantity = bodyResources.GetType().GetMethod("GetQuantity");
            var deposit = (double?)GetQuantity.Invoke(bodyResources, new object[] { cell });

            if (deposit == null)
            {
                return(0);
            }
            return((float)Math.Min(rate, deposit.Value));
        }
        protected override ConversionRecipe PrepareRecipe(double deltaTime)
        {
            RaycastHit hit;

            if (!raycastGround(out hit))
            {
                status = "no ground contact";
                return(null);
            }
            location = new RPLocation(vessel.mainBody, hit.point);
            double amount = 0;

            for (int i = 0; i < resource_providers.Count; i++)
            {
                resource_amounts[i] = resource_providers[i].GetAmount(ResourceName, location, Rate);
                amount += resource_amounts[i];
            }
            if (amount > Rate)
            {
                for (int i = 0; i < resource_providers.Count; i++)
                {
                    resource_amounts[i] = (resource_amounts[i] * Rate) / amount;
                }
                amount = Rate;
            }
            if (amount < 1e-6f)
            {
                status      = "insufficient abundance";
                IsActivated = false;
                return(null);
            }
            if (!IsActivated)
            {
                status = "Inactive";
                return(null);
            }
            rate = amount * Efficiency;
            return(LoadRecipe(rate));
        }
예제 #10
0
        protected override ConversionRecipe PrepareRecipe(double deltaTime)
        {
            RaycastHit hit;

            if (!raycastGround (out hit)) {
                status = "no ground contact";
                return null;
            }
            location = new RPLocation (vessel.mainBody, hit.point);
            double amount = 0;
            for (int i = 0; i < resource_providers.Count; i++) {
                resource_amounts[i] = resource_providers[i].GetAmount (ResourceName, location, Rate);
                amount += resource_amounts[i];
            }
            if (amount > Rate) {
                for (int i = 0; i < resource_providers.Count; i++) {
                    resource_amounts[i] = (resource_amounts[i] * Rate) / amount;
                }
                amount = Rate;
            }
            if (amount < 1e-6f) {
                status = "insufficient abundance";
                IsActivated = false;
                return null;
            }
            if (!IsActivated) {
                status = "Inactive";
                return null;
            }
            rate = amount * Efficiency * HeatThrottle;
            return LoadRecipe(rate);
        }