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. If set to -1 while addSeverityPerHour is False, then there will no longer be a default severity, causing effects to stick around
  • fightingSeverity : Default (2) : If the pawn is targeting a hostile and not experiencing any of the listed mental states, this is the severity used. If set to -1 while addSeverityPerHour is False, then being fighting no longer changes severity
  • 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. If set to -1 while addSeverityPerHour is False, then being drafted no longer changes severity
  • addSeverityPerHour : Default (False) : When True, defaultSeverity, fightingSeverity, and draftedSeverity will gradually increment the hediff's severity instead of replacing it
  • 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. If set to -1 while addSeverityPerHour is False, then instead of changing the severity, the mental state(s) will cause drafted, fighting, or default severity to be active
      • If you want the effect to result in the severity remaining the same instead of causing one of the basic severities to be used, set addSeverityPerHour to True and set the severity to 0
      • Setting them to -1 is only useful if you have an effect which is supposed to activate for every mental state except certain ones. Those exclusions can be added to the first effect while the last effect doesn't specify any mental states so it activates for all the others
    • addSeverityPerHour : Default (False) : When True, mentalSeverity will gradually increment the hediff's severity instead of replacing it

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** ⚠️