/// <summary> /// Currently modifies the def's decription. /// </summary> public void ModifyNewDef(ResearchProjectDef def) { //Remove old number int i = def.description.Length; for (; i >= 0; i--) { var character = def.description[i - 1]; if (!int.TryParse(character.ToString(), out int f)) { break; } } if (i != def.description.Length) { def.description = def.description.Remove(i); } //Add new number def.description += researchedFactor[def].ToString(); //Resolve cost def.GetModExtension <ModExtension_ResearchScaleable>().ResolveCost(ref def, researchedFactor[def]); }
public static bool Prefix(ref bool __result, ResearchProjectDef __instance) { if (__instance.HasModExtension <CompleteTechLevelPrereq>()) { //Log.Message("Technology Blueprints :: PrerequisitesCompleted HasModExtension " + __instance); List <ResearchProjectDef> unfinishedProjects = DefDatabase <ResearchProjectDef> .AllDefsListForReading .FindAll((ResearchProjectDef x) => x.techLevel == __instance.GetModExtension <CompleteTechLevelPrereq>().techLevel && !x.HasModExtension <CompleteTechLevelPrereq>() && !x.IsFinished); if (unfinishedProjects.NullOrEmpty()) { __result = true; return(false); } else { //Log.Message("Technology Blueprints :: unfinished techs = " + unfinishedProjects.Join(null, ", ")); __result = false; return(false); } } return(true); }