Beispiel #1
0
 protected double getFuelAvailability(ReactorFuel fuel)
 {
     if (!consumeGlobal)
     {
         if (part.Resources.Contains(fuel.FuelName))
         {
             return(part.Resources[fuel.FuelName].amount);
         }
         else
         {
             return(0);
         }
     }
     return(part.GetConnectedResources(fuel.FuelName).Sum(rs => rs.amount));
 }
 protected override double consumeReactorFuel(ReactorFuel fuel, double consume_amount)
 {
     if (!consumeGlobal)
     {
         if (part.Resources.Contains(fuel.FuelName) && part.Resources.Contains(InterstellarResourcesConfiguration.Instance.DepletedFuel))
         {
             double amount = Math.Min(consume_amount, part.Resources[fuel.FuelName].amount / FuelEfficiency);
             part.Resources[fuel.FuelName].amount -= amount;
             part.Resources[InterstellarResourcesConfiguration.Instance.DepletedFuel].amount += amount;
             return amount;
         } else return 0;
     } else
     {
         return part.ImprovedRequestResource(fuel.FuelName, consume_amount / FuelEfficiency);
     }
 }
Beispiel #3
0
 protected virtual double consumeReactorFuel(ReactorFuel fuel, double consume_amount)
 {
     if (!consumeGlobal)
     {
         if (part.Resources.Contains(fuel.FuelName))
         {
             double amount = Math.Min(consume_amount, part.Resources[fuel.FuelName].amount / FuelEfficiency);
             part.Resources[fuel.FuelName].amount -= amount;
             return(amount);
         }
         else
         {
             return(0);
         }
     }
     return(part.ImprovedRequestResource(fuel.FuelName, consume_amount / FuelEfficiency));
 }
Beispiel #4
0
 protected override double consumeReactorFuel(ReactorFuel fuel, double consume_amount)
 {
     if (!consumeGlobal)
     {
         if (part.Resources.Contains(fuel.FuelName) && part.Resources.Contains(InterstellarResourcesConfiguration.Instance.DepletedFuel))
         {
             double amount = Math.Min(consume_amount, part.Resources[fuel.FuelName].amount / FuelEfficiency);
             part.Resources[fuel.FuelName].amount -= amount;
             part.Resources[InterstellarResourcesConfiguration.Instance.DepletedFuel].amount += amount;
             return(amount);
         }
         else
         {
             return(0);
         }
     }
     else
     {
         return(part.ImprovedRequestResource(fuel.FuelName, consume_amount / FuelEfficiency));
     }
 }
        protected double GetFuelRatio(ReactorFuel reactorFuel, double fuelEfficency, double megajoules)
        {
            var fuelUseForPower = reactorFuel.GetFuelUseForPower(fuelEfficency, megajoules, fuelUsePerMJMult);

            return GetFuelAvailability(reactorFuel) / fuelUseForPower;
        }
        protected double GetFuelAvailability(ReactorFuel fuel)
        {
            if (fuel == null)
                UnityEngine.Debug.LogError("[KSPI] - GetFuelAvailability fuel null");

            if (!fuel.ConsumeGlobal)
            {
                if (part.Resources.Contains(fuel.FuelName))
                    return part.Resources[fuel.FuelName].amount;
                else
                    return 0;
            }

            if (HighLogic.LoadedSceneIsFlight)
                return part.GetConnectedResources(fuel.FuelName).Sum(rs => rs.amount);
            else
                return part.FindAmountOfAvailableFuel(fuel.FuelName, 4);
        }
 protected virtual double ConsumeReactorFuel(ReactorFuel fuel, double consume_amount)
 {
     if (!fuel.ConsumeGlobal)
     {
         if (part.Resources.Contains(fuel.FuelName))
         {
             double amount = Math.Min(consume_amount / FuelEfficiency, part.Resources[fuel.FuelName].amount);
             part.Resources[fuel.FuelName].amount -= amount;
             return amount;
         }
         else
             return 0;
     }
     return part.RequestResource(fuel.FuelName, consume_amount / FuelEfficiency);
 }
        protected override double consumeReactorFuel(ReactorFuel fuel, double consume_amount)
        {
                if (!consumeGlobal)
                {
                    if (part.Resources.Contains(fuel.FuelName) && part.Resources.Contains(InterstellarResourcesConfiguration.Instance.Actinides))
                    {

                        var partResourceFuel = part.Resources[fuel.FuelName];
                        var partResourceAnticides = part.Resources[InterstellarResourcesConfiguration.Instance.Actinides];
                        var resourceDefinition = PartResourceLibrary.Instance.GetDefinition(fuel.FuelName);

                        double amount = Math.Min(consume_amount, partResourceFuel.amount / FuelEfficiency);
                        partResourceFuel.amount -= amount;
                        partResourceAnticides.amount += amount;

                        if (resourceDefinition != null)
                        {
                            remainingFuel = (resourceDefinition.density * partResourceFuel.amount * 1000).ToString("0.0000000") + " kg";
                            Fields["remainingFuel"].guiName = fuel.FuelName;
                        }

                        if (resourceDefinitionActinides == null)
                            UnityEngine.Debug.LogWarning("[KSPI] - InterstellarFissionMSRGC.consumeReactorFuel.resourceDefinitionActinides is null");

                        actinidesBuildup = (partResourceAnticides.amount * resourceDefinitionActinides.density * 1000).ToString("0.0000000") + " kg";

                        return amount;
                    }
                    else return 0;
                }
                else
                    return part.ImprovedRequestResource(fuel.FuelName, consume_amount / FuelEfficiency);

        }
 protected double getFuelAvailability(ReactorFuel fuel) 
 {
     if (!consumeGlobal) 
     {
         if (part.Resources.Contains(fuel.FuelName)) return part.Resources[fuel.FuelName].amount;
         else return 0;
     } 
     return part.GetConnectedResources(fuel.FuelName).Sum(rs => rs.amount);
 }