public static void BackgroundUpdate(Vessel v, ProtoPartModuleSnapshot m, Harvester harvester, double elapsed_s)
 {
     if (Lib.Proto.GetBool(m, "deployed") && Lib.Proto.GetBool(m, "running") && Lib.Proto.GetString(m, "issue").Length == 0)
     {
         Resource_Recipe recipe = new Resource_Recipe();
         recipe.Input("ElectricCharge", harvester.ec_rate * elapsed_s);
         recipe.Output(harvester.resource, harvester.rate * elapsed_s, true);
         ResourceCache.Transform(v, recipe);
     }
 }
Exemple #2
0
		private static void ResourceUpdate(Vessel v, Harvester harvester, double min_abundance, double elapsed_s)
		{
			double abundance = SampleAbundance(v, harvester);
			if (abundance > min_abundance)
			{
				Resource_recipe recipe = new Resource_recipe();
				recipe.Input("ElectricCharge", harvester.ec_rate * elapsed_s);
				recipe.Output(harvester.resource, harvester.rate * (abundance/harvester.abundance_rate) * elapsed_s, false);
				ResourceCache.Transform(v, recipe);
			}
		}
Exemple #3
0
		private static void ResourceUpdate(Vessel v, ProtoPartModuleSnapshot m, Harvester harvester, double elapsed_s)
		{
			if (Lib.Proto.GetBool(m, "deployed") && Lib.Proto.GetBool(m, "running") && Lib.Proto.GetString(m, "issue").Length == 0)
			{
				double abundance = SampleAbundance(v, harvester);
				if (abundance > Lib.Proto.GetDouble(m, "min_abundance"))
				{
					resource_recipe recipe = new resource_recipe();
					recipe.Input("ElectricCharge", harvester.ec_rate * elapsed_s);
					recipe.Output(harvester.resource, harvester.rate * abundance * elapsed_s, true);
					ResourceCache.Transform(v, recipe);
				}
			}
		}
Exemple #4
0
        public void FixedUpdate()
        {
            if (Lib.IsEditor())
            {
                return;
            }

            if (deployed && running && !starved)
            {
                resource_recipe recipe = new resource_recipe(true);
                recipe.Input("ElectricCharge", ec_rate * Kerbalism.elapsed_s);
                recipe.Output(resource, rate * Kerbalism.elapsed_s);
                ResourceCache.Transform(vessel, recipe);
            }
        }
        public void FixedUpdate()
        {
            if (Lib.IsEditor())
            {
                return;
            }

            // TODO: Change review
            if (deployed && running && issue.Length == 0 && ResourceCache.Info(part.vessel, "ElectricCharge").amount > double.Epsilon)
            {
                Resource_Recipe recipe = new Resource_Recipe();
                recipe.Input("ElectricCharge", ec_rate * Kerbalism.elapsed_s);
                recipe.Output(resource, rate * Kerbalism.elapsed_s, true);
                ResourceCache.Transform(vessel, recipe);
            }
        }
        public void FixedUpdate()
        {
            if (Lib.IsEditor())
            {
                return;
            }

            if (ResourceCache.Info(vessel, "ElectricCharge").amount <= double.Epsilon && running)
            {
                Events["Toggle"].Invoke();
            }

            if (deployed && running && issue.Length == 0)
            {
                Resource_Recipe recipe = new Resource_Recipe();
                recipe.Input("ElectricCharge", ec_rate * Kerbalism.elapsed_s);
                recipe.Output(resource, rate * Kerbalism.elapsed_s, true);
                ResourceCache.Transform(vessel, recipe);
            }
        }
Exemple #7
0
		private static void ResourceUpdate(Vessel v, Harvester harvester, double min_abundance, double elapsed_s)
		{
			double abundance = SampleAbundance(v, harvester);
			if (abundance > min_abundance)
			{
				double rate = harvester.rate;

				// Bonus(..., -2): a level 0 engineer will alreaday add 2 bonus points jsut because he's there,
				// regardless of level. efficiency will raise further with higher levels.
				int bonus = engineer_cs.Bonus(v, -2);
				double crew_gain = 1 + bonus * Settings.HarvesterCrewLevelBonus;
				crew_gain = Lib.Clamp(crew_gain, 1, Settings.MaxHarvesterBonus);
				rate *= crew_gain;

				Resource_recipe recipe = new Resource_recipe(harvester.part);
				recipe.Input("ElectricCharge", harvester.ec_rate * elapsed_s);
				recipe.Output(harvester.resource, harvester.rate * (abundance/harvester.abundance_rate) * elapsed_s, false);
				ResourceCache.Transform(v, recipe);
			}
		}