Hediff Adder - KonradHeinser/EBSGFramework GitHub Wiki

This gene class adds hediffs to the pawn when the gene is added to the pawn, and usually removes the hediffs from the pawn when the gene is removed. These are the basic stuff for the class:

        <!--Basic gene class for genes that don't need to use another class-->
        <geneClass>EBSGFramework.HediffAdder</geneClass>
        <!--Use this in place of Gene_HemogenDrain if you need to add hediffs as well-->
        <geneClass>EBSGFramework.Gene_HemoHediffAdder</geneClass>

If you're using any other class within this framework, then you can access all the hediff adding stuff listed on this page. The only exception is the spawn age limiter because the HediffAdder inherits from that

        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
                <hediffsToApply>
                    <li>
                    </li>
                </hediffsToApply>
            </li>
        </modExtensions>

These are the options available:

  • hediffsToApply is a special list of items that has the following options available to it:
    • hediff : The HediffDef to add. This is required
    • bodyParts : The list of BodyPartDefs to add the hediff to. If left blank, then it will add to the full body
    • onlyIfNew : Default (False) : While True, the hediff won't be added to a pawn/pawn part if the pawn already has it
    • severity : Default (0.5) : The severity to apply/add to the hediff
    • chance : Default (1) : The chances of the hediff actually being added
    • removeOnRemove : Default (True) : If set to false, then this specific hediff will be not be removed when the gene is removed by anything. It is recommended to leave this as True unless you are really sure
  • hediffsToRemove : A list of HediffDefs to remove. This list can't target specific body parts, and is mostly only intended for situations where other hediffs applied by the gene may generate new hediffs themselves, and those new hediffs should be removed as well
  • vanishingGene : Default (False) : When the hediff(s) are done being added, delete the gene. The hediffsToApply will never be removed by the gene when this triggers, though hediffsToRemove will still trigger

Important note: If you leave onlyIfNew as false, make sure to test that the hediff itself is fine with that

Other Important Note: If you're finding that the hediffs are not being added, double-check your geneClass. If the gene class is not added, or is not one from this framework, then the hediffs won't be added. EBSGFramework.HediffAdder is usually the one you're looking for

Third Important Note: If you are looking for min/max age stuff, the hediff will not be added/removed properly by this class. This can be solved by using Hediffs at Age instead

Fourth, and Probably Final Note: Most of the gene classes in this framework inherit from this class, which means that if they have their own specific class, they can also usually do anything that this class also does


This example adds a damaged kidney hediff, which causes one of the pawn's kidneys to become damaged shortly after spawning:

    <GeneDef>
        <defName>EBSG_DamagedKidney</defName>
        <label>damaged kidney</label>
        <geneClass>EBSGFramework.HediffAdder</geneClass>
        <description>There was a description here.</description>
        <displayOrderInCategory>0.1</displayOrderInCategory>
        <biostatMet>1</biostatMet>
        <exclusionTags><li>EBSG_Kidney</li></exclusionTags>
        <customEffectDescriptions>
            <li>One kidney loses 50% health on spawn.</li>
        </customEffectDescriptions>
        <modExtensions>
	    <li Class="EBSGFramework.EBSGExtension">
                <hediffsToApply>
                    <li>
                        <hediff>EBSG_DamagedKidney</hediff>
                        <bodyParts>
                            <li>Kidney</li>
                        </bodyParts>
                    </li>
                </hediffsToApply>
            </li>
        </modExtensions>
    </GeneDef>

    <HediffDef>
        <defName>EBSG_DamagedKidney</defName>
        <label>damaging kidney</label>
        <description>There was a description here.</description>
        <defaultLabelColor>(0.7, 0.7, 0.7)</defaultLabelColor>
	<hediffClass>HediffWithComps</hediffClass>
	<scenarioCanAdd>true</scenarioCanAdd>
	<maxSeverity>1.0</maxSeverity>
	<isBad>false</isBad>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_DamageBodyParts">
                <bodyPartsToDamage>
                    <li>
                        <bodyPart>Kidney</bodyPart>
                        <damagePercentage>0.5</damagePercentage>
                    </li>
                </bodyPartsToDamage>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️