public static bool InvestigateThingDef(ThingDef thing, ResearchProjectDef tech) { bool found = false; if (thing != null) { foreach (var skill in FindSkills(x => !x && x.Criteria != null)) { bool check = false; try { check = skill.Criteria(thing); } catch { } SetSkillRelevance(skill, check); found |= check; } //measures for weapons if (thing.IsWeapon) { tech.RegisterWeapon(thing); } if (thing.building != null && thing.building.turretGunDef != null && !FindTechs(thing.building.turretGunDef).Any()) { tech.RegisterWeapon(thing); } } return(found); }