Ejemplo n.º 1
0
        //
        // Methods
        //
        // EdB: Copy of CreateRelation() with changes to assign the other pawn's mother or father to this sibling if
        // they exist.  The logic that's in there already seems to take this into account, but doing it this
        // results in more predictable behavior in the context of Prepare Carefully customization.
        public override void CreateRelation(Pawn generated, Pawn other, ref PawnGenerationRequest request)
        {
            // EdB: Added this block to immediately assign the other pawn's parent to the sibling.
            bool otherPawnHasMother = other.GetMother() != null;
            bool otherPawnHasFather = other.GetFather() != null;

            if (generated.GetMother() != null && generated.GetFather() != null && !otherPawnHasMother && !otherPawnHasFather)
            {
                other.SetMother(generated.GetMother());
                other.SetFather(generated.GetFather());
                return;
            }
            // EdB: This is the end of the change.  Everything after this is the original implementation.

            bool flag  = other.GetMother() != null;
            bool flag2 = other.GetFather() != null;
            bool flag3 = Rand.Value < 0.85f;

            if (flag && LovePartnerRelationUtility.HasAnyLovePartner(other.GetMother()))
            {
                flag3 = false;
            }
            if (flag2 && LovePartnerRelationUtility.HasAnyLovePartner(other.GetFather()))
            {
                flag3 = false;
            }
            if (!flag)
            {
                Pawn newMother = PawnRelationWorker_Sibling.GenerateParent(generated, other, Gender.Female, request, flag3);
                other.SetMother(newMother);
            }
            generated.SetMother(other.GetMother());
            if (!flag2)
            {
                Pawn newFather = PawnRelationWorker_Sibling.GenerateParent(generated, other, Gender.Male, request, flag3);
                other.SetFather(newFather);
            }
            generated.SetFather(other.GetFather());
            if (!flag || !flag2)
            {
                bool flag4 = other.GetMother().story.traits.HasTrait(TraitDefOf.Gay) || other.GetFather().story.traits.HasTrait(TraitDefOf.Gay);
                if (flag4)
                {
                    other.GetFather().relations.AddDirectRelation(PawnRelationDefOf.ExLover, other.GetMother());
                }
                else if (flag3)
                {
                    other.GetFather().relations.AddDirectRelation(PawnRelationDefOf.Spouse, other.GetMother());
                }
                else
                {
                    LovePartnerRelationUtility.GiveRandomExLoverOrExSpouseRelation(other.GetFather(), other.GetMother());
                }
            }
            PawnRelationWorker_Sibling.ResolveMyName(ref request, generated);
            PawnRelationWorker_Sibling.ResolveMySkinColor(ref request, generated);
        }