public static void MakeDictionaries() { thingDic = new Dictionary <ThingDef, ResearchProjectDef>(); researchDic = new Dictionary <ResearchProjectDef, List <ThingDef> >(); foreach (RecipeDef recipe in DefDatabase <RecipeDef> .AllDefsListForReading) { ResearchProjectDef rpd = GetBestRPDForRecipe(recipe); if (rpd != null && recipe.ProducedThingDef != null) { ThingDef producedThing = recipe.ProducedThingDef; CompProperties_DArcane comp = producedThing.GetCompProperties <CompProperties_DArcane>(); if (comp == null) { producedThing.comps.Add(new CompProperties_DArcane(rpd)); } thingDic.SetOrAdd(producedThing, rpd); List <ThingDef> things; if (researchDic.TryGetValue(rpd, out things)) { things.Add(producedThing); } else { researchDic.Add(rpd, new List <ThingDef> { producedThing }); } } } GearAssigner.HardAssign(ref thingDic, ref researchDic); GearAssigner.OverrideAssign(ref thingDic, ref researchDic); }
public static bool Locked(ResearchProjectDef rpd) { if (rpd != null && DefDatabase <ResearchProjectDef> .AllDefs.Contains(rpd) && !GearAssigner.ProjectIsExempt(rpd) && InLockedTechRange(rpd)) { if (!rpd.IsFinished || ArcaneTechnologySettings.evenResearched) { return(true); } } return(false); }