Hediff on Consumption - KonradHeinser/EBSGFramework GitHub Wiki

This portion of the EBSG extension allows you to create genes that apply a hediff when the pawn consumes specific ThingDefs. For the basic setup, you'll need to use one of the gene classes within this framework, with the generally recommended one being the Hediff Adder Class:

        <geneClass>EBSGFramework.HediffAdder</geneClass>

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

The hediffsToGivePostConsumption tag is a special list that acts similar to the one from the Hediff Adder Class, with the notable exception that this one has an additional list for the ThingDefs that cause the adding. Any number of li's may be added, and all of them have access to these options:

  • 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
  • validAges : Default (0~9999) : The range of ages that the pawn must be within for the hediff to be added
  • consumedThings : The list of ThingDefs that cause this to activate

This example makes pawns with the gene have a 50% chance of gaining the ambrosia high hediff when they consume a packaged survival meal:

    <GeneDef>
        <defName>Survivalist</defName>
        <label>survivalist</label>
        <description>When this pawn eats a packaged survival meal, they have a 50% chance to gain similar benefits a normal pawn would gain from consuming ambrosia without risk of addiction or triggering drug hatred.</description>
        <geneClass>EBSGFramework.HediffAdder</geneClass>
        <iconPath>UI/Icons/Genes/Gene_HairColor</iconPath> <!--Using a generic icon that's I know will be there-->
        <displayCategory>Miscellaneous</displayCategory>
        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
                <hediffsToGivePostConsumption>
                    <li>
                        <hediff>AmbrosiaHigh</hediff>
                        <chance>0.5</chance>
                        <severity>1</severity>
                        <consumedThings>
                            <li>MealSurvivalPack</li>
                        </consumedThings>
                    </li>
                </hediffsToGivePostConsumption>
            </li>
        </modExtensions>
    </GeneDef>
⚠️ **GitHub.com Fallback** ⚠️