Give Other Hediff Periodically - KonradHeinser/EBSGFramework GitHub Wiki

This hediff comp can create, or attempt to create, another hediff on a regular interval. The base comp looks like this:

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

These are the options available in the comp:

  • hediff : The HediffDef to apply
  • interval : Default (2500) : How many ticks there should be between attempts
  • severity : Default (1) : The amount of severity to give/add to the applied hediff
  • multiplySeverityByParentSeverity : Default (False) : Multiplies severity by the severity of the hediff this is attached to
  • onlyIfNew : Default (False) : If set to True, then severity will only be used for new hediffs. Existing hediffs are unaffected
  • bodyParts : The body parts to attach the hediff to. Each part is treated as a separate entity by onlyIfNew
  • validSeverities : A range of severities that the hediff this is attached to must have for this comp to be used. If you enter a single value instead of a range, any severity at or above that value will be valid
  • chance : Default (1) : The chance of the hediff actually being applied/increased each interval
  • linkingHediff : A HediffDef that points to another pawn for the new hediff. If the new hediff is a HediffWithTarget, then that link points to the target. If using Spawn Pawn Kind on Removal, the link points to the instigator. If using Spawn Humanlike, it points to the father. If using this, you need to have one of the following to avoid things working incorrectly, either have the resulting hediff's class be HediffWithTarget or something that inherits from it, or set onlyIfNew to True to avoid multiple hediffs being made
  • linkMandatory : Default (True) : If you have something in linkingHediff, this ensures that the pawn with the hediff this is attached to has that hediff, and that hediff points to another pawn. If you aren't using linkingHediff, this does nothing

This example causes the pawn to suffer blood loss every hour based on how high the internal bleeding severity is as long as the internal bleeding hediff has a severity of at least 0.1:

    <HediffDef>
        <defName>InternalBleeding</defName>
        <label>internal bleeding</label>
        <description>Blood in the wrong places, but still inside.</description>
        <hediffClass>HediffWithComps</hediffClass>
        <initialSeverity>0.1</initialSeverity>
        <stages />
        <comps>
            <li Class="HediffCompProperties_SeverityPerDay">
                <severityPerDay>-0.1</severityPerDay>
            </li>
            <li Class="EBSGFramework.HediffCompProperties_GiveOtherHediffPeriodically">
                <hediff>BloodLoss</hediff>
                <severity>1</severity>
                <validSeverities>0.1</validSeverities>
                <multiplySeverityByParentSeverity>True</multiplySeverityByParentSeverity>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️