public static IEnumerable <Rule> RulesForPawn(string pawnSymbol, Pawn pawn, Dictionary <string, string> constants = null) { if (pawn == null) { Log.ErrorOnce(string.Format("Tried to insert rule {0} for null pawn", pawnSymbol), 16015097, false); return(Enumerable.Empty <Rule>()); } return(GrammarUtility.RulesForPawn(pawnSymbol, pawn.Name, (pawn.story == null) ? null : pawn.story.Title, pawn.kindDef, pawn.gender, pawn.Faction, constants)); }
public static IEnumerable <Rule> RulesForPawn(string prefix, Pawn pawn, Dictionary <string, string> constants = null) { if (pawn == null) { Log.ErrorOnce(string.Format("Tried to insert rule {0} for null pawn", prefix), 16015097); return(Enumerable.Empty <Rule>()); } if (pawn.RaceProps.Humanlike) { return(GrammarUtility.RulesForPawn(prefix, pawn.Name, pawn.kindDef, pawn.gender, pawn.Faction, constants)); } return(GrammarUtility.RulesForPawn(prefix, null, pawn.kindDef, pawn.gender, pawn.Faction, constants)); }
public static IEnumerable <Rule> RulesForHediffDef(string prefix, HediffDef def, BodyPartRecord part) { foreach (Rule rule in GrammarUtility.RulesForDef(prefix, def)) { yield return(rule); } string noun = def.labelNoun; if (noun.NullOrEmpty()) { noun = def.label; } yield return(new Rule_String(prefix + "_labelNoun", noun)); string pretty = def.PrettyTextForPart(part); if (!pretty.NullOrEmpty()) { yield return(new Rule_String(prefix + "_labelNounPretty", pretty)); } }