protected override void PreProcessing() { float curTime; if (IsActivated && (curTime = UnityEngine.Time.realtimeSinceStartup) - lastCheck > 0.1) { lastCheck = curTime; if (!checkTrait()) { StopResourceConverter(); this.status = "Inactive; no " + requiredTrait; } else if (StationExperiment.checkBoring(vessel, false)) { StopResourceConverter(); this.status = "Inactive; on Kerbin"; } else { int nsci = 0; int nstars = 0; foreach (var crew in part.protoModuleCrew) { if (crew.experienceTrait.TypeName == requiredTrait) { nsci += 1; nstars += crew.experienceLevel; } } SetEfficiencyBonus((float)Math.Max(nsci + nstars * experienceBonus, 1.0)); } } base.PreProcessing(); }
protected override void PreProcessing() { float curTime; if (IsActivated && (curTime = UnityEngine.Time.realtimeSinceStartup) - lastCheck > 0.1) { lastCheck = curTime; if (!checkTrait()) { StopResourceConverter(); this.status = "Inactive; no " + requiredTrait; } else if (StationExperiment.checkBoring(vessel, false)) { StopResourceConverter(); this.status = "Inactive; on Kerbin"; } else { } } base.PreProcessing(); }
protected override void PreProcessing() { float curTime; if (IsActivated && (curTime = UnityEngine.Time.realtimeSinceStartup) - lastCheck > 0.1) { lastCheck = curTime; if (!CheckSkill()) { StopResourceConverter(); this.status = "Inactive; no " + requiredSkills; } else if (StationExperiment.CheckBoring(vessel, false)) { StopResourceConverter(); this.status = "Inactive; on home planet"; } else { int nsci = 0; int nstars = 0; foreach (var crew in part.protoModuleCrew) { foreach (String skill in skills) { if (crew.HasEffect(skill)) { nsci += 1; nstars += crew.experienceLevel; } } } SetEfficiencyBonus((float)Math.Max(nsci + nstars * experienceBonus, 1.0)); } } base.PreProcessing(); }
private void updateStatus() { updateLights(); #if false bool animActive = false; if (!doResearch) { displayStatusMessage("Paused"); } else if (minimumCrew > 0 && part.protoModuleCrew.Count < minimumCrew) { displayStatusMessage("Understaffed (" + part.protoModuleCrew.Count + "/" + minimumCrew + ")"); } else if (StationExperiment.checkBoring(vessel, false)) { displayStatusMessage("Go to space!"); } else { Fields["researchStatus"].guiActive = false; foreach (ResearchGenerator generator in generators) { generator.updateStatus(); animActive = animActive || (generator.last_time_step != 0); } /* * eurekasStatus = ""; * var r = getOrDefault(EurekasGenerator.rates,"Eurekas"); * if (r != null) * { * if (r.last_available == 0) * eurekasStatus = "No Experiments"; * else * { * eurekasStatus = String.Format("{0:F2} per hour", -r.ratePerHour * r.rateMultiplier); * animActive = true; * } * } * Fields["eurekasStatus"].guiName = "Eurekas"; * Fields["eurekasStatus"].guiActive = (eurekasStatus != ""); * * kuarqStatus = ""; * var qr = getOrDefault(KuarqGenerator.rates, "Kuarqs"); * var cr = getOrDefault(KuarqGenerator.rates, "ElectricCharge"); * if (qr != null) * { * if (qr.last_available == 0) * kuarqStatus = "No Experiments"; * else if (cr != null && cr.last_available < 0.000001) * kuarqStatus = "Not Enough Charge"; * else if (qr.last_produced != 0) * { * animActive = true; * kuarqStatus = String.Format("{0:F2} per second", -qr.ratePerSecond * qr.rateMultiplier); * } * } * Fields["kuarqStatus"].guiActive = (kuarqStatus != ""); * * bioproductsStatus = ""; * var br = getOrDefault(BioproductsGenerator.rates,"Bioproducts"); * var kr = getOrDefault(BioproductsGenerator.rates,"Kibbal"); * if (br != null) * { * if (br.last_available == 0) * bioproductsStatus = "No Experiments"; * else if (kr != null && kr.last_available == 0) * bioproductsStatus = "Not Enough Kibbal"; * else if (br.last_produced != 0) * { * animActive = true; * bioproductsStatus = String.Format("{0:F2} per hour", -br.ratePerHour * br.rateMultiplier); * } * } * Fields["bioproductsStatus"].guiActive = (bioproductsStatus != ""); * * scienceStatus = ""; * var sr = getOrDefault(ScienceGenerator.rates,"__SCIENCE__zoologyBay"); * var skr = getOrDefault(ScienceGenerator.rates,"Kibbal"); * if (skr != null && skr.last_available == 0) * scienceStatus = "Hibernating"; * else if(sr != null && sr.last_produced != 0) * scienceStatus = String.Format("{0:F2} per day", -sr.ratePerDay * sr.rateMultiplier); * Fields["scienceStatus"].guiActive = (scienceStatus != ""); * * kibbalStatus = ""; * double total_produced = 0, total_rate = 0; * if (kr != null && kr.last_produced != 0) * { * total_produced += kr.last_produced; total_rate += kr.ratePerDay * kr.rateMultiplier; * } * if (skr != null && skr.last_produced != 0) * { * total_produced += skr.last_produced; total_rate += skr.ratePerDay * skr.rateMultiplier; * } * if (total_produced != 0) * kibbalStatus = String.Format("{0:F2} per day", total_rate); * Fields["kibbalStatus"].guiActive = (kibbalStatus != ""); */ } if (animator != null) { if (lightsMode == 2) { animActive = true; } if (lightsMode == 0) { animActive = false; } if (animActive && animator.Progress == 0 && animator.status.StartsWith("Locked", true, null)) { animator.allowManualControl = true; animator.Toggle(); animator.allowManualControl = false; } else if (!animActive && animator.Progress == 1 && animator.status.StartsWith("Locked", true, null)) { animator.allowManualControl = true; animator.Toggle(); animator.allowManualControl = false; } } #endif }