Severity by Age - KonradHeinser/EBSGFramework GitHub Wiki
This hediff comp sets the severity of the hediff based on the current biological age of the pawn. By default, the hediff comp normalizes the ages, so if multiple pawns are halfway through their expected life, even if that expectation is different they will all get the same values. Due to the nature of this comp and how it handles things, this page is heavier on examples than normal. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByAge">
</li>
</comps>
The options available are these:
- divideByLifespanFactor : Default (True) : If the pawn is a humanlike pawn, then the severity is divided by the lifespan factor
- accountForLifeExpectancyDifference : Default (True) : Multiplies the severity by 80 / Life Expectancy. For example, raccoons have a lifespan of 8, so this would cause the severity to be multiplied by 10 for them
- includeMechanoidLifeExpectancy : Default (True) : If this is false, then mechanoids will ignore accountForLifeExpectancyDifference. This is a separate option because their life expectancy is in the thousands, which may lead to unexpected results. If left true, test thoroughly
- additionalFactor : Default (0.1) : Additional multiplier that takes effect after all the others. This is set to 0.1 by default, which would cause a 40 year old's severity to become 4, assuming no other changes are in effect
For these examples, I'm going to have to set a bit of a scene to help with understanding the different effects. For this example, all 3 pawns are exactly halfway through their life, and the additional factor is never changed from its 0.1 default value
- A 4 year old raccoon with an 8 year life expectancy
- A 40 year old human with an 80 year life expectancy and a lifespan factor of 1
- An 80 year old human with an 80 year life expectancy and a lifespan factor of 2
The most basic example with all default active will give a severity of 4 for all 3 pawns:
<HediffDef ParentName="EBSG_TestHediffBase">
<defName>SeverityByAge</defName>
<label>severity by age</label>
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByAge" />
</comps>
</HediffDef>
The dark math:
- Raccoon : 4 / 1 * (80 / 8) * 0.1 = 4 / 1 * 10 * 0.1 = 4
- Human 1 : 40 / 1 * (80 / 80) * 0.1 = 40 / 1 * 1 * 0.1 = 4
- Human 2 : 80 / 2 * (80 / 80) * 0.1 = 80 / 2 * 1 * 0.1 = 4
This example removes the lifespan factor from the equation, which can't impact the raccoon because it's an animal, so is always had a lifespan factor of 1. The end result is that both the raccoon and human 1 still have a severity of 4, but human 2 suddenly has a severity of 8:
<HediffDef ParentName="EBSG_TestHediffBase">
<defName>SeverityByAgeIgnoreLifespanFactor</defName>
<label>severity by age (ignore lifespan factor)</label>
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByAge">
<divideByLifespanFactor>False</divideByLifespanFactor>
</li>
</comps>
</HediffDef>
The cruel math:
- Raccoon : 4 * (80 / 8) * 0.1 = 4 * 10 * 0.1 = 4
- Human 1 : 40 * (80 / 80) * 0.1 = 40 * 1 * 0.1 = 4
- Human 2 : 80 * (80 / 80) * 0.1 = 80 * 1 * 0.1 = 8
For this example, we're removing life expectancy instead of lifespan factor, which means that the humans won't be affected, but because the raccoon had a large increase from its low lifespan, its severity is only 0.4:
<HediffDef ParentName="EBSG_TestHediffBase">
<defName>SeverityByAgeIgnoreLifeExpectancy</defName>
<label>severity by age (ignore life expectancy)</label>
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByAge">
<accountForLifeExpectencyDifference>False</accountForLifeExpectencyDifference>
</li>
</comps>
</HediffDef>
The evil math:
- Raccoon : 4 / 1 * 0.1 = 0.4
- Human 1 : 40 / 1 * 0.1 = 4
- Human 2 : 80 / 2 * 0.1 = 4
And for the final example, full chaos with no normalization keeping things in check. This results in severities of 0.4, 4, and 8 respectively:
<HediffDef ParentName="EBSG_TestHediffBase">
<defName>SeverityByAgeIgnoreLifeExpectancy</defName>
<label>severity by age (ignore life expectancy)</label>
<comps>
<li Class="EBSGFramework.HediffCompProperties_SeverityByAge">
<divideByLifespanFactor>False</divideByLifespanFactor>
<accountForLifeExpectencyDifference>False</accountForLifeExpectencyDifference>
</li>
</comps>
</HediffDef>
The boring math:
- Raccoon : 4 * 0.1 = 0.4
- Human 1 : 40 * 0.1 = 4
- Human 2 : 80 * 0.1 = 8