Severity by Need Level - KonradHeinser/EBSGFramework GitHub Wiki

This comp sets the severity of the parent based on the current level of the need:

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

These are the options available:

  • need : The NeedDef to look for
  • usePercentage : Default (False) : When False, the current level is used, while if true, the current level's percentage is used. This is mostly useful for needs which may have variable maximums (i.e. food), but the desired effect should be based on a specific point on the bar regardless
  • severity : A simple curve that determines what severity to assign to the hediff based on the level. Each li in the curve has the level as the first value, and the severity as the second

This example makes it so the pawn loses work speed based on their mood level, with no notable effect when above 70% before eventually reaching the full 50% effect at 0% mood:

    <HediffDef>
        <defName>DistractingSorrow</defName>
        <label>distracting sorrow</label>
        <description>.</description>
        <everCurableByItem>false</everCurableByItem>
        <initialSeverity>0.001</initialSeverity>
        <stages />
        <hediffClass>HediffWithComps</hediffClass>
        <scenarioCanAdd>false</scenarioCanAdd>
        <stages>
            <li>
                <statFactors>
                    <WorkSpeedGlobal>0.5</WorkSpeedGlobal>
                </statFactors>
                <multiplyStatChangesBySeverity>true</multiplyStatChangesBySeverity>
            </li>
        </stages>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_SeverityByNeedLevel">
                <need>Mood</need>
                <severity>
                    <points>
                        <li>(0,1)</li>
                        <li>(0.2,0.6)</li>
                        <li>(0.5,0.3)</li>
                        <li>(0.7,0.001)</li>
                    </points>
                </severity>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️