Pregnancy Replacing Genes - KonradHeinser/EBSGFramework GitHub Wiki

This gene mod extension allows you to set up genes that cause a pawn to always lose the pregnant hediff as soon as they get it, and replace that hediff with something else. This extension does not require any of the gene classes from this framework to function:

        <modExtensions>
            <li Class="EBSGFramework.PregnancyReplacerExtension">
            </li>
        </modExtensions>

The extension by itself prevents all pregnancies similar to setting fertility to 0 (though if stopping pregnancies is your only goal, stick to the sterile gene). These are the options available within the extension:

  • fatherRequiresOneOf : A list of GeneDefs that the "father" must have at least one of to spawn things or add hediffs. Even if the father does not have any of these genes, the pregnancy will still be removed, just without any additional effect. This can be the same as the gene this extension is attached to
  • motherHediff : A hediff to give to the mother. This will set the father as the "other" pawn for certain classes and comps, as listed lower on this page
  • fatherHediff : A hediff to give to the father. This will set the mother as the "other" pawn for certain classes and comps, as listed lower on this page
  • replacementHediffs : A list of HediffDefs that are applied to the mother. They will set the father as the "other" pawn for certain classes and comps, as listed lower on this page
  • initialSeverity : Default (1) : The severity all hediffs are set to when added
  • increaseSeverity : Default (0) : The severity to add to any hediff which the pawn already has
  • filth : The filth to make around the pawn
  • filthCount : The amount of the filth to make
  • spawnThings : A list of thing def count classes that handles spawns. Unlike standard lists, the li is replaced with the ThingDef that you would like to make. The bottom of the example shows various ways that this may look like. This is what you can place between the ThingDef tags:
    • stuff : If the ThingDef is made of stuff, this is what to make it out of
    • count : Default (1) : How many to make
    • chance : Default (1) : The probability of this actually succeeding
    • color : The color to make the item, if possible to change
    • quality : Default (Normal) : The quality to give the item, if the item uses quality. The options are Awful, Poor, Normal, Good, Excellent, Masterwork, and Legendary

Notes

It is recommended that you add some sort of temporarily sterilizing hediff to the mother because the way that Rimworld handles adding the pregnancy hediff frequently causes it to add twice in cases like this, where it is remove immediately after adding.

The hediff tags will set the partner as the "other" pawn in the following situations:

  • HediffWithTarget : Any hediff class that inherits from (or is) this one will use the father as the target
  • HediffComp_Link : Will use the father for other
  • HediffComp_SpawnHumanlike : Will transfer both the father and mother from the pregnancy hediff to the new hediff

This example causes the pawn to become unable to be pregnant, and in the event that a male with the same gene manages to "impregnate" them, they spawn wood, steel, and sometimes plasteel, along with creating a bond with that male similar to the highmate's psychic bond ability.

The EBSG_BriefSterility hediff is added to the mother to stop Rimworld from trying to recreate the pregnancy hediff immediately, and if a modder wanted to, they could also use the Gene Randomizer to remove this gene, thus allowing the pawn to become pregnant normally with a new life-long partner

    <GeneDef>
        <defName>WeirdPregnancyNonsense</defName>
        <label>stuff happens</label>
        <description>.</description>
        <iconPath>UI/Icons/Genes/Gene_HairColor</iconPath> <!--Using a generic icon that's I know will be there-->
        <displayCategory>Reproduction</displayCategory>
        <exclusionTags>
            <li>EBSG_PregnancyReplacer</li>
        </exclusionTags>
        <modExtensions>
            <li Class="EBSGFramework.PregnancyReplacerExtension">
                <fatherRequiresOneOf>
                    <li>WeirdPregnancyNonsense</li>
                </fatherRequiresOneOf>
                <motherHediff>PsychicBond</motherHediff>
                <fatherHediff>PsychicBond</fatherHediff>
                <replacementHediffs> 
                    <!--Added to stop Rimworld from adding the hediff again. I'm not sure why Rimworld does it, but without this you will generate double of everything. 
                    This hediff only applies to the mother, lasts for 1 second, and is part of the framework itself. 
                    It can be freely replaced with any other hediff that makes the mother unable to get pregnant again, as long as the hediff you make lasts for at least 1 second-->
                    <li>EBSG_BriefSterility</li>
                </replacementHediffs>
                <spawnThings>
                    <Steel> <!--Creates 10 steel-->
                        <count>10</count>
                    </Steel>
                    <WoodLog /> <!--Creates one log-->
                    <Plasteel> <!--50% chance of getting 1 plasteel-->
                        <chance>0.5</chance>
                    </Plasteel>
                </spawnThings>
            </li>
        </modExtensions>
    </GeneDef>
⚠️ **GitHub.com Fallback** ⚠️