Custom Body Graphic For Apparel - SmArtKar/AthenaFramework GitHub Wiki
CompProperties_CustomApparelBody allows worn apparel to change wearer's body and head textures. Bodygear can also be set to ignore the wearer's bodytype similarly to headgear. Using forcedBodytype you could also make all apparel on the pawn use a certain bodytype instead of the pawn's original bodytype. You can make the body or head completely invisible by just using an empty graphic data or graphic data with 0% opacity.
public class CompProperties_CustomApparelBody : CompProperties
{
// If bodygear should ignore bodytype in their texture paths similarly to headgear.
public bool preventBodytype = false;
// If set to a certain bodytype it will force that bodytype onto all apparel that user is wearing. Overrides bodytypePairs
public BodyTypeDef forcedBodytype;
// Same as forcedBodytype, but for the head
public HeadTypeDef forcedHeadtype;
// If the comp should hide the owner's body
public bool hideBody = false;
// If the comp should hide the owner's head
public bool hideHead = false;
// If the comp should hide the owner's fur
public bool hideFur = false;
// If the comp should hide the owner's hair
public bool hideHair = false;
// List of bodytype pairs that will be swapped. Allows to do stuff like making all fatties into hulks and thins into normals
public List<BodytypeSwitch> bodytypePairs;
// Same as bodytypePairs but for heads
public List<HeadtypeSwitch> headtypePairs;
}By using bodytypePairs you can selectively change certain bodytypes for cases when you only want certain bodytype sprites for your apparel but don't want to lock it all to one.
Same can be done for headtypes using headtypePairs.
public struct BodytypeSwitch
{
// Bodytype that will be switched
public BodyTypeDef initialBodytype;
// What bodytype are we switching to
public BodyTypeDef newBodytype;
}
public struct HeadtypeSwitch
{
// Headtype that will be switched
public HeadTypeDef initialHeadtype;
// What headtype are we switching to
public HeadTypeDef newHeadtype;
}Here's an example of a modified vanilla mechlord suit that always has a hulk bodytype texture
<ThingDef ParentName="ApparelArmorPowerBase">
<defName>Apparel_MechlordSuit</defName>
<label>mechlord suit</label>
<description>A power-assisted armor suit packed with mechanitor-assistance gear. The mechlord suit dramatically amplifies a mechanitor's bandwidth, but is somewhat less protective than dedicated heavy armor.</description>
...
<graphicData>
<texPath>Things/Pawn/Humanlike/Apparel/MechlordSuit/MechlordSuit</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
...
<apparel>
<tags>
<li>RoyalTier7</li>
<li>Mechlord</li>
</tags>
<wornGraphicPath>Things/Pawn/Humanlike/Apparel/MechlordSuit/MechlordSuit_Hulk</wornGraphicPath>
</apparel>
...
<comps>
<li Class="AthenaFramework.CompProperties_CustomApparelBody">
<preventBodytype>true</preventBodytype>
</li>
</comps>
</ThingDef>