Shield apparel - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

<- Back

This allows you to create shields, defined as "a piece of armor made of rigid material and strapped to the arm or carried in the hand for protection against hurled or thrusted weapons". If you want a sci-fi, stops-ranged-weapons-via-magic shield, we have those too!

First of all, the ThingDef you want to be a shield needs to have

<thingClass>VEF.Apparels.Apparel_Shield</thingClass>

You'll then also need a comp class, VEF.Apparels.CompProperties_Shield:

        public List<string> shieldTags;
        public bool useDeflectMetalEffect;
        public List<BodyPartGroupDef> coveredBodyPartGroups;
        public GraphicData offHandGraphicData;
        public HoldOffsetSet offHandHoldOffset;

How do I use this code?

As mentioned above, you'll need both the thingClass tag, and the comp. For example, these are the shields in VFE Classical:

<thingClass>VEF.Apparels.Apparel_Shield</thingClass>
<comps>
	<li Class="VEF.Apparels.CompProperties_Shield">
		<shieldTags>
			<li>Classical</li>
		</shieldTags>
		<useDeflectMetalEffect>false</useDeflectMetalEffect>
		<coveredBodyPartGroups>
			<li>Neck</li>
			<li>Torso</li>
			<li>Arms</li>
			<li>Legs</li>
			<li>Hands</li>
		</coveredBodyPartGroups>
		<offHandGraphicData>
			<texPath>Things/Item/Equipment/Shield/HeavyShield/HeavyShield</texPath>
			<graphicClass>Graphic_Multi</graphicClass>
			<shaderType>CutoutComplex</shaderType>
			<drawSize>1.6</drawSize>
		</offHandGraphicData>
		<offHandHoldOffset>
			<northDefault>
				<offset>(-0.05, 0, 0.2)</offset>
				<behind>true</behind>
			</northDefault>
			<east>
				<offset>(-0.15, 0, 0.2)</offset>
				<behind>true</behind>
			</east>
			<south>
				<offset>(0.2, -0.04, 0.2)</offset>
			</south>
			<west>
				<offset>(0.15, 0, 0.2)</offset>
			</west>
		</offHandHoldOffset>
	</li>
</comps>
⚠️ **GitHub.com Fallback** ⚠️