private double KerbalContribution(ProtoCrewMember crew) { string expstr = KerbalExt.Get(crew, "experience:task=Workshop"); float experience = 0; if (expstr != null) { float.TryParse(expstr, out experience); } double contribution; if (crew.isBadass) { contribution = Baddass(crew.stupidity, crew.courage, experience); } else { contribution = Normal(crew.stupidity, crew.courage, experience); } bool hasConstructionSkill = crew.GetEffect <ELConstructionSkill> () != null; if (!hasConstructionSkill) { if (!enableUnskilled) { // can't work here, but may not know to keep out of the way. contribution = Math.Min(contribution, 0); } if (crew.experienceLevel >= 3) { // can resist "ooh, what does this button do?" contribution = Math.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.LogFormat ("[EL Workshop] Kerbal: " + "{0} s:{1} c:{2} b:{3} e:{4}({5}) c:{6} hs:{7} l:{8} es:{9} si:{10}", + crew.name, crew.stupidity, crew.courage, + crew.isBadass, experience, expstr, + contribution, hasConstructionSkill, + crew.experienceLevel, + enableSkilled, SupportInexperienced); */ return(contribution); }
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); }