public static bool Prefix(Pawn mother, Pawn father) { if (mother != null && PawnHelper.is_human(mother)) { bool motherInJail = mother.guest != null && mother.guest.IsPrisoner && mother.Faction != Faction.OfPlayer; bool amnestyOnMother = motherInJail && father != null && PawnHelper.is_human(father) && PawnHelper.is_kind(father); if (amnestyOnMother) { mother.SetFaction(Faction.OfPlayer, father); TaleRecorder.RecordTale(TaleDefOf.Recruited, new object[] { father, // recruiter mother //recruitee }); father.records.Increment(RecordDefOf.PrisonersRecruited); mother.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.RecruitedMe, father); } else if (motherInJail) { //will need to make babies belonging to us HeDiffPrisonerGivingBirth factionDiff = (HeDiffPrisonerGivingBirth)HediffMaker.MakeHediff(Constants.GivingBirth, mother, null); factionDiff.Faction = mother.Faction; mother.health.AddHediff(factionDiff); mother.SetFactionDirect(Faction.OfPlayer); } } return(true); }
public static void Postfix(Pawn mother, Pawn father) { if (mother == null || !PawnHelper.is_human(mother)) { return; } var realFactionHeDiff = mother.health.hediffSet.GetHediffs <HeDiffPrisonerGivingBirth>().Where(x => true); //lz clone if (!realFactionHeDiff.Any()) { return; } foreach (HeDiffPrisonerGivingBirth heDiff in realFactionHeDiff) { if (heDiff.Faction != null) { mother.SetFactionDirect(heDiff.Faction); } mother.health.RemoveHediff(heDiff); } }