Severity by Mental State - KonradHeinser/EBSGFramework GitHub Wiki

This hediff comp allows you to cause mental breaks to set the severity of the hediff, along with severity setters for being drafted or in combat. This will not work with any comp that sets or changes the hediff's severity. To set up the comp itself you'll need like this:

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

This comp has the following nodes available to it. Note that you probably shouldn't set any of the severities to 0 unless you want the hediff to disappear when the condition is met:

  • defaultSeverity : Default (1) : If the pawn is not drafted, in combat, or experiencing any of the listed mental states, this is the severity used
  • fightingSeverity : Default (2) : If the pawn is targeting a hostile and not experiencing any of the listed mental states, this is the severity used
  • draftedSeverity : Default (2) : If the pawn is drafted, not in combat, and not experiencing any of the listed mental states, this is the severity used. This can be set to the same severity as defaultSeverity or fightingSeverity to cause it to have the same effect as those
  • mentalStateEffects : A list of mental state defNames and the severity to use when under that state. Each li within this node can have these things:
    • mentalState : The mental state defName. If this and mentalStates are empty, then as soon as the code reaches this point it will set the hediff severity to the below value as long as the pawn is in any mental state
    • mentalStates : A list of mental state defNames
    • mentalSeverity : Default (3) : If the pawn is in the required mental state, this is the severity used. Any number of mental states can be linked to the same severity, but each one must be listed individually

Generic example of a hediff that has all the violent mental breaks assign a severity of 3, and a couple fire related mental breaks as a bonus demonstration. The parent just contains some generic stuff that tells the hediff it's a test hediff:

    <HediffDef ParentName="EBSG_TestHediffBase">
        <defName>MentalStateEffects</defName>
        <label>mental state effects</label>
        <maxSeverity>4.0</maxSeverity>
        <stages>
            <li>
                <minSeverity>1</minSeverity>
                <label>calm</label>
            </li>
            <li>
                <minSeverity>2</minSeverity>
                <label>fighting</label>
            </li>
            <li>
                <minSeverity>3</minSeverity>
                <label>destructive rage</label>
            </li>
            <li>
                <minSeverity>4</minSeverity>
                <label>fire stuff</label>
            </li>
        </stages>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_SeverityByMentalState">
                <fightingSeverity>2</fightingSeverity> <!--Technically not needed, but it's here as an example-->
                <mentalStateEffects>
                    <li>
                        <mentalStates>
                            <li>Berserk</li>
                            <li>Slaughterer</li>
                            <li>MurderousRage</li>
                            <li>Tantrum</li>
                            <li>TargetedTantrum</li>
                            <li>BedroomTantrum</li>
                            <li>SadisticRage</li>
                            <li>SocialFighting</li>
                        </mentalStates>
                    </li>
                    <li MayRequire="Ludeon.Rimworld.Ideology">
                        <mentalState>BerserkTrance</mentalState>
                    </li>
                    <li MayRequire="Ludeon.Rimworld.Ideology">
                        <mentalState>Rebellion</mentalState>
                    </li>
                    <li>
                        <mentalState>FireStartingSpree</mentalState>
                        <mentalSeverity>4</mentalSeverity>
                    </li>
                    <li MayRequire="Ludeon.Rimworld.Biotech">
                        <mentalState>PanicFleeFire</mentalState>
                        <mentalSeverity>4</mentalSeverity>
                    </li>
                </mentalStateEffects>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️