Kerbalism icon indicating copy to clipboard operation
Kerbalism copied to clipboard

Crew bonus miscalculated for background processing of converters which don't use crew

Open gbesacier opened this issue 6 years ago • 0 comments

From my tests, it seems converters which don't use crew bonus are 80% slower during the background processing than during non-timewrap.

I think the problem is here: https://github.com/ShotgunNinja/Kerbalism/blob/df950e24872712f1ecc3be3545c4b74a913913b4/src/Background.cs#L239

Replace with:

        double exp_bonus = 1;
        // deduce crew bonus
        if (converter.UseSpecialistBonus)
        {
          int exp_level = -1;
          foreach(ProtoCrewMember c in Lib.CrewList(v))
          {
            if (c.experienceTrait.Effects.Find(k => k.Name == converter.ExperienceEffect) != null)
            {
              exp_level = Math.Max(exp_level, c.experienceLevel);
            }
          }
          exp_bonus = exp_level < 0
            ? converter.EfficiencyBonus * converter.SpecialistBonusBase
            : converter.EfficiencyBonus * (converter.SpecialistBonusBase + (converter.SpecialistEfficiencyFactor * (exp_level + 1)));
        }

exp_bonus is always 1 if the part does not use crew.

gbesacier avatar Apr 16 '18 21:04 gbesacier