public static ThingComp TryGetComp(this Thing _this, CompProperties def) { ThingCategory thingCategory = _this.def.category; if (thingCategory == ThingCategory.Pawn || thingCategory == ThingCategory.Building || thingCategory == ThingCategory.Item || thingCategory == ThingCategory.Filth || thingCategory == ThingCategory.Gas || _this.def.IsBlueprint) { ThingWithComps thingWithComps = _this as ThingWithComps; if (thingWithComps != null) { return(thingWithComps.GetCompByDef(def)); } } return(null); }