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

	<CombatExtended.AmmoCategoryDef>
		<defName>AV_Toxic</defName>
		<label>Toxic</label>
		<description>Filled with tox gas, a caustic agent that burns the lungs and eyes. Continued exposure to it results in toxic buildup which can be lethal.</description>
		<advanced>true</advanced>
	</CombatExtended.AmmoCategoryDef>

	<CombatExtended.AmmoCategoryDef>
		<defName>AV_Deployment</defName>
		<label>Deployment</label>
		<description>A shell containing with a dormant warurchin. It will activate on impact and attack any nearby creatures.</description>
		<advanced>true</advanced>
	</CombatExtended.AmmoCategoryDef>

	<!-- Ammo Set -->
	<CombatExtended.AmmoSetDef>
		<defName>AmmoSet_81mmMortarShell_Utilitydirectfire</defName>
		<label>81mm mortar shells utility</label>
		<ammoTypes>
			<Shell_Firefoam>Bullet_81mmMortarShell_UtilityDirectfire_Firefoam</Shell_Firefoam>
			<Shell_Smoke>Bullet_81mmMortarShell_UtilityDirectfire_Smoke</Shell_Smoke>
			<Shell_Firefoam>Bullet_81mmMortarShell_UtilityDirectfire_Firefoam</Shell_Firefoam>
			<Shell_Smoke>Bullet_81mmMortarShell_UtilityDirectfire_Smoke</Shell_Smoke>
			<Shell_Toxic MayRequire="Ludeon.RimWorld.Biotech">Bullet_81mmMortarShell_UtilityDirectfire_Tox</Shell_Toxic>
			<Shell_Deadlife MayRequire="Ludeon.RimWorld.Anomaly">Bullet_81mmMortarShell_UtilityDirectfire_Deadlife</Shell_Deadlife>
		</ammoTypes>
		<isMortarAmmoSet>true</isMortarAmmoSet>
	</CombatExtended.AmmoSetDef>

	<!-- Projectile -->
	<ThingDef Name="Base81mmMortarShellUtilityDirectfire" ParentName="BaseExplosiveBullet" Abstract="true">
		<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		<graphicData>
			<shaderType>TransparentPostLight</shaderType>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<speed>80</speed>
			<soundExplode>MortarBomb_Explode</soundExplode>
			<flyOverhead>false</flyOverhead>
			<dropsCasings>false</dropsCasings>
		</projectile>
	</ThingDef>

	<ThingDef ParentName="Base81mmMortarShellUtilityDirectfire">
		<defName>Bullet_81mmMortarShell_UtilityDirectfire_Firefoam</defName>
		<label>81mm mortar shell (Foam)</label>
		<graphicData>
			<texPath>Things/Projectile/Mortar/Firefoam</texPath>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Extinguish</damageDef>
			<suppressionFactor>0.0</suppressionFactor>
			<dangerFactor>0.0</dangerFactor>
			<explosionRadius>5</explosionRadius>
			<soundExplode>Explosion_EMP</soundExplode>
			<postExplosionSpawnThingDef>Filth_FireFoam</postExplosionSpawnThingDef>
			<postExplosionSpawnChance>1</postExplosionSpawnChance>
			<postExplosionSpawnThingCount>3</postExplosionSpawnThingCount>
			<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
			<explosionEffect>ExtinguisherExplosion</explosionEffect>
		</projectile>
	</ThingDef>

	<ThingDef ParentName="Base81mmMortarShellUtilityDirectfire">
		<defName>Bullet_81mmMortarShell_UtilityDirectfire_Smoke</defName>
		<label>81mm mortar shell (Smoke)</label>
		<graphicData>
			<texPath>Things/Projectile/Mortar/Smoke</texPath>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Smoke</damageDef>
			<suppressionFactor>0.0</suppressionFactor>
			<dangerFactor>0.0</dangerFactor>
			<explosionRadius>6</explosionRadius>
			<soundExplode>Explosion_EMP</soundExplode>
			<postExplosionGasType>BlindSmoke</postExplosionGasType>
			<preExplosionSpawnChance>1</preExplosionSpawnChance>
			<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
			<explosionEffect>ExtinguisherExplosion</explosionEffect>
		</projectile>
	</ThingDef>

	<ThingDef ParentName="Base81mmMortarShellUtilityDirectfire" MayRequire="Ludeon.RimWorld.Biotech">
		<defName>Bullet_81mmMortarShell_UtilityDirectfire_Tox</defName>
		<label>81mm mortar shell (Toxic)</label>
		<graphicData>
			<texPath>Things/Projectile/Mortar/Toxic</texPath>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>ToxGas</damageDef>
			<armorPenetrationSharp>0</armorPenetrationSharp>
			<armorPenetrationBlunt>0</armorPenetrationBlunt>
			<explosionRadius>0.1</explosionRadius>
			<soundExplode>ToxicShellLanded</soundExplode>
			<postExplosionSpawnThingDef>Shell_Toxic_Releasing</postExplosionSpawnThingDef>
			<postExplosionSpawnThingDefWater>Shell_Toxic_Releasing_Water</postExplosionSpawnThingDefWater>
		</projectile>
	</ThingDef>

	<ThingDef ParentName="Base81mmMortarShellUtilityDirectfire" MayRequire="Ludeon.RimWorld.Anomaly">
		<defName>Bullet_81mmMortarShell_UtilityDirectfire_Deadlife</defName>
		<label>81mm mortar shell (Deadlife)</label>
		<graphicData>
			<texPath>Things/Projectile/Mortar/Deadlife</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>DeadlifeDust</damageDef>
			<armorPenetrationSharp>0</armorPenetrationSharp>
			<armorPenetrationBlunt>0</armorPenetrationBlunt>
			<explosionRadius>0.1</explosionRadius>
			<soundExplode>ToxicShellLanded</soundExplode>
			<postExplosionSpawnThingDef>Shell_Deadlife_Releasing</postExplosionSpawnThingDef>
		</projectile>
	</ThingDef>

	<!-- Recipes -->

	<!-- Waste Shell Recipe -->
	<RecipeDef ParentName="ArtilleryAmmoRecipeBase">
		<defName>MakeShell_81mmMortar_Waste</defName>
		<label>make 81mm (waster) mortar shells x5</label>
		<description>Craft 5 81mm (waster) mortar shells.</description>
		<jobString>Making 81mm (waster) mortar shells.</jobString>
		<researchPrerequisites>
			<li>AV_MechanoidShells</li>
		</researchPrerequisites>
		<workAmount>10600</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>54</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>AV_CompressedWaste</li>
					</thingDefs>
				</filter>
				<count>5</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>ComponentIndustrial</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>Steel</li>
				<li>AV_CompressedWaste</li>
				<li>ComponentIndustrial</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Shell_81mmMortar_Waste>5</Shell_81mmMortar_Waste>
		</products>
	</RecipeDef>

	<!-- Mechanoid Deployment Shell Recipe -->
	<RecipeDef ParentName="ArtilleryAmmoRecipeBase">
		<defName>MakeShell_81mmMortar_Deployment</defName>
		<label>make 81mm mechanoid deployment mortar shells x5</label>
		<description>Craft 5 81mm mechanoid deployment mortar shells.</description>
		<jobString>Making 81mm mechanoid deployment mortar shells.</jobString>
		<researchPrerequisites>
			<li>AV_MechanoidShells</li>
		</researchPrerequisites>
		<workAmount>10600</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>150</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Chemfuel</li>
					</thingDefs>
				</filter>
				<count>25</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>ComponentIndustrial</li>
					</thingDefs>
				</filter>
				<count>1</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>SubcoreBasic</li>
					</thingDefs>
				</filter>
				<count>1</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>Steel</li>
				<li>Chemfuel</li>
				<li>SubcoreBasic</li>
				<li>ComponentIndustrial</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Shell_81mmMortar_Deployment>5</Shell_81mmMortar_Deployment>
		</products>
	</RecipeDef>

	<!-- Waste Shell Ammo Definition -->
	<ThingDef Class="CombatExtended.AmmoDef" ParentName="81mmMortarShellBaseCraftableBase">
		<defName>Shell_81mmMortar_Waste</defName>
		<label>waster shell</label>
		<description>An artillery shell containing compressed toxic waste. When fired, it will stick into the ground and pollute the area while releasing tox gas for some time before expiring.\n\nTox gas burns the lungs and eyes, causing a temporary shortness of breath and reduction in sight. Continued exposure to tox gas results in toxic buildup that can be lethal.</description>
		<graphicData>
			<texPath>Things/Item/Resource/Shell/AV_ShellWaster</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<statBases>
			<Mass>5</Mass>
			<Bulk>8.34</Bulk>
		</statBases>
		<ammoClass>AV_Toxic</ammoClass>
		<detonateProjectile>Bullet_81mmMortarShell_Waster</detonateProjectile>
		<comps>
			<li Class="CompProperties_Dissolution">
				<dissolutionAfterDays>150</dissolutionAfterDays>
				<dissolutinFactorIndoors>0.1</dissolutinFactorIndoors>
				<!-- instantly explodes when on 0-->
				<dissolutionFactorRain>2</dissolutionFactorRain>
			</li>
			<li Class="CompProperties_DissolutionEffectPollution">
				<cellsToPollutePerDissolution>18</cellsToPollutePerDissolution>
				<tilePollutionPerDissolution>0.0005</tilePollutionPerDissolution>
				<waterTilePollutionFactor>24</waterTilePollutionFactor>
			</li>
			<li Class="CompProperties_GasOnDamage">
				<type>ToxGas</type>
				<damageFactor>6</damageFactor>
				<useStackCountAsFactor>true</useStackCountAsFactor>
			</li>
			<li>
				<compClass>CompDissolutionEffect_Goodwill</compClass>
			</li>
		</comps>
	</ThingDef>

	<!-- Mechanoid Deployment Shell Ammo Definition -->
	<ThingDef Class="CombatExtended.AmmoDef" ParentName="81mmMortarShellBaseCraftableBase">
		<defName>Shell_81mmMortar_Deployment</defName>
		<label>mechanoid deployment shell</label>
		<description>A shell filled with a sleeping warurchin. On impact it will activate and hunt down any hostile creatures.\n\nWhile this makes a good surprise attack, their data processing is limited which makes them see nearly everybody as hostile.</description>
		<graphicData>
			<texPath>Things/Item/Resource/Shell/AV_ShellDeployment</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<statBases>
			<Mass>5</Mass>
			<Bulk>8.34</Bulk>
		</statBases>
		<ammoClass>AV_Deployment</ammoClass>
		<detonateProjectile>Bullet_81mmMortarShell_Deployment</detonateProjectile>
		<tradeTags>
			<li>AV_Mechtech</li>
			<li>AV_Mechtech_Spacer</li>
		</tradeTags>
	</ThingDef>

	<!-- Waste Shell Projectile -->
	<ThingDef ParentName="Base81mmMortarShell">
		<defName>Bullet_81mmMortarShell_Waster</defName>
		<label>waste shell</label>
		<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		<graphicData>
			<texPath>Things/Projectile/ShellHighExplosive</texPath>
			<graphicClass>Graphic_Single</graphicClass>
			<shaderType>TransparentPostLight</shaderType>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>ToxGas</damageDef>
			<explosionRadius>0.1</explosionRadius>
			<flyOverhead>true</flyOverhead>
			<soundHitThickRoof>Artillery_HitThickRoof</soundHitThickRoof>
			<soundExplode>ToxicShellLanded</soundExplode>
			<soundImpactAnticipate>MortarRound_PreImpact</soundImpactAnticipate>
			<soundAmbient>MortarRound_Ambient</soundAmbient>
			<postExplosionSpawnThingDef>AV_Shell_Toxic_Releasing</postExplosionSpawnThingDef>
			<postExplosionSpawnThingDefWater>AV_Shell_Toxic_Releasing_Water</postExplosionSpawnThingDefWater>
		</projectile>
	</ThingDef>

	<!-- Mechanoid Deployment Shell Projectile (Proper Pawn Spawning Implementation) -->
	<ThingDef ParentName="Base81mmMortarShell">
		<defName>Bullet_81mmMortarShell_Deployment</defName>
		<label>mechanoid deployment shell</label>
		<thingClass>CombatExtended.ProjectileCE_SpawnPawnkind</thingClass>
		<graphicData>
			<texPath>Things/Projectile/ShellHighExplosive</texPath>
			<graphicClass>Graphic_Single</graphicClass>
			<shaderType>TransparentPostLight</shaderType>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Smoke</damageDef>
			<explosionRadius>0.1</explosionRadius>
			<flyOverhead>true</flyOverhead>
			<soundHitThickRoof>Artillery_HitThickRoof</soundHitThickRoof>
			<soundExplode>MortarBomb_Explode</soundExplode>
			<soundImpactAnticipate>MortarRound_PreImpact</soundImpactAnticipate>
			<soundAmbient>MortarRound_Ambient</soundAmbient>
			<!-- Proper pawn spawning properties -->
			<spawnsPawnKind>Mech_WarUrchin</spawnsPawnKind>
			<tryAdjacentFreeSpaces>true</tryAdjacentFreeSpaces>
			<alwaysHostile>true</alwaysHostile>
			<!-- Post-explosion effects -->
			<postExplosionSpawnThingDef>AV_Shell_Deploy_Releasing</postExplosionSpawnThingDef>
			<postExplosionSpawnThingDefWater>AV_Shell_Deploy_Releasing_Water</postExplosionSpawnThingDefWater>
			<shellingProps>
				<damage>0</damage>
			</shellingProps>			
		</projectile>
	</ThingDef>

</Defs>