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

	<!-- Projectile -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeThump"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeThump"]/projectile</xpath>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeThump"]</xpath>
		<value>
			<projectile Class="CombatExtended.ProjectilePropertiesCE">
				<explosionRadius>1.5</explosionRadius>
				<damageDef>Thump</damageDef>
				<damageAmountBase>56</damageAmountBase>
				<explosionDelay>60</explosionDelay>
				<dropsCasings>true</dropsCasings>
				<casingMoteDefname>Fleck_GrenadePin</casingMoteDefname>
				<casingFilthDefname>Filth_GrenadeAmmoCasings</casingFilthDefname>
				<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
				<speed>12</speed>
				<suppressionFactor>3.0</suppressionFactor>
				<dangerFactor>2.0</dangerFactor>
				<airborneSuppressionFactor>0.25</airborneSuppressionFactor>
			</projectile>
		</value>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeThump"]/comps</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeThump"]</xpath>
			<value>
				<comps />
			</value>
		</nomatch>
	</Operation>

	<!-- Weapon -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeThump"]/smeltable</xpath>
		<value>
			<smeltable>false</smeltable>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeThump"]</xpath>
		<value>
			<thingClass>CombatExtended.AmmoThing</thingClass>
			<stackLimit>75</stackLimit>
			<resourceReadoutPriority>First</resourceReadoutPriority>
		</value>
	</Operation>

	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeThump"]</xpath>
		<attribute>Class</attribute>
		<value>CombatExtended.AmmoDef</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeThump"]/comps</xpath>
		<value>
			<comps>
				<li Class="CombatExtended.CompProperties_ExplosiveCE">
					<damageAmountBase>56</damageAmountBase>
					<explosiveDamageType>Thump</explosiveDamageType>
					<explosiveRadius>3.9</explosiveRadius>
				</li>
			</comps>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Weapon_GrenadeThump</defName>
		<statBases>
			<Mass>0.74</Mass>
			<Bulk>1.21</Bulk>
			<RangedWeapon_Cooldown>1</RangedWeapon_Cooldown>
			<SightsEfficiency>1.0</SightsEfficiency>
		</statBases>
		<Properties>
			<label>throw thump grenade</label>
			<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<range>12.0</range>
			<minRange>4</minRange>
			<warmupTime>1</warmupTime>
			<noiseRadius>6</noiseRadius>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<soundCast>ThrowGrenade</soundCast>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<defaultProjectile>DV_Proj_GrenadeThump</defaultProjectile>
			<onlyManualCast>true</onlyManualCast>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
			<ai_AvoidFriendlyFireRadius>7</ai_AvoidFriendlyFireRadius>
		</Properties>
		<weaponTags>
			<li>CE_AI_Grenade</li>
			<li>CE_AI_AOE</li>
			<li>CE_OneHandedWeapon</li>
			<li>GrenadeDestructive</li>
		</weaponTags>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeThump"]/graphicData</xpath>
		<value>
			<graphicData>
				<texPath>ThirdParty/Spacer Arsenal/ThumpGrenade</texPath>
				<graphicClass>Graphic_StackCount</graphicClass>
				<onGroundRandomRotateAngle>0</onGroundRandomRotateAngle>
			</graphicData>
		</value>
	</Operation>

	<!-- Plasma Grenades -->

	<!-- Projectile -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadePlasma"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadePlasma"]/projectile</xpath>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadePlasma"]</xpath>
		<value>
			<projectile Class="CombatExtended.ProjectilePropertiesCE">
				<explosionRadius>2.4</explosionRadius>
				<damageDef>DV_PlasmaVaporize</damageDef>
				<damageAmountBase>36</damageAmountBase>
				<explosionDelay>80</explosionDelay>
				<dropsCasings>true</dropsCasings>
				<casingMoteDefname>Fleck_GrenadePin</casingMoteDefname>
				<casingFilthDefname>Filth_GrenadeAmmoCasings</casingFilthDefname>
				<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
				<speed>12</speed>
				<suppressionFactor>2.0</suppressionFactor>
				<dangerFactor>1.5</dangerFactor>
				<airborneSuppressionFactor>0.25</airborneSuppressionFactor>
			</projectile>
		</value>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadePlasma"]/comps</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="DV_Proj_GrenadePlasma"]</xpath>
			<value>
				<comps />
			</value>
		</nomatch>
	</Operation>

	<!-- Weapon -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadePlasma"]/smeltable</xpath>
		<value>
			<smeltable>false</smeltable>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadePlasma"]</xpath>
		<value>
			<thingClass>CombatExtended.AmmoThing</thingClass>
			<stackLimit>75</stackLimit>
			<resourceReadoutPriority>First</resourceReadoutPriority>
		</value>
	</Operation>

	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadePlasma"]</xpath>
		<attribute>Class</attribute>
		<value>CombatExtended.AmmoDef</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadePlasma"]/comps</xpath>
		<value>
			<comps>
				<li Class="CombatExtended.CompProperties_ExplosiveCE">
					<damageAmountBase>36</damageAmountBase>
					<explosiveDamageType>DV_PlasmaVaporize</explosiveDamageType>
					<explosiveRadius>2.4</explosiveRadius>
				</li>
			</comps>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Weapon_GrenadePlasma</defName>
		<statBases>
			<Mass>0.64</Mass>
			<Bulk>1.56</Bulk>
			<RangedWeapon_Cooldown>1.4</RangedWeapon_Cooldown>
			<SightsEfficiency>1.0</SightsEfficiency>
		</statBases>
		<Properties>
			<label>throw plasma grenade</label>
			<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<range>14.0</range>
			<minRange>4</minRange>
			<warmupTime>1.6</warmupTime>
			<noiseRadius>6</noiseRadius>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<soundCast>ThrowGrenade</soundCast>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<defaultProjectile>DV_Proj_GrenadePlasma</defaultProjectile>
			<onlyManualCast>true</onlyManualCast>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
			<ai_AvoidFriendlyFireRadius>7</ai_AvoidFriendlyFireRadius>
		</Properties>
		<weaponTags>
			<li>CE_AI_Grenade</li>
			<li>CE_AI_AOE</li>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadePlasma"]/graphicData</xpath>
		<value>
			<graphicData>
				<texPath>ThirdParty/Spacer Arsenal/PlasmaGrenade</texPath>
				<graphicClass>Graphic_StackCount</graphicClass>
				<onGroundRandomRotateAngle>0</onGroundRandomRotateAngle>
			</graphicData>
		</value>
	</Operation>

	<!-- Contact Grenades -->

	<!-- Projectile -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeShatter"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeShatter"]/projectile</xpath>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeShatter"]</xpath>
		<value>
			<projectile Class="CombatExtended.ProjectilePropertiesCE">
				<explosionRadius>2.3</explosionRadius>
				<damageDef>Bomb</damageDef>
				<damageAmountBase>56</damageAmountBase>
				<explosionDelay>0</explosionDelay>
				<dropsCasings>true</dropsCasings>
				<casingMoteDefname>Fleck_GrenadePin</casingMoteDefname>
				<casingFilthDefname>Filth_GrenadeAmmoCasings</casingFilthDefname>
				<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
				<speed>12</speed>
				<suppressionFactor>3.0</suppressionFactor>
				<dangerFactor>2.0</dangerFactor>
				<airborneSuppressionFactor>0.25</airborneSuppressionFactor>
				<ballisticCoefficient>2.0~2.0</ballisticCoefficient>
				<mass>400~400</mass>
				<diameter>64~64</diameter>
			</projectile>
		</value>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeShatter"]/comps</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeShatter"]</xpath>
			<value>
				<comps />
			</value>
		</nomatch>
	</Operation>
	
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Proj_GrenadeShatter"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_Fragments">
				<fragments>
					<Fragment_Small>14</Fragment_Small>
				</fragments>
			</li>
		</value>
	</Operation>

	<!-- Weapon -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeContact"]/smeltable</xpath>
		<value>
			<smeltable>false</smeltable>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeContact"]</xpath>
		<value>
			<thingClass>CombatExtended.AmmoThing</thingClass>
			<stackLimit>75</stackLimit>
			<resourceReadoutPriority>First</resourceReadoutPriority>
		</value>
	</Operation>

	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeContact"]</xpath>
		<attribute>Class</attribute>
		<value>CombatExtended.AmmoDef</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeContact"]/comps</xpath>
		<value>
			<comps>
				<li Class="CombatExtended.CompProperties_ExplosiveCE">
					<damageAmountBase>56</damageAmountBase>
					<explosiveDamageType>Bomb</explosiveDamageType>
					<explosiveRadius>2.3</explosiveRadius>
				</li>
				<li Class="CombatExtended.CompProperties_Fragments">
					<fragments>
						<Fragment_Small>14</Fragment_Small>
					</fragments>
				</li>
			</comps>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Weapon_GrenadeContact</defName>
		<statBases>
			<Mass>0.4</Mass>
			<Bulk>0.87</Bulk>
			<RangedWeapon_Cooldown>1</RangedWeapon_Cooldown>
			<SightsEfficiency>1.0</SightsEfficiency>
		</statBases>
		<Properties>
			<label>throw contact grenade</label>
			<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<range>13.9</range>
			<minRange>3.9</minRange>
			<warmupTime>0.8</warmupTime>
			<noiseRadius>5</noiseRadius>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<soundCast>ThrowGrenade</soundCast>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<defaultProjectile>DV_Proj_GrenadeShatter</defaultProjectile>
			<onlyManualCast>true</onlyManualCast>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
			<ai_AvoidFriendlyFireRadius>8</ai_AvoidFriendlyFireRadius>
		</Properties>
		<weaponTags>
			<li>CE_AI_Grenade</li>
			<li>CE_AI_AOE</li>
			<li>CE_OneHandedWeapon</li>
			<li>GrenadeDestructive</li>
		</weaponTags>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Weapon_GrenadeContact"]/graphicData</xpath>
		<value>
			<graphicData>
				<texPath>ThirdParty/Spacer Arsenal/ContactGrenade</texPath>
				<graphicClass>Graphic_StackCount</graphicClass>
				<onGroundRandomRotateAngle>0</onGroundRandomRotateAngle>
			</graphicData>
		</value>
	</Operation>

	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[
			defName="DV_Weapon_GrenadeThump" or
			defName="DV_Weapon_GrenadePlasma" or
			defName="DV_Weapon_GrenadeContact"
			]</xpath>
		<attribute>ParentName</attribute>
		<value>BaseWeapon</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[
			defName="DV_Weapon_GrenadeThump" or
			defName="DV_Weapon_GrenadePlasma" or
			defName="DV_Weapon_GrenadeContact"
			]/recipeMaker</xpath>
	</Operation>

</Patch>