[SOLVED] Enable Human Pregnancy

Started by O Negative, January 01, 2019, 11:44:14 AM

Previous topic - Next topic

O Negative

As it stands, human pawns can't get pregnant through lovin'. How do I enable human pawn pregnancy through lovin'?

Razuhl

It's just about the job driver. The JobDriver_Lovin is not adding the toil of calling PawnUtility.Mated(father,mother). Simply create your own JobDriver_LovinEx that uses the JobDriver_Lovin as base class. Then expand the makeNewToils method by adding the new toil to the list. Lastly register the job driver.

Create the class:


public class JobDriver_LovinEx : JobDriver_Lovin
{
protected override IEnumerable<Toil> MakeNewToils() {
return base.MakeNewToils().Concat(Toils_General.Do(delegate{PawnUtility.Mated(pawn, (Pawn)this.job.GetTarget(TargetIndex.A).Thing);}));
}
}


Patch the JobDriver:


<Operation Class="PatchOperationReplace">
<xpath>/Defs/JobDef[defName = "Lovin"]/driverClass</xpath>
<value>
<driverClass>MyMod.JobDriver_LovinEx</driverClass>
</value>
</Operation>


This will make one of the participants pregnant with a 50% chance. You have to check the genders to make sure the female gets pregnant and that a male and a female are participating.

O Negative

Thank you for yet another reply!

I tried what you recommended, and it worked, but not perfect/ideal for what I'm trying to accomplish. I ended up using a custom HediffGiver, and it's working rather well. The HediffGiver checks a few things before attempting to add the pregnant hediff to the pawn, and it's a lot easier to mess with than toils and such; At least, it is for me :P

Nevertheless, I still appreciate your help :D