Spawn Age Limiter - KonradHeinser/EBSGFramework GitHub Wiki

This gene class allows you to force pawns to have ages within a certain range when they spawn or gain this gene through any source, like a xenogerm or Gene Randomizer. It is important to note that there is no way to stop this from making the pawn become younger when added post spawn, so if that is a major concern consider taking a look at setting up special pawn kinds that have set age ranges instead of using this class.

All gene classes in this framework include this ability by default, but unlike the other genes in this framework, this cannot use the Hediff Adder extension stuff, so if you'd like to add hediffs as well, make sure you use that class. If you are not using any other gene class in this framework, then you will need to use this one, and regardless of the class used, you will need the EBSG extension:

        <geneClass>EBSGFramework.SpawnAgeLimiter</geneClass>

        <modExtensions>
	    <li Class="EBSGFramework.EBSGExtension">

	    </li>
	</modExtensions>

The extension has 4 options for setting up stuff, two ranges and 2 true/falses:

  • ageRange : This is the range that handles setting the age. If the pawn is outside of the expectedAges range, the gene picks an age from here. If this is not set to be greater than 0~0, all of the other options are ignored
  • expectedAges : This is the range the code uses to see if the pawn even needs to have their age changed. It is usually recommended to make this range 0 to the max value from ageRange
  • sameBioAndChrono : Default (False) : Sets the chronological age to be the same as biological if they are different. This will occur even if the biological age never changes
  • chronicAgeRemoval : Default (True) : Removes chronic hediffs when everything else is done

For an example, this is what ageless would look like if it were using this code from the beginning:

  <GeneDef>
    <defName>Ageless</defName>
    <label>ageless</label>
    <description>There was a description here.</description>
    <iconPath>UI/Icons/Genes/Gene_Ageless</iconPath>
    <displayCategory>Archite</displayCategory>
    <geneClass>EBSGFramework.SpawnAgeLimiter</geneClass>
    <biologicalAgeTickFactorFromAgeCurve>
      <points>
        <li>(13, 1)</li>
        <li>(18.5, 0)</li>
      </points>
    </biologicalAgeTickFactorFromAgeCurve>
    <biostatCpx>3</biostatCpx>
    <biostatArc>1</biostatArc>
    <symbolPack>
      <wholeNameSymbols>
        <li><symbol>immortal</symbol></li>
        <li><symbol>methuselah</symbol></li>
      </wholeNameSymbols>
      <prefixSymbols>
        <li><symbol>god</symbol></li>
        <li><symbol>deo</symbol></li>
        <li><symbol>deu</symbol></li>
        <li><symbol>methu</symbol></li>
      </prefixSymbols>
      <suffixSymbols>
        <li><symbol>god</symbol></li>
        <li><symbol>deus</symbol></li>
      </suffixSymbols>
    </symbolPack>
    <modExtensions>
      <li Class="EBSGFramework.EBSGExtension">
        <expectedAges>0~30</expectedAges>
        <ageRange>18~30</ageRange>
      </li>
    </modExtensions>
  </GeneDef>
⚠️ **GitHub.com Fallback** ⚠️