Remove or Damage Parts - KonradHeinser/EBSGFramework GitHub Wiki
I made this comp after learning the hard way that Rimworld really, really hates it when body parts are removed before the pawn is spawned. My solution for this was making a hediff comp that removes the part shortly after spawn. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.HediffCompProperties_DamageBodyParts">
</li>
</comps>
Within the comp you have these options:
- bodyPartsToRemove : A list of BodyPartDefs to completely remove
- removeCount : This can be used to limit how many of the bodyPartsToRemove are picked (i.e. if set to 1, only 1 part is removed, if set to 3, up to 3 different items will be picked for removal. If this is not used, then the comp will attempt to remove all the parts listed
- bodyPartsToDamage : A special list of items intended to damage body parts
- bodyPart : The BodyPartDef that should be damaged
- damageAmount : A static amount of damage to take from the part. Cannot be used with damagePercentage
- damagePercentage : A percentage of the part's maximum health to take. Cannot be used with damageAmount
- damageCount : This can be used to limit how many of the bodyPartsToDamage are picked (i.e. if set to 1, only 1 part is damaged, if set to 3, up to 3 different items will be picked for damage. If this is not used, then the comp will attempt to damage all the parts listed
Example of both removing one part and damaging another:
<HediffDef>
<defName>EBSG_MissingAndDamagedKidney</defName>
<label>removing kidney and 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">
<bodyPartsToRemove>
<li>Kidney</li>
</bodyPartsToRemove>
<bodyPartsToDamage>
<li>
<bodyPart>Kidney</bodyPart>
<damagePercentage>0.5</damagePercentage>
</li>
</bodyPartsToDamage>
</li>
</comps>
</HediffDef>