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

	<ThingCategoryDef>
		<defName>Ammo40x365mmBofors</defName>
		<label>40x365mm Bofors</label>
		<parent>AmmoShells</parent>
		<iconPath>UI/Icons/ThingCategories/CaliberAutocannonLarge</iconPath>
	</ThingCategoryDef>

	<!-- ==================== AmmoSet ========================== -->

	<CombatExtended.AmmoSetDef>
		<defName>AmmoSet_40x365mmBofors</defName>
		<label>40x365mm Bofors</label>
		<ammoTypes>
			<Ammo_40x365mmBofors_AP>Bullet_40x365mmBofors_AP</Ammo_40x365mmBofors_AP>
			<Ammo_40x365mmBofors_HE>Bullet_40x365mmBofors_HE</Ammo_40x365mmBofors_HE>
			<Ammo_40x365mmBofors_HE_TFuzed>Bullet_40x365mmBofors_HE_TFuzed</Ammo_40x365mmBofors_HE_TFuzed>
			<Ammo_40x365mmBofors_Sabot>Bullet_40x365mmBofors_Sabot</Ammo_40x365mmBofors_Sabot>
		</ammoTypes>
		<similarTo>AmmoSet_LightCannon</similarTo>
	</CombatExtended.AmmoSetDef>

	<!-- ==================== Ammo ========================== -->

	<ThingDef Class="CombatExtended.AmmoDef" Name="Ammo40x365mmBoforsBase" ParentName="HeavyAmmoBase" Abstract="True">
		<description>Large caliber cartridge used by autocannons and anti-aircraft cannons.</description>
		<statBases>
			<Mass>2.5</Mass>
			<Bulk>4.69</Bulk>
		</statBases>
		<tradeTags>
			<li>CE_AutoEnableTrade</li>
			<li>CE_AutoEnableCrafting_TableMachining</li>
		</tradeTags>
		<thingCategories>
			<li>Ammo40x365mmBofors</li>
		</thingCategories>
		<stackLimit>25</stackLimit>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="Ammo40x365mmBoforsBase">
		<defName>Ammo_40x365mmBofors_AP</defName>
		<label>40x365mm Bofors cartridge (AP)</label>
		<graphicData>
			<texPath>Things/Ammo/HighCaliber/Bofors/AP</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<ammoClass>ArmorPiercing</ammoClass>
		<cookOffProjectile>Bullet_40x365mmBofors_AP</cookOffProjectile>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="Ammo40x365mmBoforsBase">
		<defName>Ammo_40x365mmBofors_HE</defName>
		<label>40x365mm Bofors cartridge (HE)</label>
		<graphicData>
			<texPath>Things/Ammo/HighCaliber/Bofors/HE</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<ammoClass>GrenadeHE</ammoClass>
		<cookOffProjectile>Bullet_40x365mmBofors_HE</cookOffProjectile>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="Ammo40x365mmBoforsBase">
		<defName>Ammo_40x365mmBofors_HE_TFuzed</defName>
		<label>40x365mm Bofors cartridge (HE Time-Fuzed)</label>
		<graphicData>
			<texPath>Things/Ammo/HighCaliber/Bofors/HE</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<ammoClass>GrenadeHETF</ammoClass>
		<cookOffProjectile>Bullet_40x365mmBofors_HE</cookOffProjectile>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="Ammo40x365mmBoforsBase">
		<defName>Ammo_40x365mmBofors_Sabot</defName>
		<label>40x365mm Bofors cartridge (Sabot)</label>
		<graphicData>
			<texPath>Things/Ammo/HighCaliber/Bofors/Sabot</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<statBases>
			<Mass>2.088</Mass>
		</statBases>
		<ammoClass>Sabot</ammoClass>
		<cookOffProjectile>Bullet_40x365mmBofors_Sabot</cookOffProjectile>
	</ThingDef>

	<!-- ================== Projectiles ================== -->

	<ThingDef Name="Base40x365mmBoforsBullet" ParentName="BaseExplosiveBullet" Abstract="true">
		<graphicData>
			<texPath>Things/Projectile/Bullet_Big</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<speed>181</speed>
			<flyOverhead>false</flyOverhead>
			<dropsCasings>true</dropsCasings>
			<casingMoteDefname>Fleck_BigShell</casingMoteDefname>
			<casingFilthDefname>Filth_CannonAmmoCasings</casingFilthDefname>
		</projectile>
	</ThingDef>

	<ThingDef ParentName="Base40x365mmBoforsBullet">
		<defName>Bullet_40x365mmBofors_AP</defName>
		<label>40x365mm Bofors bullet (AP)</label>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Bullet</damageDef>
			<damageAmountBase>122</damageAmountBase>
			<armorPenetrationSharp>100</armorPenetrationSharp>
			<armorPenetrationBlunt>10007.44</armorPenetrationBlunt>
		</projectile>
	</ThingDef>

	<ThingDef ParentName="Base40x365mmBoforsBullet">
		<defName>Bullet_40x365mmBofors_HE</defName>
		<label>40x365mm Bofors bullet (HE)</label>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Bomb</damageDef>
			<damageAmountBase>64</damageAmountBase>
			<explosionRadius>1.5</explosionRadius>
			<soundExplode>MortarBomb_Explode</soundExplode>
			<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
		</projectile>
		<comps>
			<li Class="CombatExtended.CompProperties_Fragments">
				<fragments>
					<Fragment_Large>3</Fragment_Large>
					<Fragment_Small>6</Fragment_Small>
				</fragments>
			</li>
		</comps>
	</ThingDef>

	<ThingDef ParentName="Base40x365mmBoforsBullet">
		<defName>Bullet_40x365mmBofors_HE_TFuzed</defName>
		<label>40x365mm Bofors bullet (HE Time-Fuzed)</label>
		<thingClass>CombatExtended.ProjectileCE_Bursting</thingClass>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Bomb</damageDef>
			<damageAmountBase>64</damageAmountBase>
			<explosionRadius>1.5</explosionRadius>
			<soundExplode>MortarBomb_Explode</soundExplode>
			<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
			<aimHeightOffset>2</aimHeightOffset>
			<armingDelay>2</armingDelay>
			<airburstDistanceOffset>-3</airburstDistanceOffset>
		</projectile>
		<comps>
			<li Class="CombatExtended.CompProperties_Fragments">
				<fragments>
					<Fragment_Large>3</Fragment_Large>
					<Fragment_Small>6</Fragment_Small>
				</fragments>
				<fragAngleRange>-60~-2</fragAngleRange>
				<fragXZAngleRange>-45~45</fragXZAngleRange>
			</li>
		</comps>
	</ThingDef>

	<ThingDef ParentName="Base40x365mmBoforsBullet">
		<defName>Bullet_40x365mmBofors_Sabot</defName>
		<label>40x365mm Bofors bullet (Sabot)</label>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Bullet</damageDef>
			<damageAmountBase>117</damageAmountBase>
			<armorPenetrationSharp>175</armorPenetrationSharp>
			<armorPenetrationBlunt>12861.7</armorPenetrationBlunt>
			<speed>245</speed>
		</projectile>
	</ThingDef>

	<!-- ==================== Recipes ========================== -->

	<RecipeDef ParentName="CannonAmmoRecipeBase">
		<defName>MakeAmmo_40x365mmBofors_AP</defName>
		<label>make 40x365mm Bofors (AP) cartridge x25</label>
		<description>Craft 25 40x365mm Bofors (AP) cartridges.</description>
		<jobString>Making 40x365mm Bofors (AP) cartridges.</jobString>
		<workAmount>15120</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>126</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>Steel</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_40x365mmBofors_AP>25</Ammo_40x365mmBofors_AP>
		</products>
	</RecipeDef>

	<RecipeDef ParentName="CannonAmmoRecipeBase">
		<defName>MakeAmmo_40x365mmBofors_HE</defName>
		<label>make 40x365mm Bofors (HE) cartridge x25</label>
		<description>Craft 25 40x365mm Bofors (HE) cartridges.</description>
		<jobString>Making 40x365mm Bofors (HE) cartridges.</jobString>
		<workAmount>18600</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>126</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>ComponentIndustrial</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>FSX</li>
					</thingDefs>
				</filter>
				<count>12</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>Steel</li>
				<li>ComponentIndustrial</li>
				<li>FSX</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_40x365mmBofors_HE>25</Ammo_40x365mmBofors_HE>
		</products>
	</RecipeDef>

	<RecipeDef ParentName="CannonAmmoRecipeBase">
		<defName>MakeAmmo_40x365mmBofors_HE_TFuzed</defName>
		<label>make 40x365mm Bofors (Time-Fuzed) cartridge x25</label>
		<description>Craft 25 40x365mm Bofors (Time-Fuzed) cartridges.</description>
		<jobString>Making 40x365mm Bofors (Time-Fuzed) cartridges.</jobString>
		<researchPrerequisite Inherit="False" />
		<researchPrerequisites>
			<li>CE_TurretHeavyWeapons</li>
			<li>CE_AdvancedLaunchers</li>
		</researchPrerequisites>
		<workAmount>20400</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>126</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>ComponentIndustrial</li>
					</thingDefs>
				</filter>
				<count>5</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>FSX</li>
					</thingDefs>
				</filter>
				<count>12</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>Steel</li>
				<li>ComponentIndustrial</li>
				<li>FSX</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_40x365mmBofors_HE_TFuzed>25</Ammo_40x365mmBofors_HE_TFuzed>
		</products>
	</RecipeDef>

	<RecipeDef ParentName="CannonAmmoRecipeBase">
		<defName>MakeAmmo_40x365mmBofors_Sabot</defName>
		<label>make 40x365mm Bofors (Sabot) cartridge x25</label>
		<description>Craft 25 40x365mm Bofors (Sabot) cartridges.</description>
		<jobString>Making 40x365mm Bofors (Sabot) cartridges.</jobString>
		<researchPrerequisite Inherit="False" />
		<researchPrerequisites>
			<li>CE_TurretHeavyWeapons</li>
			<li>CE_AdvancedAmmo</li>
		</researchPrerequisites>
		<workAmount>16200</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>78</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Uranium</li>
					</thingDefs>
				</filter>
				<count>14</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Chemfuel</li>
					</thingDefs>
				</filter>
				<count>14</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>Steel</li>
				<li>Uranium</li>
				<li>Chemfuel</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_40x365mmBofors_Sabot>25</Ammo_40x365mmBofors_Sabot>
		</products>
	</RecipeDef>

</Defs>