private void DetermineProductivity() { float kh = 0; enableSkilled = false; enableUnskilled = false; var crewList = EL_Utils.GetCrewList(part); if (useSkill) { foreach (var crew in crewList) { if (EL_Utils.HasSkill <ExConstructionSkill> (crew)) { if (crew.experienceLevel >= 4) { enableSkilled = true; } if (crew.experienceLevel >= 5) { enableUnskilled = true; } } } } foreach (var crew in crewList) { kh += KerbalContribution(crew, crew.stupidity, crew.courage, crew.isBadass); } Productivity = kh * ProductivityFactor; }
void DetermineRange() { var crewList = EL_Utils.GetCrewList(part); int bestLevel = -2; foreach (var crew in crewList) { int level = -1; if (EL_Utils.HasSkill <ExSurveySkill> (crew)) { level = crew.experienceLevel; } if (level > bestLevel) { bestLevel = level; } } if (bestLevel > 5) { bestLevel = 5; } range = site_ranges[bestLevel + 2]; if (canBuild) { StartCoroutine(WaitAndFindSites()); } }
private float KerbalContribution(ProtoCrewMember crew, float stupidity, float courage, bool isBadass) { string expstr = KerbalExt.Get(crew, "experience:task=Workshop"); float experience = 0; if (expstr != null) { float.TryParse(expstr, out experience); } float contribution; if (isBadass) { contribution = Baddass(stupidity, courage, experience); } else { contribution = Normal(stupidity, courage, experience); } if (useSkill) { if (!EL_Utils.HasSkill <ExConstructionSkill> (crew)) { if (!enableUnskilled) { // can't work here, but may not know to keep out of the way. contribution = Mathf.Min(contribution, 0); } if (crew.experienceLevel >= 3) { // can resist "ooh, what does this button do?" contribution = Mathf.Max(contribution, 0); } } else { switch (crew.experienceLevel) { case 0: if (!enableSkilled && !SupportInexperienced) { // can't work here, but knows to keep out of the way. contribution = 0; } break; case 1: break; case 2: if (SupportInexperienced) { // He's learned the ropes. contribution = HyperCurve(contribution); } break; default: // He's learned the ropes very well. contribution = HyperCurve(contribution); break; } } } Debug.Log(String.Format("[EL Workshop] Kerbal: " + "{0} {1} {2} {3} {4}({5}) {6} {7} {8} {9} {10}", crew.name, stupidity, courage, isBadass, experience, expstr, contribution, EL_Utils.HasSkill <ExConstructionSkill> (crew), crew.experienceLevel, enableSkilled, SupportInexperienced)); return(contribution); }