<?xml version="1.0" encoding="utf-8"?>
<Patch>

	<!-- Add groups entry if it doesn't exist already -->
	<Operation Class="PatchOperationConditional">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/groups</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart</xpath>
			<value>
				<groups />
			</value>
		</nomatch>
	</Operation>
	
	<Operation Class="PatchOperationConditional">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Elytra"]/groups</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Elytra"]</xpath>
			<value>
				<groups />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Pronotum"]/groups</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Pronotum"]</xpath>
			<value>
				<groups />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="InsectLeg"]/groups</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="InsectLeg"]</xpath>
			<value>
				<groups />
			</value>
		</nomatch>
	</Operation>

	<!-- Add armor coverage -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Elytra"]/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Pronotum"]/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Pronotum"]/parts/li[def="InsectHead"]/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="Pronotum"]/parts/li[def="InsectHead"]/parts/li[def="InsectMouth"]/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="InsectLeg"]/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/BodyDef[defName="BMT_MantisLike"]/corePart/parts/li[def="InsectLeg"]/parts/li[def="Paw"]/groups</xpath>
		<value>
			<li>CoveredByNaturalArmor</li>
		</value>
	</Operation>

</Patch>