ThingDefExtension - AndroidQuazar/VanillaExpandedFramework GitHub Wiki

The ThingDefExtension of Vanilla Expanded Framework provides additional configurable features to weapons, apparel (including shields) and various other ThingDefs.

public class ThingDefExtension : DefModExtension
{
	// For weapons
	public bool usableWithShields = false;
	public WeaponCarryDrawOffsets weaponCarryDrawOffsets = null;

	// For shields and apparel
	public List<PawnKindDef> useFactionColourForPawnKinds;

	// For artillery
	public float siegeBlueprintPoints = SiegeBlueprintPlacer.ArtyCost;

	// For thing that can be discovered by deep scanner
	public Color deepColor = Color.white;
	public float transparencyMultiplier = 0.5f;

	// For skyfallers that can fall into shield fields
	public int shieldDamageIntercepted = -1;

	public bool destroyCorpse;
}

How do I use this code?

Add the VFECore.ThingDefExtension Def Extension to the ThingDef you want to customize, and specify optional parameters as desired:

<modExtensions>
	<li Class="VFECore.ThingDefExtension">			
		<!-- Specify optional parameters here -->				
	</li>
</modExtensions>

Specifying draw offsets for weapons when the pawn is drafted

For long polearm weapons (e.g. spears, glaives, pikes, halberds), you can customize their relative position and angle when wielded by a drafted pawn.

Notes:

  • All orientations (north/south/east/west), position and angular offsets are optional, and default to 0,0,0 and 0 degrees respectively
  • The offsets apply cumulatively over the base game's existing equippedAngleOffset parameter
<modExtensions>
	<li Class="VFECore.ThingDefExtension">
		<weaponCarryDrawOffsets>
			<north>
				<drawOffset>(0.25, 0, 0.25)</drawOffset>
			</north>
			<east>
				<drawOffset>(0.3, 0, 0.20)</drawOffset>
				<angleOffset>21</angleOffset>
			</east>
			<south>
				<drawOffset>(-0.25, 0, 0.25)</drawOffset>
			</south>
			<west>
				<drawOffset>(-0.3, 0, 0.20)</drawOffset>
				<angleOffset>339</angleOffset>
			</west>
		</weaponCarryDrawOffsets>
	</li>
</modExtensions>

mousekin_pike_drafted_march mousekin_pike_melee_attack

Customizing the color of a deep lump for a minable resource/item

For items or resources that can be mined using Deep drills, you can customize the color and transparency of their associated underground deposits detected by the Long-range mineral scanners:

<modExtensions>
	<li Class="VFECore.ThingDefExtension">
		<deepColor>(0.72, 0.29, 0.29)</deepColor> <!-- defaults to white if unspecified -->
		<transparencyMultiplier>0.75</transparencyMultiplier> <!-- defaults to 0.5 if unspecified -->
	</li>
</modExtensions>
⚠️ **GitHub.com Fallback** ⚠️