public DIYKit.Requirements RemainingRequirements()
 {
     if (!remainder)
     {
         if (remainder == null)
         {
             remainder = new DIYKit.Requirements();
         }
         var njobs = Jobs.Count;
         if (njobs > 0 && CurrentIndex >= 0 && CurrentIndex < njobs)
         {
             for (int i = CurrentIndex; i < njobs; i++)
             {
                 remainder.Update(Jobs[i].RemainingRequirements());
             }
         }
     }
     return(remainder);
 }
        public DIYKit.Requirements RequirementsForWork(double work)
        {
            var req = new DIYKit.Requirements();

            if (work > 0 && Jobs.Count > 0)
            {
                var njobs = Jobs.Count;
                if (CurrentIndex < njobs)
                {
                    for (int i = CurrentIndex; i < njobs; i++)
                    {
                        req.Update(Jobs[i].RequirementsForWork(work - req.work));
                        if (work <= req.work)
                        {
                            break;
                        }
                    }
                }
            }
            return(req);
        }
Exemple #3
0
 public void GetRecycleInfo(
     Part p,
     float efficiency,
     out DIYKit.Requirements assembly_requirements,
     out DIYKit.Requirements construction_requirements
     )
 {
     PartKit.GetRequirements(p, out assembly_requirements, out construction_requirements);
     if (assembly_requirements)
     {
         assembly_requirements.resource_amount *=
             assembly_requirements.resource.MaxRecycleRatio * efficiency;
         assembly_requirements.energy *= GLB.RecycleEnergyRatio;
     }
     if (construction_requirements)
     {
         construction_requirements.resource_amount *=
             construction_requirements.resource.MaxRecycleRatio * efficiency;
         construction_requirements.energy *= GLB.RecycleEnergyRatio;
     }
 }
Exemple #4
0
 private static string format_resource(DIYKit.Requirements req) =>
 req.Valid
         ? $"{req.resource.name}: {FormatUtils.formatBigValue((float)req.resource_amount, " u")}"
         : "";