Skip to content

PawnKindGeneExtension

Jecrell edited this page Oct 28, 2022 · 12 revisions

As of JecsTools 1.4.1.0 (10/27/22), modders can now give PawnKindDefs random chances for genetics using JecsTools.PawnKindGeneExtension on PawnKindDefs under modExtensions

This extension is a list of genes with three variables:

  • defName the name of the GeneDef to be given to the PawnKind
  • chance a number between 1 and 100 representing the % chance of a gene being given. If not used but a def is given, the chance defaults to 100%.
  • xenogene a true/false that determines if a gene is a xenogene (true) or endogene (false, default). Endogenes can be inherited by pawns from their parents and given to their offspring while xenogenes cannot and must be implanted on other pawns during gameplay if desired.

In the XML snippet below, all PawnKindDefs that share the TownsFolkBase name tag are given a 15% chance to have a custom GeneDef ROM_InnsmouthLook_Jaw (Innsmouth Look Jaws):

<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <PawnKindDef Name="TownsfolkBase" Abstract="True">
    ...
    <modExtensions>
      <li Class="JecsTools.PawnKindGeneExtension">
        <genes>
          <li>
            <defName>ROM_InnsmouthLook_Jaw</defName>
            <chance>15</chance>
            <xenogene>false</xenogene>
          </li>
        </genes>
      </li>
    </modExtensions>
    ...