Hediff While Moving - KonradHeinser/EBSGFramework GitHub Wiki

This hediff comp applies other hediffs based on whether the pawn is or is not moving. Because I'm not inventive with these names, they are for exactly what their name says. No s means it accepts one hediffDef, and an s means it accepts a list of hediffDefs. The full list of options are:

Global

  • fadingHediffs : Default (false) : If true, both hediffs will try to fade over time. The rate of fading will first check for the global severity per hour, then the individual one, then for the moving/not moving severity per hour. If all of them are at or below 0, then the hediff just reverts to standard deletion pattern
  • severityFadePerHour : Default (0) : If greater than 0 and any hediff should fade, then this is subtracted from the hediff's severity over the span of an hour

Moving

  • hediffWhileMoving : Singular hediff to apply while moving
  • hediffsWhileMoving : List of hediffs to apply while moving
  • initialMovingSeverity : Default (1) : Initial severity for all moving hediffs
  • movingSeverityPerHour : Default (0) : Severity increase for all hediffs for every hour of moving. If your hediff's max severity is greater than 1, this is probably going to be really high
  • fadingMovingHediff : Default (false) : Sets the moving hediff to fade over time instead of just being deleted
  • movingSeverityFadePerHour : Default (0) : If greater than 0 and the moving hediff(s) should fade, this is subtracted from the moving hediff's severity while the pawn is not moving over the span of an hour

Not moving

  • hediffWhileNotMoving : Singular hediff to apply while not moving
  • hediffsWhileNotMoving : List of hediffs to apply while not moving
  • initialNotMovingSeverity : Default (1) : Initial severity for all not moving hediffs
  • notMovingSeverityPerHour : Default (0) : Severity increase for all hediffs for every hour of not moving. If your hediff's max severity is greater than 1, this is probably going to be really high
  • fadingNotMovingHediff : Default (false) : Sets the not moving hediff to fade over time instead of just being deleted
  • notMovingSeverityFadePerHour : Default (0) : If greater than 0 and the not moving hediff(s) should fade, this is subtracted from the moving hediff's severity while the pawn is moving over the span of an hour

Example of a really basic hediff that applies hediffs based on movement:

    <HediffDef>
        <defName>EBSG_CheckingMovement</defName>
        <label>checking movement</label>
        <description>This hediff is looking for movement.</description>
        <hediffClass>HediffWithComps</hediffClass>
        <scenarioCanAdd>false</scenarioCanAdd>
        <maxSeverity>1.0</maxSeverity>
        <isBad>false</isBad>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_HediffWhileMoving">
                <hediffWhileMoving>EBSG_Moving</hediffWhileMoving> <!--No s, so it's alone-->
                <movingSeverityPerHour>1</movingSeverityPerHour> <!--When using this, you should probably have 1 be a really high severity to the hediff as the pawn won't be moving a lot, and making maxSeverity on the hediff in question too high will probably just complicate things-->
                <hediffsWhileNotMoving> <!--s, so it's list-->
                    <li>EBSG_Standing</li>
                </hediffsWhileNotMoving>
                <fadingHediffs>true</fadingHediffs> <!--Both hediffs are set to fading, but due to the not moving hediffs not having a fade per hour or a severity per hour, it deletes as normal.-->
                <movingSeverityFadePerHour>1</movingSeverityFadePerHour> <!--This should be treated similar to movingSeverityPerHour, just in reverse-->
                <initialNotMovingSeverity>2</initialNotMovingSeverity> <!--Not moving now starts at 2, but due to a lack of severity/hour, doesn't move-->
            </li>
        </comps>
    </HediffDef>

    <HediffDef>
        <defName>EBSG_Moving</defName>
        <label>we are moving!</label>
        <description>This hediff says we are moving right now.</description>
        <maxSeverity>2.0</maxSeverity>
    </HediffDef>

    <HediffDef>
        <defName>EBSG_Standing</defName>
        <label>we are standing</label>
        <description>This hediff says we are standing still.</description>
        <maxSeverity>2.0</maxSeverity>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️