Example #1
0
        private Thought_Situational TryCreateThought(ThoughtDef def)
        {
            Thought_Situational thought_Situational = null;

            try
            {
                if (!ThoughtUtility.CanGetThought(this.pawn, def))
                {
                    return(null);
                }
                if (!def.Worker.CurrentState(this.pawn).Active)
                {
                    return(null);
                }
                thought_Situational      = (Thought_Situational)ThoughtMaker.MakeThought(def);
                thought_Situational.pawn = this.pawn;
                thought_Situational.RecalculateState();
                return(thought_Situational);
            }
            catch (Exception ex)
            {
                Log.Error("Exception while recalculating " + def + " thought state for pawn " + this.pawn + ": " + ex);
                return(thought_Situational);
            }
        }
Example #2
0
        private Thought_Situational TryCreateThought(ThoughtDef def)
        {
            Thought_Situational thought_Situational = null;

            try
            {
                if (!ThoughtUtility.CanGetThought_NewTemp(pawn, def))
                {
                    return(null);
                }
                if (!def.Worker.CurrentState(pawn).ActiveFor(def))
                {
                    return(null);
                }
                thought_Situational      = (Thought_Situational)ThoughtMaker.MakeThought(def);
                thought_Situational.pawn = pawn;
                thought_Situational.RecalculateState();
                return(thought_Situational);
            }
            catch (Exception ex)
            {
                Log.Error(string.Concat("Exception while recalculating ", def, " thought state for pawn ", pawn, ": ", ex));
                return(thought_Situational);
            }
        }
        private Thought_Situational TryCreateThought(ThoughtDef def)
        {
            Thought_Situational thought_Situational = null;

            try
            {
                if (!ThoughtUtility.CanGetThought(this.pawn, def))
                {
                    Thought_Situational result = null;
                    return(result);
                }
                if (!def.Worker.CurrentState(this.pawn).Active)
                {
                    Thought_Situational result = null;
                    return(result);
                }
                thought_Situational      = (Thought_Situational)ThoughtMaker.MakeThought(def);
                thought_Situational.pawn = this.pawn;
                thought_Situational.RecalculateState();
            }
            catch (Exception ex)
            {
                Log.Error(string.Concat(new object[]
                {
                    "Exception while recalculating ",
                    def,
                    " thought state for pawn ",
                    this.pawn,
                    ": ",
                    ex
                }));
            }
            return(thought_Situational);
        }