Severity Per Interval By Terrain - KonradHeinser/EBSGFramework GitHub Wiki

This comp is an expanded version of vanilla's HediffCompProperties_Pollution that can check the type of terrain the pawn is standing on in addition to being able to check if it's polluted. The basic comp looks like this:

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

These are the options available in the comp:

  • interval : Default (60) : How often the check and severity change occur. Keep in mind that a lower interval causes more checks, and thus a greater performance impact, so it is generally better to increase the severity change instead of lowering the interval if you want to increase the rate
  • severityOnValid : Default (0) : The amount to add to the severity by if the pawn is standing on valid terrain at the interval. If this is left at 0, standing on valid terrain will have no impact
  • severityOnInvalid : Default (0) : The amount to add to the severity by if the pawn is not standing on valid terrain at the interval. If this is left at 0, standing on invalid terrain will have no impact. If the pawn is not spawned (i.e. in a caravan) then this is used every interval
  • pollution : Default (Ignore) : Determines if the terrain should be checked for pollution. If set to Polluted, then the terrain must be polluted to be valid, and if set to Clean the terrain must be unpolluted to be valid. If Biotech is not enabled, this will do nothing
  • validTerrains : A list of TerrainDefs to check for. If both this and validTerrainTags are in use, only one of them need to be met for the terrain to be valid
  • validTerrainTags : A list of terrain tags to check the terrain for to see if it is valid. If both this and validTerrains are in use, only one of them need to be met for the terrain to be valid

This example increases in severity while the pawn is standing in any type of water or on soil. If the pawn is standing on a terrain of those types, the severity is increased by 0.01 per second, otherwise it decreases by the same amount. Because Soil is in the validTerrains instead of validTerrainTags, only standard soil is counted, while rich soil, stony soil, etc are considered invalid:

    <HediffDef>
        <defName>SoilAndWater</defName>
        <label>soil and water</label>
        <description>.</description>
        <everCurableByItem>false</everCurableByItem>
        <initialSeverity>0.001</initialSeverity>
        <minSeverity>0.001</minSeverity>
        <stages />
        <hediffClass>HediffWithComps</hediffClass>
        <scenarioCanAdd>false</scenarioCanAdd>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_SeverityPerIntervalByTerrain">
                <validTerrains>
                    <li>Soil</li>
                </validTerrains>
                <validTerrainTags>
                    <li>Water</li>
                </validTerrainTags>
                <severityOnValid>0.01</severityOnValid>
                <severityOnInvalid>-0.01</severityOnInvalid>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️