private void onEditorShipModified(ShipConstruct shipConstruct) { vesselSafetyRating = 5; for (int i = 0; i < shipConstruct.parts.Count(); i++) { Part p = shipConstruct.parts.ElementAt(i); List <BaseFailureModule> bfmList = p.FindModulesImplementing <BaseFailureModule>(); for (int b = 0; b < bfmList.Count(); b++) { BaseFailureModule bfm = bfmList.ElementAt(b); if (bfm == null) { continue; } if (bfm.safetyRating < vesselSafetyRating) { vesselSafetyRating = bfm.safetyRating; worstPart = p; } } } }
bool Repaired() { List <BaseFailureModule> failedList = part.FindModulesImplementing <BaseFailureModule>(); if (failedList.Count() == 0) { return(true); } for (int i = 0; i < failedList.Count(); i++) { BaseFailureModule bfm = failedList.ElementAt(i); if (bfm == null) { continue; } if (!bfm.hasFailed) { continue; } repair = bfm; return(false); } return(true); }