Severity by Time of Day - KonradHeinser/EBSGFramework GitHub Wiki

This hediff comp sets the severity of the hediff based on how much of the day has been passed, from 0% to 100% (0.5, or 50% through the day, would be noon). The basic comp looks like this:

        <comps>
            <li Class="EBSGFramework.HediffCompProperties_SeverityByTimeOfDay">
                <timeToSeverityCurve>
                    <points>
                        <li>(0, 0.01)</li>
                        <li>(1, 1)</li>
                    </points>
                </timeToSeverityCurve>
            </li>
        </comps>

The right side of the points are the severity that the hediff is set to based on the results of the left side, and any number of points can be added. For example, if it's just after midnight, then the above code would give a severity of just over 0.01.


This simplistic example just makes a hediff display in the health tab whenever it is day time(ish)

    <HediffDef>
        <defName>IsItDay</defName>
        <label>is it day</label>
        <description>Is it?</description>
        <everCurableByItem>false</everCurableByItem>
        <initialSeverity>1</initialSeverity>
        <hediffClass>HediffWithComps</hediffClass>
        <scenarioCanAdd>false</scenarioCanAdd>
        <maxSeverity>1.0</maxSeverity>
        <stages>
            <li>
                <becomeVisible>false</becomeVisible>
            </li>
            <li>
                <minSeverity>1</minSeverity>
                <label>daytime</label>
            </li>
        </stages>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_SeverityByTimeOfDay">
                <timeToSeverityCurve>
                    <points>
                        <li>(0, 0.9)</li>
                        <li>(0.35, 1)</li>
                        <li>(0.65, 1)</li>
                        <li>(1, 0.9)</li>
                    </points>
                </timeToSeverityCurve>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️