Extension Graphics - erdelf/AlienRaces GitHub Wiki

(This is a sub-page of General Settings.)

RimWorld / Alien Races 1.4 Only - This feature is not availble for RimWorld 1.3 and earlier.

Extension Graphics are an expansion of the old hediffGraphics alternate textures for Body Addons that uses a tree structure to specify a large variety of potential alternate graphics.

Basic Layout

The primary use of Extension Graphics are in Body Addons, where they replace the aforementioned hediffGraphics options:

<AlienRace.ThingDef_AlienRace>
  <alienRace>
    <generalSettings>
      <alienPartGenerator>
        <bodyAddons>
          <li>
            <path>Path/To/Base/Texture</path>
            <!-- Extension Graphics settings here -->
          </li>
        </bodyAddons>
      </alienPartGenerator>
    </generalSettings>
  </alienRace>
</AlienRace.ThingDef_AlienRace>

Extension Graphics can also be used instead of simple path strings in Graphic Paths fields:

<AlienRace.ThingDef_AlienRace>
  <alienRace>
    <graphicPaths>
      <body>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </body>
      <bodyMasks>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </bodyMasks>
      <head>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </head>
      <headMasks>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </headMasks>
      <skeleton>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </skeleton>
      <skull>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </skull>
      <stump>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </stump>
      <swaddle>
        <path>Base/Texture/Path</path>
        <!-- Extension Graphics settings here -->
      </swaddle>
    </graphicPaths>
  </alienRace>
</AlienRace.ThingDef_AlienRace>

Note that if using Extension Graphics, paths specified in Graphics Paths must be file paths instead of folder paths. (i.e. Path/To/Folder/SpecificHead instead of Path/To/Folder/) Prefixes will not automatically be added for head or body graphics either. (i.e. Path/To/Folder/Naked_CustomAlienBody instead of just Path/To/Folder/CustomAlienBody)

Base Settings

The following settings are only available on the root-level tag:

Setting Default Description
<debug>true</debug>
true Enables debugging for the specified node. If enabled, will log various bits of data such as how many variants are loaded.
<linkVariantIndexWithPrevious>
  true
</linkVariantIndexWithPrevious>
false If enabled and this node has one or more variant textures, then the exact variant used will be matched to the index of the node that directly precedes this one in the list. This can be used to match variants on paired nodes such as ear or horn BodyAddons.

For Body Addons, this is resolved in the order of the list entries. For Graphics Paths, this is resolved in the following order:

body > bodyMasks > skeleton > head > headMasks > skull > stump > swaddle

<drawSize>(1.0,1.0)</drawSize>
(1.0,1.0) Sets the draw size of this graphic in tile units.
<drawSizePortrait>(0.0,0.0)</drawSizePortrait>
(0.0,0.0) Sets the draw size of this graphic when used in portraits. By default or if set to (0,0), the default drawSize is used.

Texture Path

Each of the following options can be specified in a similar fashion to Body Addons. Note that texture paths are not strictly required for Extension Graphics as if a path is not specified for a node, then it will automatically fall back to the level above it and continue searching for valid graphics.

<path>Path/To/Texture/MyBodyAddon</path>

This uses the Graphic_Multi loader, meaning that textures are directional and the loader will look for files with _north, _south, _east, and _west, though if you omit _west, then the _east texture will automatically be mirrored.

You can also add variant textures for your BodyAddons simply by appending numbers to additional variants:

MyBodyAddon_north.png
MyBodyAddon1_north.png
MyBodyAddon2_north.png
MyBodyAddon3_north.png
etc.

Color masks can also be used for by using standard Graphic_Multi mask naming:

MyBodyAddon_northm.png
MyBodyAddon1_northm.png
MyBodyAddon2_northm.png
MyBodyAddon3_northm.png
etc.

All Extension Graphics support both single and dual color masks, using red (#FF0000) for the first color in the channel, green (#00FF00) for the second color in the channel, and black (#000000) for no color.

Nested Settings

RimWorld 1.5+ only - for Extension Graphics syntax in RimWorld 1.4, see Legacy Nested Settings below.

The following settings are all optional and can be used either inside the extendedGraphics node or nested at any node under that level:

<bodyAddons>
  <li>
    <path>Path/To/Base/Texture</path>
    <extendedGraphics>
      <!-- Nested settings go here -->
    <extendedGraphics>
  </li>
</bodyAddons>

or

<bodyAddons>
  <li>
    <path>Path/To/Base/Texture</path>
    <extendedGraphics>
      <BodyType For="Hulk">
        <path>Path/To/Hulk/Textures</path>
        <extendedGraphics>
          <!-- Further nested settings go here -->
        </extendedGraphics>
      </BodyType>
    <extendedGraphics>
  </li>
</bodyAddons>
Setting Description
<Hediff For="BionicTail">Path/To/Texture</Hediff>

or

<Hediff For="BionicTail">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Hediff>
Use this alternate graphic if the specified HediffDef is detected on the pawn. If a bodyPart is specified on the root node, then the specified Hediff must be on the linked body part for this to activate.

Note: If being used for a missing body part, this needs to be in the first level of nested graphics.

<Hediff For="AlcoholHigh">
  <path>...</path>
  <Severity For="0.5">Path/To/Alternate/Texture</Severity>
</Hediff>

or

<Hediff For="AlcoholHigh">
  <path>...</path>
  <Severity For="0.5">
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </Severity>
</Hediff>
Use this alternate graphic if a parent hediff is at or above the specified severity. Only works when nested inside a Hediff graphic.
<Gender For="Female">Path/To/Alternate/Texture</Gender>

or

<Gender For="Female">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Gender>
If the pawn matches the specified Gender, then this alternate graphic will be used.
<BodyType For="Hulk">Path/To/Alternate/Texture</BodyType>

or

<BodyType For="Hulk">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</BodyType>
If the pawn has the specified BodyTypeDef, then this alternate graphic will be used.
<HeadType For="Male_AverageNormal">Path/To/Alternate/Texture</HeadType>

or

<HeadType For="Male_AverageNormal">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</HeadType>
If the pawn has the specified HeadTypeDef, then this alternate graphic will be used.
<Backstory For="AlienMutant">Path/To/Alternate/Texture</Backstory>

or

<Backstory For="AlienMutant">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Backstory>
If the pawn has the specified BackstoryDef, then this alternate graphic will be used. Note that this can be any BackstoryDef, not just ones created using Alien Races.
<Trait For="Beautiful">Path/To/Alternate/Texture</Trait>

or

<Trait For="Beautiful">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Trait>
If the pawn has the specified Trait, then this alternate graphic will be used. This can be the defName of a TraitDef or the label of a Trait's degreeData for spectrum traits.
<Age For="HumanlikeChild">Path/To/Alternate/Texture</Age>

or

<Age For="HumanlikeChild">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Age>
If the pawn is currently at the specified LifeStageDef, then this alternate graphic will be used.
<Damage For="0.5">Path/To/Alternate/Texture</Damage>
If the pawn's bodyPart is at or below the specified hit point level, then this alternate graphic will be used. This alternate requires that a bodyPart be set on the root tag to work, and should be in ascending order.
<Need>
  <need>Food</need>
  <level>0.5</level>
  <percentage>true</percentage>
</Need>
If the pawn's Need is at or above the specified level, then this alternate graphic will be used.
<Mood>ABOUT_TO_BREAK, ON_EDGE, STRESSED, BAD, NEUTRAL, CONTENT, HAPPY</Mood>
If the pawn's Mood is at one of the specified levels, then this alternate graphic will be used. The example shows all possible values. BAD is a shorthand for the first three.
<Race For="MyAlienRace">Path/To/Alternate/Texture</Race>

or

<Race For="MyAlienRace">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Race>
If the pawn is of the specified race, then this alternate texture will be used. Useful for Universal Body Addons.
<Gene For="Robust">Path/To/Alternate/Texture</Gene>

or

<Gene For="Robust">
  <path>Path/To/Alternate/Texture</path>
  <!-- nested settings can go here -->
</Gene>
Biotech DLC only

If the pawn has the specified gene, then this alternate graphic will be used.

Prioritization is now implied instead of explicit; all nested settings are checked in the order they are listed and the first one to resolve correctly will be used.

Example

All of the above settings can be tested to create entire trees of alternate textures.

For example, the following BodyAddon might be used for a race with chicken-like tails:

<bodyAddons>
  <li>
    <path>ChickenRace/Pawn/Tail/DefaultTail</path>
    <bodyPart>Tail</bodyPart>

    <Gender For="Male">
      <path>ChickenRace/Pawn/Tail/RoosterTail</path>
      <Body For="Hulk">
        <path>ChickenRace/Pawn/Tail/GiantRoosterTail</path>
        <Hediff For="ToxicBuildup">ChickenRace/Pawn/Tail/GiantIrradiatedRoosterTail</Hediff>
        <Hediff For="GoJuice">ChickenRace/Pawn/Tail/GiantSuperRoosterTail</Hediff>
      </Body>
    </Gender>
    <Gender For="Female">
      <path>ChickenRace/Pawn/Tail/HenTail</path>
      <Body For="Thin">ChickenRace/Pawn/Tail/SkinnyHenTail</Body>
      <Trait For="Beautiful">ChickenRace/Pawn/Tail/GorgeousHenTail</Trait>
    </Gender>
  </li>
</bodyAddons>

Legacy Nested Settings

RimWorld 1.4 and earlier only - Unlike modern settings, legacy extension graphics were placed directly inside the main tag:

<AlienRace.ThingDef_AlienRace>
  <alienRace>
    <generalSettings>
      <alienPartGenerator>
        <bodyAddons>
          <li>
            <path>Path/To/Base/Texture</path>
            <!-- Legacy nested graphics settings here -->
          </li>
        </bodyAddons>
      </alienPartGenerator>
    </generalSettings>
  </alienRace>
</AlienRace.ThingDef_AlienRace>
Setting Description
<hediffGraphics>
  <MyHediffDefName>Path/To/Alternate/Texture</MyHediffDefName>
</hediffGraphics>

or

<hediffGraphics>
  <MyHediffDefName>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </MyHediffDefName>
</hediffGraphics>
Use this alternate graphic if the specified HediffDef is detected on the pawn. If a bodyPart is specified on the root node, then the specified Hediff must be on the linked body part for this to activate.

Note: if being used for a missing body part hediff, this needs to be in the first level of subgraphics under the root level

<hediffGraphics>
  <MyHediffDefName>
    <path>Path/To/Alternate/Texture</path>
    <severity>
      <a0.50>Path/To/Alternate/Severity/Texture</a0.50>
      <a0.25>
        <path>Path/To/Another/Alternate/Severity/Texture</path>
        <!-- nested settings can go here -->
      </a0.25>
    </severity>
  </MyHediffDefName>
</hediffGraphics>
An additional severity field can be used to specify additional alternate textures based on the severity of the specified HediffDef. This can only be used as a subgraphic underneath a hediffGraphics. A specific alternate texture will be used if the severity of the Hediff is at or above the specified severity. It should be in descending order.

Note: The first character of the severity value tag must be a letter and will be discarded. This is due to XML tag name rules.

<genderGraphics>
  <Female>Path/To/Alternate/Texture</Female>
</genderGraphics>

or

<genderGraphics>
  <Female>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </Female>
</genderGraphics>
If the pawn matches the specified Gender, then this alternate graphic will be used.
<bodytypeGraphics>
  <Hulk>Path/To/Alternate/Texture</Hulk>
</bodytypeGraphics>

or

<bodytypeGraphics>
  <Hulk>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </Hulk>
</bodytypeGraphics>
If the pawn has the specified BodyTypeDef, then this alternate graphic will be used.
<headtypeGraphics>
  <Male_AverageNormal>Path/To/Alternate/Texture</Male_AverageNormal>
</headtypeGraphics>

or

<headtypeGraphics>
  <Male_AverageNormal>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </Male_AverageNormal>
</headtypeGraphics>
If the pawn has the specified HeadTypeDef, then this alternate graphic will be used.
<backstoryGraphics>
  <MyCustomBackstoryDefName>Path/To/Alternate/Texture</MyCustomBackstoryDefName>
</backstoryGraphics>

or

<backstoryGraphics>
  <MyCustomBackstoryDefName>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </MyCustomBackstoryDefName>
</backstoryGraphics>
If the pawn has the specified BackstoryDef, then this alternate graphic will be used. Note that this can be any BackstoryDef, not just ones created using Alien Races.
<traitGraphics>
  <Beautiful>Path/To/Alternate/Texture</Beautiful>
</traitGraphics>

or

<traitGraphics>
  <Beautiful>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </Beautiful>
</traitGraphics>
If the pawn has the specified Trait, then this alternate graphic will be used. This can be the defName of a TraitDef or the label of a Trait's degreeData for spectrum traits.
<ageGraphics>
  <HumanlikeAdult>Path/To/Alternate/Texture</HumanlikeAdult>
</ageGraphics>

or

<ageGraphics>
  <HumanlikeAdult>
    <path>Path/To/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </HumanlikeAdult>
</ageGraphics>
If the pawn is currently at the specified LifeStageDef, then this alternate graphic will be used.
<damageGraphics>
  <a5>Path/To/Alternate/Texture</a5>
  <a10>
    <path>Path/To/Another/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </a10>
</damageGraphics>
If the pawn's bodyPart is at or below the specified hit point level, then this alternate graphic will be used. This alternate requires that a bodyPart be set on the root tag to work, and should be in ascending order.

Note: The first character of the severity value tag must be a letter and will be discarded. This is due to XML tag name rules.

<geneGraphics>
  <CustomGene>Path/To/Alternate/Texture</CustomGene>
  <AnotherCustomGene>
    <path>Path/To/Another/Alternate/Texture</path>
    <!-- nested settings can go here -->
  </AnotherCustomGene>
</geneGraphics>
Biotech DLC only

If the pawn has the specified gene, then this alternate graphic will be used.
<prioritization>
  <li>Severity</li>
  <li>Hediff</li>
  <li>Gender</li>
  <li>Bodytype</li>
  <li>Headtype</li>
  <li>Backstory</li>
  <li>Trait</li>
  <li>Age</li>
  <li>Damage</li>
  <li>Gene</li>
</prioritization>
If specified, overrides the order in which alternate graphics nodes are checked. The order listed in the example is the default order, and overriding the priority in a node does not alter the prioritization of any nested child nodes.

Note: if an alternate graphic type is omitted from the list, then it will not be checked at all.

Example

All of the above settings can be tested to create entire trees of alternate textures.

For example, the following BodyAddon might be used for a race with chicken-like tails:

<bodyAddons>
  <li>
    <path>ChickenRace/Pawn/Tail/DefaultTail</path>
    <bodyPart>Tail</bodyPart>

    <genderGraphics>
      <Male>
        <path>ChickenRace/Pawn/Tail/RoosterTail</path>
        <bodytypeGraphics>
          <Hulk>
            <path>ChickenRace/Pawn/Tail/GiantRoosterTail</path>
            <hediffGraphics>
              <ToxicBuildup>ChickenRace/Pawn/Tail/GiantIrradiatedRoosterTail</ToxicBuildup>
              <GoJuice>ChickenRace/Pawn/Tail/GiantSuperRoosterTail</GoJuice>
            </hediffGraphics>
          </Hulk>
        </bodytypeGraphics>
      </Male>
      <Female>
        <path>ChickenRace/Pawn/Tail/HenTail</path>
        <bodytypeGraphics>
          <Thin>ChickenRace/Pawn/Tail/SkinnyHenTail</Thin>
        </bodytypeGraphics>
        <traitGraphics>
          <Beautiful>ChickenRace/Pawn/Tail/GorgeousHenTail</Beautiful>
        </traitGraphics>
      </Female>
    </genderGraphics>
  </li>
</bodyAddons>

Legacy Example

Here is an example for RimWorld 1.4:

<bodyAddons>
  <li>
    <path>ChickenRace/Pawn/Tail/DefaultTail</path>
    <bodyPart>Tail</bodyPart>

    <genderGraphics>
      <Male>
        <path>ChickenRace/Pawn/Tail/RoosterTail</path>
        <bodytypeGraphics>
          <Hulk>
            <path>ChickenRace/Pawn/Tail/GiantRoosterTail</path>
            <hediffGraphics>
              <ToxicBuildup>ChickenRace/Pawn/Tail/GiantIrradiatedRoosterTail</ToxicBuildup>
              <GoJuice>ChickenRace/Pawn/Tail/GiantSuperRoosterTail</GoJuice>
            </hediffGraphics>
          </Hulk>
        </bodytypeGraphics>
      </Male>
      <Female>
        <path>ChickenRace/Pawn/Tail/HenTail</path>
        <bodytypeGraphics>
          <Thin>ChickenRace/Pawn/Tail/SkinnyHenTail</Thin>
        </bodytypeGraphics>
        <traitGraphics>
          <Beautiful>ChickenRace/Pawn/Tail/GorgeousHenTail</Beautiful>
        </traitGraphics>
      </Female>
    </genderGraphics>
  </li>
</bodyAddons>
⚠️ **GitHub.com Fallback** ⚠️