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

	<!-- VFED Ammo Box Base -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[@Name="VFED_AmmoBoxBase"]</xpath>
		<value>
			<thingClass>CombatExtended.Building_AutoLoaderCE</thingClass>
			<drawerType>MapMeshAndRealTime</drawerType>
		</value>
	</Operation>

	<!-- Uranium Slug Turret -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_UraniumSlug"]</xpath>
		<value>
			<comps>
				<li Class="CombatExtended.CompProperties_AmmoListUser">
					<magazineSize>180</magazineSize>
					<reloadTime>7.8</reloadTime>
					<ammoSet>AmmoSet_40x311mmR</ammoSet>
					<ammoSpawnOptions>
						<li>
							<ammoDef>Ammo_40x311mmR_AP</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>1</weight>
						</li>
						<li>
							<ammoDef>Ammo_40x311mmR_Incendiary</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>0.65</weight>
						</li>
						<li>
							<ammoDef>Ammo_40x311mmR_HE</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>0.65</weight>
						</li>
						<li>
							<ammoDef>Ammo_40x311mmR_Sabot</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>0.65</weight>
						</li>
					</ammoSpawnOptions>
				</li>
				<li Class="CompProperties_Power">
					<compClass>CompPowerTrader</compClass>
					<basePowerConsumption>50</basePowerConsumption>
				</li>
			</comps>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_UraniumSlug"]/costList</xpath>
		<value>
			<costList>
				<Steel>40</Steel>
				<ComponentIndustrial>2</ComponentIndustrial>
			</costList>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_UraniumSlug"]</xpath>
		<value>
			<li Class="CombatExtended.ModExtension_AutoLoaderGraphics">
				<allowedTurrets>
					<li>Turret_Sniper</li>
					<li>VFED_Turret_Kontarion</li>
				</allowedTurrets>
				<allowedTurretTags>
					<li>CE_Autoloader_UraniumSlug</li>
				</allowedTurretTags>
			</li>
		</value>
	</Operation>

	<!-- Autocannon Turret -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_Autocannon"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_AmmoListUser">
				<magazineSize>600</magazineSize>
				<reloadTime>7.8</reloadTime>
				<ammoSet>AmmoSet_20x102mmNATO</ammoSet>
				<ammoSpawnOptions>
						<li>
							<ammoDef>Ammo_20x102mmNATO_AP</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>1</weight>
						</li>
						<li>
							<ammoDef>Ammo_20x102mmNATO_HE</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>0.65</weight>
						</li>
						<li>
							<ammoDef>Ammo_20x102mmNATO_Incendiary</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>0.65</weight>
						</li>
						<li>
							<ammoDef>Ammo_20x102mmNATO_Sabot</ammoDef>
							<percentRange>0.75~1</percentRange>
							<weight>0.65</weight>
						</li>
				</ammoSpawnOptions>
			</li>
			<li Class="CompProperties_Power">
				<compClass>CompPowerTrader</compClass>
				<basePowerConsumption>50</basePowerConsumption>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_Autocannon"]/costList</xpath>
		<value>
			<costList>
				<Steel>40</Steel>
				<ComponentIndustrial>2</ComponentIndustrial>
			</costList>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_Autocannon"]</xpath>
		<value>
			<li Class="CombatExtended.ModExtension_AutoLoaderGraphics">
				<allowedTurrets>
					<li>Turret_Autocannon</li>
					<li>VFED_Turret_Palintone</li>
					<li MayRequire="vanillaexpanded.vfesecurity">VFES_Turret_AutocannonDouble</li>
				</allowedTurrets>
				<allowedTurretTags>
					<li>CE_Autoloader_20x102mmNATO</li>
				</allowedTurretTags>
			</li>
		</value>
	</Operation>

	<!-- Missile Turret -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_Missile"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_AmmoListUser">
				<magazineSize>72</magazineSize>
				<reloadTime>7.8</reloadTime>
				<ammoSet>AmmoSet_50mmRocket</ammoSet>
				<ammoSpawnOptions>
					<li>
						<ammoDef>Ammo_50mmRocket_HE</ammoDef>
						<percentRange>0.75~1</percentRange>
					</li>
				</ammoSpawnOptions>
			</li>
			<li Class="CompProperties_Power">
				<compClass>CompPowerTrader</compClass>
				<basePowerConsumption>50</basePowerConsumption>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_Missile"]/costList</xpath>
		<value>
			<costList>
				<Steel>40</Steel>
				<ComponentIndustrial>2</ComponentIndustrial>
			</costList>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="VFED_AmmoBox_Missile"]</xpath>
		<value>
			<li Class="CombatExtended.ModExtension_AutoLoaderGraphics">
				<allowedTurrets>
					<li>Turret_RocketswarmLauncher</li>
					<li>VFED_Turret_Onager</li>
				</allowedTurrets>
				<allowedTurretTags>
					<li>CE_Autoloader_50mmRocket</li>
				</allowedTurretTags>
			</li>
		</value>
	</Operation>

	<!-- Aerodrone Munition Crate -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFED_AerodroneMunitionsCrate"]/comps/li[@Class="VEF.Weapons.CompProperties_Explosive_Shells"]</xpath>
		<value>
			<li Class="CompProperties_Explosive">
				<wickTicks>1000</wickTicks>
				<explosiveRadius>4</explosiveRadius>
				<explosiveDamageType>Bomb</explosiveDamageType>
				<chanceNeverExplodeFromDamage>0.2</chanceNeverExplodeFromDamage>
				<startWickHitPointsPercent>0.25</startWickHitPointsPercent>
			</li>
			<li Class="CombatExtended.CompProperties_Fragments">
				<fragments>
					<Fragment_Bomblet>6</Fragment_Bomblet>
				</fragments>
			</li>
		</value>
	</Operation>

</Patch>