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

	<!-- ========== Kill recipe maker ========== -->
	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[defName="RGWeapon_Toxpot"]</xpath>
		<attribute>ParentName</attribute>
		<value>BaseWeapon</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="RGWeapon_Toxpot"]/recipeMaker</xpath>
	</Operation>

	<!-- ========== Melee tools ========== -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="RGWeapon_Toxpot"]</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>Body</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>2</power>
					<cooldownTime>1.75</cooldownTime>
					<armorPenetrationBlunt>1.0</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Base</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

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

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RGProj_ToxPot"]/projectile</xpath>
		<value>
			<projectile Class="CombatExtended.ProjectilePropertiesCE">
				<explosionRadius>1.9</explosionRadius>
				<damageDef>ToxGas</damageDef>
				<explosionDelay>100</explosionDelay>
				<postExplosionGasType>ToxGas</postExplosionGasType>
				<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
				<speed>12</speed>
				<suppressionFactor>3.0</suppressionFactor>
				<dangerFactor>2.0</dangerFactor>
				<airborneSuppressionFactor>0.25</airborneSuppressionFactor>
			</projectile>
		</value>
	</Operation>

	<!-- Grenade -->
	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="RGWeapon_Toxpot"]/costList</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RGWeapon_Toxpot"]/graphicData/texPath</xpath>
		<value>
			<texPath>Items/Weapons/Toxpots/Toxpot_Flying</texPath>
		</value>
	</Operation>

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

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

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>RGWeapon_Toxpot</defName>
		<statBases>
			<Mass>0.7</Mass>
			<Bulk>1.05</Bulk>
			<RangedWeapon_Cooldown>1</RangedWeapon_Cooldown>
			<SightsEfficiency>1.0</SightsEfficiency>
		</statBases>
		<Properties>
			<label>throw grenade</label>
			<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<range>10</range>
			<minRange>1.9</minRange>
			<warmupTime>0.8</warmupTime>
			<noiseRadius>4</noiseRadius>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<soundCast>ThrowMolotovCocktail</soundCast>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<defaultProjectile>RGProj_ToxPot</defaultProjectile>
			<onlyManualCast>true</onlyManualCast>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
			<ai_AvoidFriendlyFireRadius>2</ai_AvoidFriendlyFireRadius>
		</Properties>
		<weaponTags>
			<li>CE_AI_Grenade</li>
			<li>CE_AI_AOE</li>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

</Patch>