Damage on Removal - KonradHeinser/EBSGFramework GitHub Wiki
This hediff comp allows you to deal damage to a pawn when the hediff is removed. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.HediffCompProperties_DamageOnRemoval">
</li>
</comps>
These are the options you have available within the comp:
- damage : The DamageDef to use
- amount : Default (-1) : The amount of damage to deal. When left at -1 it looks for the default amount from damage
- severity : The severity required for the comp to activate. Can be a single value or a range of severities (i.e. 0~1.5). When it's a single value, the severity must be above that value for the comp to activate. If it's a range of values, then the hediff's severity must be within the range to activate
- minHealthRemaining : Default (0) : The minimum amount of health the part should be left with post-damage. Due to how Rimworld handles damage, values below 1 will destroy the part regardless
- createFilth : Default (True) : Creates filth when the damage occurs, which is usually blood
- neverWhenDead : Default (True) : If the hediff is removed automatically upon death, then this prevents it from dealing damage to a corpse. Generally recommended to keep this as True
- bodyParts : A list of valid body parts to select. If the hediff is applied to a part, that part will always be picked regardless of what is or is not on this list. When not attached to a part, a random part from this list will be selected, or a random part in general if this list is left empty
- trulyRandomPart : Default (False) : If bodyParts is empty and the hediff is not attached to a part, a random body part is selected. While this is False, body parts with more maximum health are more likely to be selected, but if it's set to True, then it will try to pick a completely random part
This example causes the pawn to take a bunch of damage and start bleeding when the hediff is removed. Because the minHealthRemaining is set to 1 it won't ever remove parts completely, but it can render them nearly unusable:
<HediffDef>
<defName>HavinABlast</defName>
<label>havin' a blast</label>
<description>Until you get hurt</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_DamageOnRemoval">
<damage>Bomb</damage> <!--Causes bleeding and shredded on the part-->
<amount>20</amount>
<minHealthRemaining>1</minHealthRemaining>
</li>
</comps>
</HediffDef>