public bool CanGetThought(ThoughtDef def)
        {
            ProfilerThreadCheck.BeginSample("CanGetThought()");
            try
            {
                if (this.npawn.MentalState != null && this.tpawn.MentalStateDef.blockNormalThoughts && !def.validWhileInMentalState && !def.IsSocial)
                {
                    bool result = false;
                    return(result);
                }

                if (def.nullifyingTraits != null)
                {
                    for (int i = 0; i < def.nullifyingTraits.Count; i++)
                    {
                        if (this.tpawn.story.traits.HasTrait(def.nullifyingTraits[i]))
                        {
                            bool result = false;
                            return(result);
                        }
                    }
                }
                if (def.requiredTraits != null)
                {
                    for (int j = 0; j < def.requiredTraits.Count; j++)
                    {
                        if (!this.tpawn.story.traits.HasTrait(def.requiredTraits[j]))
                        {
                            if (def != null && tpawn != null)
                            {
                                return(HasSoulTraitRequirements(def, tpawn));
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        if (def.RequiresSpecificTraitsDegree && def.requiredTraitsDegree != this.tpawn.story.traits.DegreeOfTrait(def.requiredTraits[j]))
                        {
                            bool result = false;
                            return(result);
                        }
                    }
                }

                if (def.nullifiedIfNotColonist && !this.tpawn.IsColonist)
                {
                    bool result = false;
                    return(result);
                }
                if (ThoughtUtility.IsSituationalThoughtNullifiedByHediffs(def, this.tpawn))
                {
                    bool result = false;
                    return(result);
                }
                if (ThoughtUtility.IsThoughtNullifiedByOwnTales(def, this.tpawn))
                {
                    bool result = false;
                    return(result);
                }
                if (tpawn == null)
                {
                    Log.Message("No tpawn");
                }
                if (def == null)
                {
                    Log.Message("No Def");
                }

                if (HasSoulTraitNullyfyingTraits(def, tpawn))
                {
                    return(false);
                }
            }
            finally
            {
                ProfilerThreadCheck.EndSample();
            }

            if (IsAutomaton(this.tpawn))
            {
                ThoughtDefAutomaton Tdef = new ThoughtDefAutomaton();
                if ((Tdef = def as ThoughtDefAutomaton) != null && Tdef.IsAutomatonThought)
                {
                    return(true);
                }

                return(false);
            }

            return(true);
        }