public bool TryInteractWith(Pawn recipient, InteractionDef intDef) { if (DebugSettings.alwaysSocialFight) { intDef = InteractionDefOf.Insult; } if (this.pawn == recipient) { Log.Warning(this.pawn + " tried to interact with self, interaction=" + intDef.defName); return(false); } if (!this.CanInteractNowWith(recipient)) { return(false); } if (this.InteractedTooRecentlyToInteract()) { Log.Error(this.pawn + " tried to do interaction " + intDef + " to " + recipient + " only " + (Find.TickManager.TicksGame - this.lastInteractionTime) + " ticks since last interaction (min is " + 120 + ")."); return(false); } List <RulePackDef> list = new List <RulePackDef>(); if (intDef.initiatorThought != null) { Pawn_InteractionsTracker.AddInteractionThought(this.pawn, recipient, intDef.initiatorThought); } if (intDef.recipientThought != null && recipient.needs.mood != null) { Pawn_InteractionsTracker.AddInteractionThought(recipient, this.pawn, intDef.recipientThought); } if (intDef.initiatorXpGainSkill != null) { this.pawn.skills.Learn(intDef.initiatorXpGainSkill, (float)intDef.initiatorXpGainAmount, false); } if (intDef.recipientXpGainSkill != null && recipient.RaceProps.Humanlike) { recipient.skills.Learn(intDef.recipientXpGainSkill, (float)intDef.recipientXpGainAmount, false); } bool flag = false; if (recipient.RaceProps.Humanlike) { flag = recipient.interactions.CheckSocialFightStart(intDef, this.pawn); } if (!flag) { intDef.Worker.Interacted(this.pawn, recipient, list); } MoteMaker.MakeInteractionBubble(this.pawn, recipient, intDef.interactionMote, intDef.Symbol); this.lastInteractionTime = Find.TickManager.TicksGame; if (flag) { list.Add(RulePackDefOf.Sentence_SocialFightStarted); } Find.PlayLog.Add(new PlayLogEntry_Interaction(intDef, this.pawn, recipient, list)); return(true); }
public bool TryInteractWith(Pawn recipient, InteractionDef intDef) { if (DebugSettings.alwaysSocialFight) { intDef = InteractionDefOf.Insult; } if (this.pawn == recipient) { Log.Warning(this.pawn + " tried to interact with self, interaction=" + intDef.defName, false); return(false); } if (!this.CanInteractNowWith(recipient)) { return(false); } if (this.InteractedTooRecentlyToInteract()) { Log.Error(string.Concat(new object[] { this.pawn, " tried to do interaction ", intDef, " to ", recipient, " only ", Find.TickManager.TicksGame - this.lastInteractionTime, " ticks since last interaction (min is ", 120, ")." }), false); return(false); } List <RulePackDef> list = new List <RulePackDef>(); if (intDef.initiatorThought != null) { Pawn_InteractionsTracker.AddInteractionThought(this.pawn, recipient, intDef.initiatorThought); } if (intDef.recipientThought != null && recipient.needs.mood != null) { Pawn_InteractionsTracker.AddInteractionThought(recipient, this.pawn, intDef.recipientThought); } if (intDef.initiatorXpGainSkill != null) { this.pawn.skills.Learn(intDef.initiatorXpGainSkill, (float)intDef.initiatorXpGainAmount, false); } if (intDef.recipientXpGainSkill != null && recipient.RaceProps.Humanlike) { recipient.skills.Learn(intDef.recipientXpGainSkill, (float)intDef.recipientXpGainAmount, false); } bool flag = false; if (recipient.RaceProps.Humanlike) { flag = recipient.interactions.CheckSocialFightStart(intDef, this.pawn); } string text; string label; LetterDef letterDef; if (!flag) { intDef.Worker.Interacted(this.pawn, recipient, list, out text, out label, out letterDef); } else { text = null; label = null; letterDef = null; } MoteMaker.MakeInteractionBubble(this.pawn, recipient, intDef.interactionMote, intDef.Symbol); this.lastInteractionTime = Find.TickManager.TicksGame; if (flag) { list.Add(RulePackDefOf.Sentence_SocialFightStarted); } PlayLogEntry_Interaction playLogEntry_Interaction = new PlayLogEntry_Interaction(intDef, this.pawn, recipient, list); Find.PlayLog.Add(playLogEntry_Interaction); if (letterDef != null) { string text2 = playLogEntry_Interaction.ToGameStringFromPOV(this.pawn, false); if (!text.NullOrEmpty()) { text2 = text2 + "\n\n" + text; } Find.LetterStack.ReceiveLetter(label, text2, letterDef, this.pawn, null, null); } return(true); }