protected override string ToGameStringFromPOV_Worker(Thing pov, bool forceLog)
		{
			string result;
			if (this.initiator == null || this.recipient == null)
			{
				Log.ErrorOnce("PlayLogEntry_Interaction has a null pawn reference.", 34422, false);
				result = "[" + this.intDef.label + " error: null pawn reference]";
			}
			else
			{
				Rand.PushState();
				Rand.Seed = this.logID;
				GrammarRequest request = base.GenerateGrammarRequest();
				string text;
				if (pov == this.initiator)
				{
					request.IncludesBare.Add(this.intDef.logRulesInitiator);
					request.Rules.AddRange(GrammarUtility.RulesForPawn("ME", this.initiator, request.Constants));
					request.Rules.AddRange(GrammarUtility.RulesForPawn("OTHER", this.recipient, request.Constants));
					request.Rules.AddRange(GrammarUtility.RulesForPawn("INITIATOR", this.initiator, request.Constants));
					request.Rules.AddRange(GrammarUtility.RulesForPawn("RECIPIENT", this.recipient, request.Constants));
					text = GrammarResolver.Resolve("r_logentry", request, "interaction from initiator", forceLog);
				}
				else if (pov == this.recipient)
				{
					if (this.intDef.logRulesRecipient != null)
					{
						request.IncludesBare.Add(this.intDef.logRulesRecipient);
					}
					else
					{
						request.IncludesBare.Add(this.intDef.logRulesInitiator);
					}
					request.Rules.AddRange(GrammarUtility.RulesForPawn("ME", this.recipient, request.Constants));
					request.Rules.AddRange(GrammarUtility.RulesForPawn("OTHER", this.initiator, request.Constants));
					request.Rules.AddRange(GrammarUtility.RulesForPawn("INITIATOR", this.initiator, request.Constants));
					request.Rules.AddRange(GrammarUtility.RulesForPawn("RECIPIENT", this.recipient, request.Constants));
					text = GrammarResolver.Resolve("r_logentry", request, "interaction from recipient", forceLog);
				}
				else
				{
					Log.ErrorOnce("Cannot display PlayLogEntry_Interaction from POV who isn't initiator or recipient.", 51251, false);
					text = this.ToString();
				}
				if (this.extraSentencePacks != null)
				{
					for (int i = 0; i < this.extraSentencePacks.Count; i++)
					{
						request.Clear();
						request.Includes.Add(this.extraSentencePacks[i]);
						request.Rules.AddRange(GrammarUtility.RulesForPawn("INITIATOR", this.initiator, request.Constants));
						request.Rules.AddRange(GrammarUtility.RulesForPawn("RECIPIENT", this.recipient, request.Constants));
						text = text + " " + GrammarResolver.Resolve(this.extraSentencePacks[i].RulesPlusIncludes[0].keyword, request, "extraSentencePack", forceLog);
					}
				}
				Rand.PopState();
				result = text;
			}
			return result;
		}
        public override string ToGameStringFromPOV(Thing pov)
        {
            if (this.initiator == null || this.recipient == null)
            {
                Log.ErrorOnce("PlayLogEntry_Interaction has a null pawn reference.", 34422);
                return("[" + this.intDef.label + " error: null pawn reference]");
            }
            Rand.PushState();
            Rand.Seed = this.randSeed;
            GrammarRequest request = default(GrammarRequest);
            string         text;

            if (pov == this.initiator)
            {
                request.Rules.AddRange(this.intDef.logRulesInitiator.Rules);
                request.Rules.AddRange(GrammarUtility.RulesForPawn("me", this.initiator, request.Constants));
                request.Rules.AddRange(GrammarUtility.RulesForPawn("other", this.recipient, request.Constants));
                text = GrammarResolver.Resolve("logentry", request, "interaction from initiator", false);
            }
            else if (pov == this.recipient)
            {
                if (this.intDef.logRulesRecipient != null)
                {
                    request.Rules.AddRange(this.intDef.logRulesRecipient.Rules);
                }
                else
                {
                    request.Rules.AddRange(this.intDef.logRulesInitiator.Rules);
                }
                request.Rules.AddRange(GrammarUtility.RulesForPawn("me", this.recipient, request.Constants));
                request.Rules.AddRange(GrammarUtility.RulesForPawn("other", this.initiator, request.Constants));
                text = GrammarResolver.Resolve("logentry", request, "interaction from recipient", false);
            }
            else
            {
                Log.ErrorOnce("Cannot display PlayLogEntry_Interaction from POV who isn't initiator or recipient.", 51251);
                text = this.ToString();
            }
            if (this.extraSentencePacks != null)
            {
                for (int i = 0; i < this.extraSentencePacks.Count; i++)
                {
                    request.Clear();
                    request.Includes.Add(this.extraSentencePacks[i]);
                    request.Rules.AddRange(GrammarUtility.RulesForPawn("initiator", this.initiator, request.Constants));
                    request.Rules.AddRange(GrammarUtility.RulesForPawn("recipient", this.recipient, request.Constants));
                    text = text + " " + GrammarResolver.Resolve(this.extraSentencePacks[i].RulesPlusIncludes[0].keyword, request, "extraSentencePack", false);
                }
            }
            Rand.PopState();
            return(text);
        }
示例#3
0
        protected override string ToGameStringFromPOV_Worker(Thing pov, bool forceLog)
        {
            if (initiator == null || recipient == null)
            {
                Log.ErrorOnce("PlayLogEntry_Interaction has a null pawn reference.", 34422);
                return("[" + intDef.label + " error: null pawn reference]");
            }
            Rand.PushState();
            Rand.Seed = logID;
            GrammarRequest request = base.GenerateGrammarRequest();
            string         text;

            if (pov == initiator)
            {
                request.IncludesBare.Add(intDef.logRulesInitiator);
                request.Rules.AddRange(GrammarUtility.RulesForPawn("INITIATOR", initiator, request.Constants));
                request.Rules.AddRange(GrammarUtility.RulesForPawn("RECIPIENT", recipient, request.Constants));
                text = GrammarResolver.Resolve("r_logentry", request, "interaction from initiator", forceLog);
            }
            else if (pov == recipient)
            {
                if (intDef.logRulesRecipient != null)
                {
                    request.IncludesBare.Add(intDef.logRulesRecipient);
                }
                else
                {
                    request.IncludesBare.Add(intDef.logRulesInitiator);
                }
                request.Rules.AddRange(GrammarUtility.RulesForPawn("INITIATOR", initiator, request.Constants));
                request.Rules.AddRange(GrammarUtility.RulesForPawn("RECIPIENT", recipient, request.Constants));
                text = GrammarResolver.Resolve("r_logentry", request, "interaction from recipient", forceLog);
            }
            else
            {
                Log.ErrorOnce("Cannot display PlayLogEntry_Interaction from POV who isn't initiator or recipient.", 51251);
                text = ToString();
            }
            if (extraSentencePacks != null)
            {
                for (int i = 0; i < extraSentencePacks.Count; i++)
                {
                    request.Clear();
                    request.Includes.Add(extraSentencePacks[i]);
                    request.Rules.AddRange(GrammarUtility.RulesForPawn("INITIATOR", initiator, request.Constants));
                    request.Rules.AddRange(GrammarUtility.RulesForPawn("RECIPIENT", recipient, request.Constants));
                    text = text + " " + GrammarResolver.Resolve(extraSentencePacks[i].FirstRuleKeyword, request, "extraSentencePack", forceLog, extraSentencePacks[i].FirstUntranslatedRuleKeyword);
                }
            }
            Rand.PopState();
            return(text);
        }