Body Addons - erdelf/AlienRaces GitHub Wiki

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

BodyAddons are used to render additional visible body parts on members of your race, such as distinctive ears, tails, horns, or other distinguishing features. This feature is an extension of the tail drawer in early versions of this framework.

BodyAddons are listed in the bodyAddons tag inside of alienPartGenerator.

<AlienRace.ThingDef_AlienRace>
  <alienRace>
    <generalSettings>
      <alienPartGenerator>
        <bodyAddons>
          <!-- Body addons are listed here -->
        </bodyAddons>
      </alienPartGenerator>
    </generalSettings>
  </alienRace>
</AlienRace.ThingDef_AlienRace>

You can create any number of BodyAddons simply by creating a <li> tag for each one:

<bodyAddons>
  <li>
    <!-- Settings for first BodyAddon -->
  </li>
  <li>
    <!-- Settings for second BodyAddon -->
  </li>
  <li>
    <!-- Settings for third BodyAddon, and so on... -->
  </li>
</bodyAddons>

Basic Settings

Texture Path (Required)

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

Sets the path to your BodyAddon's textures. 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. This is the only required field for a BodyAddon.

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 BodyAddons by using standard Graphic_Multi mask naming:

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

BodyAddons 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.

Rendering Conditions

RimWorld 1.5+ only - See Legacy Optional Settings below for options prior to RimWorld 1.5.

The following options should be placed inside a <conditions> tag inside of any body addons you wish to apply them to:

<bodyAddons>
  <li>
    <path>Path/To/Base/Texture</path>
    <conditions>
      <!-- Body Addon conditions here -->
    </conditions>
  </li>
</bodyAddons>
Condition Description
<BodyPart>
  <bodyPart>Alien_Tail</bodyPart>
  <drawWithoutPart>false</drawWithoutPart>
</BodyPart>

or

<BodyPart>
  <bodyPartLabel>left horn</bodyPartLabel>
  <drawWithoutPart>false</drawWithoutPart>
</BodyPart>
Draws this addon only if the specified body part exists and is not destroyed. drawWithoutPart defaults to false.
<RotStage>Fresh,Rotting,Dessicated</RotStage>
Draws this addon only for the specified rot stages. Fresh,Rotting replicates the old option for drawnDesiccated=false.
<Drafted>true</Drafted>
Draws this addon only for the specified drafted state. By default, draws for both states.
<Job>LayDown</Job>
Draws this addon only if the pawn is actively performing the specified JobDef.
<Moving>false</Moving>
Draws this addon only if the pawn is in the specified movement state. Draws for both by default.
<Apparel>
  <hiddenUnderApparelFor>
    <li>Head</li>
    <li>Torso</li>
    <li>Legs</li>
  </hiddenUnderApparelFor>
  <hiddenUnderApparelTag>
    <li>Warcasket</li>
  </hiddenUnderApparelTag>
</Apparel>
Hides this body addon if apparel is being worn that covers the specified body part groups or uses the specified apparel tags.
<ApparelDef>
  <apparel>Apparel_Tribalwear</apparel>
  <stuff>Leather_Human</stuff>
</ApparelDef>
Draws this body addon only if the specified apparel ThingDef is being worn, optionally also using the specified stuff ThingDef.
<Posture>
  <drawnStanding>false</drawnStanding>
  <drawnLaying>false</drawnLaying>
  <drawnInBed>false</drawnInBed>
</Posture>
Designates whether this body addon should be drawn for the specified postures. All are defaulted to false if this tag is used.

NOTE: Without a Posture tag, any body addon with alignWithHead set to true will be drawn in bed, and all other addons will not not be drawn in bed. All addons will be drawn standing and laying. Posture should only be used if you need to change the normal behavior.
<Damage>1.0</Damage>
Draws this body addon only if the linked body part's hit points are at or below the specified threshold. 1.0 designates a healthy body part, whereas 0.0 is a destroyed body part. Only functions if a BodyPart is specified.
<Age>HumanlikeAdult</Age>
Draws this body addon only if the pawn is at the specified LifeStageDef.
<Hediff>BionicSpine</Hediff>

of

<Hediff>
  <hediff>Burn</hediff>
  <severities>
    <li>5</li>
  </severities>
</Hediff>
Draws this body addon only if the specified HediffDef is present on the pawn. If one or more BodyPart fields are specified, then only the last one resolved will be checked for the specified Hediff.
<Backstory>AlienHulk</Backstory>
Draws this body addon only if the pawn has the specified BackstoryDef.
<Gender>Female</Gender>
Draws this body addon only if the pawn is of the specified gender.
<Trait>Psychopath</Trait>
Draws this body addon only if the pawn has the specified TraitDef.
<BodyType>Hulk</BodyType>
Draws this body addon only if the pawn has the specified BodyTypeDef.
<HeadType>Male_AverageNormal</HeadType>
Draws this body addon only if the pawn has the specified HeadTypeDef.
<Gene>Robust</Gene>
Biotech DLC only

Draws this body addon only if the pawn has the specified GeneDef.
<Race>MyAlienRace</Race>
Draws this body addon only if the pawn is of the specified race. Only functions for Universal Body Addons.
<Mutant>Shambler</Mutant>
Anomaly DLC only

Draws this body addon only if the pawn has the specified MutantDef.
<CreepJoinerFormKind>DarkScholar</CreepJoinerFormKind>
Anomaly DLC only

Draws this body addon only if the pawn has the specified CreepJoinerFormKindDef.

This system can also be used to specify "and" or "or" conditions:

<conditions>
  <BodyPart>
    <bodyPartLabel>tail</bodyPartLabel>
  </BodyPart>
  <Or>
    <ApparelDef>Apparel_PowerArmor</ApparelDef>
    <Moving>true</Moving>
  </Or>
</conditions>

Optional Settings

The following options should be placed directly inside the body addon li tag:

<bodyAddons>
  <li>
    <path>Path/To/Base/Texture</path>

    <!-- Body Addon options here -->

  </li>
</bodyAddons>
Setting Default Description
<userCustomizable>false</userCustomizable>
true RimWorld v1.4 and later

If set to false, then the specified BodyAddon will not be customizable by players at the Ideology styling station. This should generally only be used for BodyAddons that have no variants or color options and thus cannot be customized anyways.

<allowColorOverride>true</allowColorOverride>
false RimWorld v1.4 and later

If set to true, then players will be able to color this BodyAddon separately from the normal color channel assigned to this BodyAddon via the Ideology styling station. By default, players must change the color by changing the assigned color channel (which may be the skin, hair, or tattoo color if appropriate).

<inFrontOfBody>true</inFrontOfBody>
false If set to true, then attempts to render this BodyAddon in front of the body by default, and behind if the pawn is facing north.

Specifically, this will add 0.3 to the BodyAddon's y-axis offset while the pawn is facing south and subtract 0.3 while it is facing north.
<layerInvert>false</layerInvert>
true By default, the y-axis offset of BodyAddons is inverted when a pawn is facing north. If this is set to false, then the y-offset will not be inverted.
<layerOffset>0.02</layerOffset>
0.0 RimWorld v1.2 and earlier only

Allows for precise control of y-axis offset. Replaced by the offsets tag in RimWorld 1.3 and later.
<angle>20</angle>
0 Sets a rotational offset for this BodyAddon.

This value is measured in degrees and is applied directly to the South and West rotation of the pawn, and is mirrored for the East rotation. It is ignored for North rotations.
<alignWithHead>true</alignWithHead>
false If set to true, adds the head positional offset to the draw position of this BodyAddon. This adjusts to different head offset values.
<defaultOffset>Center</defaultOffset>
Center Sets the offset to use with this BodyAddon. Available options are Center (default), Head, and Tail.

Unlike alignWithHead, this value does not adjust to head offsets. If you use alignWithHead, leaving this on Center is recommended.
<drawSize>(1.25,0.8)</drawSize>
(1.0,1.0) Sets the default draw size of this BodyAddon in tile units.
<drawSizePortrait>
  (1.25,0.8)
</drawSizePortrait>
(0.0,0.0) Sets the draw size of this BodyAddon when drawn in a portrait, such as on the top colonist bar. If this value is set to the default value of Vector2.zero, then the regular drawSize will be used instead.
<drawRotated>false</drawRotated>
true By default, BodyAddons will use different textures for each pawn direction. If this is set to false, then the North graphic will be used for all directions.
<scaleWithPawnDrawsize>
  true
</scaleWithPawnDrawsize>
false If enabled, then the draw size of this BodyAddon is multiplied by your race's customDrawSize, customHeadDrawSize, customPortraitDrawSize, or customPortraitHeadDrawSize as appropriate.
<colorChannel>skin</colorChannel>
skin Sets the color channel that should be used for this BodyAddon. See General Settings for more information about color channels.
<linkVariantIndexWithPrevious>
  true
</linkVariantIndexWithPrevious>
false If enabled and this BodyAddon has one or more variant textures, then the exact variant used will be matched to the index of the BodyAddon that directly precedes this one in the bodyaddons list. This can be used to match variants on paired BodyAddons such as ears or horns.
<offsets>
  <south>
    <layerOffset>0.25</layerOffset>
    <offset>(0.42,-0.22)</offset>
    <bodyTypes>
      <Hulk>(0.48,-0.11)</Hulk>
      <Fat>(0.36,-0.18)</Fat>
    </bodyTypes>
    <crownTypes>
      <Average_Wide>(0.40,-0.21)</Average_Normal>
    </crownTypes>
    <portraitBodyTypes>
      <Hulk>(0.48,-0.11)</Hulk>
      <Fat>(0.36,-0.18)</Fat>
    </portraitBodyTypes>
    <portraitCrownTypes>
      <Average_Wide>(0.40,-0.21)</Average_Normal>
    </portraitCrownTypes>
  </south>
  <north>
    <!-- same structure repeated -->
  </north>
  <east>
    <!-- same structure repeated -->
  </east>
  <west>
    <!-- optional, mirrors east if omitted -->
  </west>
</offsets>
(See Desc.) Sets the draw position offsets for this BodyAddon based on pawn facing direction.

Each individual list is optional, the base offset (which itself defaults to Vector2.zero (0,0)) will be used for undefined values.

portraitBodyTypes and portraitCrownTypes are optional and should only be used if the alignment on portraits is off. If omitted, the regular bodyTypes and crownTypes or their defaults will be used instead.
<femaleOffsets>
  <!-- same options as above -->
</femaleOffsets>
(See Desc.) (Optional) Sets the draw position offsets for female pawns of your race.
<shaderType>Transparent</shaderType>
Cutout Sets the ShaderType for this BodyAddon. If a color mask is used for this BodyAddon, this value will be overridden with CutoutComplex.

RimWorld v1.3 and later: Due to the pawn atlas (render cache), this may not behave exactly as expected as it will determine the shader used to draw this BodyAddon to the atlas instead of to the actual world. As such, relying on it to use special ShaderTypes such as TransparentPostLight may not do what you want it to.

Legacy Optional Settings

RimWorld 1.4 and earlier - The following settings are no longer available in RimWorld 1.5+

Setting Default Description
<bodyPart>CustomBodyPart</bodyPart>

or

<bodyPartLabel>left ear</bodyPartLabel>
(None) If set, then this body addon is only shown if the specified body part exists in the pawn's body and is not missing. This is typically used to link addons to specific body parts such as ears or tails and if the body part is destroyed then the body addon is hidden as well. bodyPart is used to reference a BodyPartDef and bodyPartLabel is used to reference a label in the BodyDef; if both are specified, then a body part that matches both the BodyPartDef and the label must exist and be non-missing in order for this BodyAddon to render.
<drawWithoutPart>true</drawWithoutPart>
false If set to true, then this body addon will render even if it is linked to a body part that is missing. This is useful if you want to show specific alt textures for the MissingBodyPart hediff; see Extension Graphics for more information.
<geneRequirement>CustomGene</geneRequirement>
(None) Biotech DLC only

If set, shows this BodyAddon only on members of your race with the specified GeneDef.
<drawnOnGround>false</drawnOnGround>
true If disabled, then this BodyAddon will not be drawn while the pawn is prone, such as if it has been downed or knocked over by a large animal.
<drawnInBed>false</drawnInBed>
true If disabled, then this BodyAddon will not be drawn while the pawn is lying down in a bed that normally hides the body. Typically used for torso or lower body parts.

Does not apply in sleeping spots.
<drawnDesiccated>false</drawnDesiccated>
true If disabled, then this BodyAddon will not be drawn while the pawn's corpse is in a dessicated (skeletal) state.
<drawForMale>false</drawForMale>
true If disabled, then this BodyAddon will not be drawn for male pawns.
<drawForFemale>false</drawForFemale>
true If disabled, then this BodyAddon will not be drawn for female pawns.
<drawDrafted>false</drawDrafted>
true If disabled, then this BodyAddon will not be drawn for pawns that are drafted.
<drawUndrafted>false</drawUndrafted>
true If disabled, then this BodyAddon will not be drawn for pawns that are not drafted.
<jobs>
  <drawNoJob>false</drawNoJob>
  <jobs>
    <li>
      <job>LayDown</job>
      <drawPostures>
        <li><key>LayingInBed</key><value>true</value></li>
      </drawPostures>
      <drawMoving>false</drawMoving>
      <drawUnmoving>true</drawUnmoving>
    </li>
    <li>
      <job>Arrest</job>
      <drawMoving>true</drawMoving>
      <drawUnmoving>false</drawUnmoving>
    </li>
  </jobs>
</jobs>
(None) Allows you to specify whether this BodyAddon should be drawn when a pawn of your race is performing certain jobs.

If drawNoJob is disabled (default true), then this BodyAddon will not be drawn if the pawn has no current job.

If drawMoving is disabled (default true), then this BodyAddon will not be drawn if the pawn is performing a moving Toil for the specified job.

If drawUnmoving is disabled (default true), then this BodyAddon will not be drawn if the pawn is performing a non-moving Toil for the specified job.
<hediffGraphics>
  <ProstheticBodyPart>
    Path/To/Texture
  </ProstheticBodyPart>
  <BionicBodyPart>
    Path/To/Texture
  </BionicBodyPart>
  <Frostbite>
    <path>Path/To/Base/Texture</path>
    <severity>
      <a0.8>Path/To/Extreme/Texture</a0.8>
      <a0.5>Path/To/Major/Texture</a0.5>
      <a0.2>Path/To/Minor/Texture</a0.2>
    </severity>
  </Frostbite>
</hediffGraphics>
(None) Allows you to provide specific alternate textures for this BodyAddon if specific Hediffs are present. Typically used to provide alternate graphics for implants or bionics.

You can also specify a list if you want different textures based on hediff severity.

RimWorld 1.4 and later: This has been superseded by Extension Graphics.
<backstoryGraphics>
  <CustomBackstory>
    Path/To/Backstory/Texture
  </CustomBackstory>
  <AnotherCustomBackstory>
    Path/To/Backstory/Texture
  </AnotherCustomBackstory>
</backstoryGraphics>
(None) Allows you to provide specific alternate textures for this BodyAddon if the pawn has a specific backstory.

RimWorld 1.4 and later: This has been superseded by Extension Graphics.
<prioritization>
  <li>Hediff</li>
  <li>Backstory</li>
</prioritization>
Backstory Hediff By default, backstory overrides have priority over hediff-based overrides. You can use this to change that priority.

RimWorld 1.4 and later: This has been superseded by Extension Graphics.
<backstoryRequirement>
  CustomBackstory
</backstoryRequirement>
(None) If set, this BodyAddon will only be drawn if the pawn has the specified backstory.
<hiddenUnderApparelTag>
  <li>CustomApparelTag</li>
</hiddenUnderApparelTag>
<hiddenUnderApparelFor>
<li>FullHead</li>
<li>UpperHead</li>
</hiddenUnderApparelFor>
(None) Used to hide this BodyAddon if the pawn is wearing apparel with the specified apparelTags or that cover the specified BodyPartGroups.

Extension Graphics

In RimWorld 1.4 and later, Extension Graphics can be used on Body Addons. This is an expansion of the hediffGraphics system.

⚠️ **GitHub.com Fallback** ⚠️