public static void doElect(Pawn pawn, Hediff hediff, bool forced = false) { hediff.Severity = 0.1f; pawn.health.AddHediff(hediff, null, null); pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("ElectedLeader")); StringBuilder stringBuilder = new StringBuilder(); if (forced) { stringBuilder.AppendLine("LeaderChosen".Translate(new object[] { pawn.Name.ToStringFull, hediff.LabelBase })); } else { stringBuilder.AppendLine("LeaderElected".Translate(new object[] { pawn.Name.ToStringFull, hediff.LabelBase })); } if (Prefs.DevMode) { stringBuilder.AppendLine(""); stringBuilder.AppendLine("--DEBUG-DEV---"); stringBuilder.AppendLine("Botanist Score: " + getBotanistScore(pawn)); stringBuilder.AppendLine("Warrior Score: " + getWarriorScore(pawn)); stringBuilder.AppendLine("Carpenter Score: " + getCarpenterScore(pawn)); stringBuilder.AppendLine("Scientist Score: " + getScientistScore(pawn)); } if (Utility.getGov() != null) { Find.LetterStack.ReceiveLetter("NewLeaderLetterTitle".Translate(new object[] { Utility.getGov().nameMale }), stringBuilder.ToString(), LetterDefOf.Good, pawn, null); } else { Find.LetterStack.ReceiveLetter("New Leader", stringBuilder.ToString(), LetterDefOf.Good, pawn, null); } foreach (Pawn p in getAllColonists()) { if (p != pawn) { int num2 = p.relations.OpinionOf(pawn); if (num2 <= -20) { p.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("RivalLeader"), null); } if (p.story.traits.HasTrait(TraitDef.Named("Jealous")) && TeachingUtility.leaderH(p) == null) { p.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("ElectedLeaderJealous"), null); } } } }
public void DrawIconsModded(Rect rect, Pawn colonist) { if (colonist.Dead) { return; } float num = 20f * this.ColonistBar.Scale; Vector2 vector = new Vector2(rect.x + 1f, rect.yMax - num - 1f); bool flag = false; if (colonist.CurJob != null) { JobDef def = colonist.CurJob.def; if (def == JobDefOf.AttackMelee || def == JobDefOf.AttackStatic) { flag = true; } else if (def == JobDefOf.WaitCombat) { Stance_Busy stance_Busy = colonist.stances.curStance as Stance_Busy; if (stance_Busy != null && stance_Busy.focusTarg.IsValid) { flag = true; } } } Hediff Leader = TeachingUtility.leaderH(colonist); if (colonist.InAggroMentalState) { this.DrawIcon(Icon_MentalStateAggro, ref vector, colonist.MentalStateDef.LabelCap); } else if (colonist.InMentalState) { this.DrawIcon(Icon_MentalStateNonAggro, ref vector, colonist.MentalStateDef.LabelCap); } else if (colonist.InBed() && colonist.CurrentBed().Medical) { this.DrawIcon(Icon_MedicalRest, ref vector, "ActivityIconMedicalRest".Translate()); } else if (colonist.CurJob != null && colonist.jobs.curDriver.asleep) { this.DrawIcon(Icon_Sleeping, ref vector, "ActivityIconSleeping".Translate()); } else if (colonist.CurJob != null && colonist.CurJob.def == JobDefOf.FleeAndCower) { this.DrawIcon(Icon_Fleeing, ref vector, "ActivityIconFleeing".Translate()); } else if (flag) { this.DrawIcon(Icon_Attacking, ref vector, "ActivityIconAttacking".Translate()); } else if (colonist.mindState.IsIdle && GenDate.DaysPassed >= 1) { this.DrawIcon(Icon_Idle, ref vector, "ActivityIconIdle".Translate()); } else if (Leader != null) { this.DrawIcon(Icon_Star, ref vector, Leader.LabelBase); } if (colonist.IsBurning()) { this.DrawIcon(Icon_Burning, ref vector, "ActivityIconBurning".Translate()); } }