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

	<!-- ========== Remove food packing for pawns with loadouts ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThinkTreeDef[defName="Humanlike"]/thinkRoot/subNodes/li[@Class="ThinkNode_ConditionalColonist"]/subNodes/li[subNodes/li[@Class="JobGiver_PackFood"]]</xpath>
		<value>
			<li Class="CombatExtended.ThinkNode_ConditionalHasLoadout">
				<invert>true</invert>
				<subNodes>
					<li Class="ThinkNode_ConditionalNeedPercentageAbove">
						<need>Food</need>
						<threshold>0.6</threshold>
						<subNodes>
							<li Class="JobGiver_PackFood">
								<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
							</li>
						</subNodes>
					</li>
				</subNodes>
			</li>
		</value>
	</Operation>

	<!-- ========== Add loadout update behavior ========== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThinkTreeDef[defName="MainColonistBehaviorCore"]/thinkRoot/subNodes/li[@Class="ThinkNode_PrioritySorter"]/subNodes</xpath>
		<value>
			<li Class="CombatExtended.JobGiver_UpdateLoadout" />
			<li Class="CombatExtended.JobGiver_CheckReload" />
			<li Class="CombatExtended.JobGiver_ModifyCarriedWeapon" />
		</value>
	</Operation>

	<!-- ========== Add additional inventory behavior ========== -->

	<Operation Class="PatchOperationInsert">
		<xpath>Defs/ThinkTreeDef[defName="HumanlikeConstant"]/thinkRoot/subNodes/li[@Class="ThinkNode_ConditionalCanDoConstantThinkTreeJobNow"]/subNodes/li[@Class="JobGiver_FleePotentialExplosion"]</xpath>
		<value>
			<li Class="CombatExtended.JobGiver_TakeAndEquip" />
		</value>
	</Operation>

	<!-- =========== Add turret reloading to mechanoids ===========-->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/DutyDef[defName="Defend"]/thinkNode/subNodes</xpath>
		<value>
			<li Class="CombatExtended.JobGiver_DefenderReloadTurret" />
		</value>
		<order>Prepend</order>
	</Operation>

</Patch>