Hemogen on Kill - KonradHeinser/EBSGFramework GitHub Wiki

This comp allows you to make a hediff that gives the carrier hemogen whenever they kill a valid thing within range. The basic comp looks like this:

        <comps>
            <li Class="EBSGFramework.HediffCompProperties_HemogenOnKill">
            </li>
        </comps>

Tags available in this comp for specifying when it can activate:

  • validSeverity : Default (0~99999) : Severity range the parent needs to be in to activate this effect. If a single value is entered, then any severity above that number will be valid

  • maxDistance : Default (4.9) : Maximum distance to be able to use this effect. Set it to -1 to be able to gain hemogen from any distance. It is recommended that the minimum value be 1.9 instead of 1 to handle diagonal melee attacks

  • forbiddenTargetGenes : List of genes that will stop the effect from activating when the target has any one of them.

  • allowHumanoids : Default (True) : Killing humanoids triggers this hediff

  • allowDryads : Default (True) : Killing dryads triggers this hediff. This is separate from animals

  • allowInsects : Default (True) : Killing insects triggers this hediff. This is separate from animals

  • allowAnimals : Default (True) : Killing animals triggers this hediff

  • allowEntities : Default (True) : Killing entities triggers this hediff


There are two methods for dictating how much hemogen is gained. The static method gives the same amount of hemogen each time, and only requires you set the following tag to any non-zero number:

  • staticHemogenGain : Default (0) : If not 0, this is used instead of a portion of the remaining blood in a corpse. If this is not equal to zero, then hemogenEfficiency is never checked

The dynamic method provides hemogen based on the amount of blood the target has left. It will add bloodloss to the corpse in relation to however much hemogen was added to the pawn's hemogen levels

  • hemogenEfficiency : Default (1) : % efficiency. At 1, for every 10% of bloodloss added to the corpse, gain 0.1 hemogen, or 10 in game, while an efficiency of 2, would result in a gain of 0.2
  • maxGainableHemogen : Default (1) : Max hemogen gainable from one corpse, the default translating to 100 in-game. Max bloodloss is this divided by efficiency
    • For example, if maxGainableHemogen is 0.1, then a hemogenEfficiency of 1 causes a maximum bloodloss of 10%, an efficiency of 2 has a max bloodloss of 5%, and an efficiency of 0.5 has a max bloodloss of 20%
  • useRelativeBodySize : Default (True) : Creates an additional efficiency factor that accounts for body size differences between the killer and the victim

Due to the way the dynamic method works, I recommend trying various values to find what feels right for your goal

Note 1: Anything Rimworld recognizes as something that cannot bleed won't provide hemogen because they presumably don't have blood. Forbidden genes is mostly to account for weird genes from other mods that are supposed to create alternative blood types or similarly weird situations

Note 2: This won't cause issues if added to pawns without a hemogenic gene, this comp will just ignore all kills


Example hediff where the pawn drains up to 15% of their victim's blood to gain up to 0.3 hemogen (30 in-game), regardless of how far said victim is:

    <HediffDef ParentName="EBSG_TestHediffBase">
        <defName>JustASip</defName>
        <label>just a sip</label>
        <description>Any time this pawn kills a pawn that can bleed, it gains hemogen.</description>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_HemogenOnKill">
                <hemogenEfficiency>2</hemogenEfficiency>
                <maxGainableHemogen>0.3</maxGainableHemogen>
                <maxDistance>-1</maxDistance>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️