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

	<!-- ========== Minigun Turret ========== -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_RotarygunTurret</defName>
		<statBases>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.01</ShotSpread>
			<SwayFactor>1.25</SwayFactor>
			<Bulk>12.0</Bulk>
			<Mass>30.0</Mass>
			<RangedWeapon_Cooldown>0.35</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>0.55</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_762x51mmNATO_FMJ</defaultProjectile>
			<warmupTime>2.3</warmupTime>
			<range>68</range>
			<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
			<burstShotCount>50</burstShotCount>
			<soundCast>Shot_Minigun</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>500</magazineSize>
			<reloadTime>9.2</reloadTime>
			<ammoSet>AmmoSet_762x51mmNATO</ammoSet>
		</AmmoUser>
		<FireModes>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
			<aimedBurstShotCount>25</aimedBurstShotCount>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>
	
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Gun_RotarygunTurret"]/verbs</xpath>
		<value>
			<li Class="CombatExtended.VerbProperties_CIWSSkyfaller">
				<verbClass>CombatExtended.VerbCIWSSkyfaller</verbClass>
				<recoilAmount>0.86</recoilAmount>
				<hasStandardCommand>true</hasStandardCommand>
				<defaultProjectile>Bullet_762x51mmNATO_FMJ</defaultProjectile>
				<warmupTime>0.8</warmupTime>
				<range>105</range>
				<ticksBetweenBurstShots>1</ticksBetweenBurstShots>
				<burstShotCount>100</burstShotCount>
				<soundCast>Shot_Minigun</soundCast>
				<soundCastTail>GunTail_Medium</soundCastTail>
				<muzzleFlashScale>9</muzzleFlashScale>
				<recoilPattern>Mounted</recoilPattern>
			</li>
			<li Class="CombatExtended.VerbProperties_CIWSSkyfaller">
				<verbClass>CombatExtended.VerbCIWSProjectile</verbClass>
				<recoilAmount>0.86</recoilAmount>
				<hasStandardCommand>true</hasStandardCommand>
				<defaultProjectile>Bullet_762x51mmNATO_FMJ</defaultProjectile>
				<warmupTime>0.8</warmupTime>
				<range>75</range>
				<ticksBetweenBurstShots>1</ticksBetweenBurstShots>
				<burstShotCount>100</burstShotCount>
				<soundCast>Shot_Minigun</soundCast>
				<soundCastTail>GunTail_Medium</soundCastTail>
				<muzzleFlashScale>9</muzzleFlashScale>
				<recoilPattern>Mounted</recoilPattern>
			</li>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Gun_RotarygunTurret"]/comps</xpath>
		<value>
			<li>
				<compClass>CombatExtended.CompVerbDisabler</compClass>
			</li>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_Rotarygun"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>0.37</turretBurstCooldownTime>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_Rotarygun"]/costList/ComponentIndustrial</xpath>
		<value>
			<ComponentIndustrial>12</ComponentIndustrial>
		</value>
	</Operation>

	<!-- ========== EMP Turret ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_EMPLobber</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.47</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.18</ShotSpread>
			<SwayFactor>0.77</SwayFactor>
			<Bulk>9.00</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>1.86</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_40x46mmGrenade_HE</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>40</range>
			<soundCast>InfernoCannon_Fire</soundCast>
			<muzzleFlashScale>14</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
			<targetParams>
			  <canTargetLocations>true</canTargetLocations>
			</targetParams>
		</Properties>
		<AmmoUser>
			<magazineSize>12</magazineSize>
			<reloadTime>7.8</reloadTime>
			<ammoSet>AmmoSet_40x46mmGrenade</ammoSet>
		</AmmoUser>
		<FireModes>
			<noSnapshot>true</noSnapshot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_EMPLobber"]/label</xpath>
		<value>
			<label>grenade lobber turret</label>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_EMPLobber"]/description</xpath>
		<value>
			<description>A portable automatic grenade launcher. Requires resupply once its ammo runs out. Be cautious of friendly fire.</description>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_EMPLobber"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>0.47</turretBurstCooldownTime>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Turret_EMPLobber"]/researchPrerequisites</xpath>
		<value>
			<li>CE_Launchers</li>
		</value>
	</Operation>

	<!-- ========== Incendary Turret ========== -->
	
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_FireLobber</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1.1</SightsEfficiency>
			<ShotSpread>0.15</ShotSpread>
			<SwayFactor>0.82</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>0.92</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_30x64mmFuel_Incendiary</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>40</range>
			<soundCast>Shot_IncendiaryLauncher</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
		</Properties>
		<AmmoUser>
			<magazineSize>15</magazineSize>
			<reloadTime>8.6</reloadTime>
			<ammoSet>AmmoSet_30x64mmFuel</ammoSet>
		</AmmoUser>
		<FireModes>
			<noSnapshot>true</noSnapshot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_FireLobber"]/description</xpath>
		<value>
			<description>A portable automatic wide barrel launcher that unleashes incendiary fuel cells. Requires resupply once its ammo runs out. Beware of friendly fire and spreading flames—chaos can escalate in seconds. Stay alert. You have been warned.</description>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_FireLobber"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>0.36</turretBurstCooldownTime>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Turret_FireLobber"]/costList</xpath>
		<value>
			<ComponentSpacer>1</ComponentSpacer>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Turret_FireLobber"]/researchPrerequisites</xpath>
		<value>
			<li>CE_AdvancedLaunchers</li>
		</value>
	</Operation>
	
	<!-- ========== Slugger Turret ========== -->
	
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_MiniSlugger</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1.1</SightsEfficiency>
			<ShotSpread>0.14</ShotSpread>
			<SwayFactor>0.72</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>2.19</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_12Gauge_Slug</defaultProjectile>
			<warmupTime>0.8</warmupTime>
			<range>16</range>
			<soundCast>Shot_Shotgun</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>24</magazineSize>
			<reloadTime>9.8</reloadTime>
			<ammoSet>AmmoSet_12Gauge_Slug</ammoSet>
		</AmmoUser>
		<FireModes>
			<noSnapshot>true</noSnapshot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_MiniSlugger"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>0.37</turretBurstCooldownTime>
		</value>
	</Operation>
	
	<!-- ========== Shooter Turret ========== -->
	
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_MiniShooter</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>2.6</SightsEfficiency>
			<ShotSpread>0.05</ShotSpread>
			<SwayFactor>0.92</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>1.46</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_762x51mmNATO_FMJ</defaultProjectile>
			<warmupTime>1.8</warmupTime>
			<range>75</range>
			<soundCast>Shot_BoltActionRifle</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>20</magazineSize>
			<reloadTime>6</reloadTime>
			<ammoSet>AmmoSet_762x51mmNATO</ammoSet>
		</AmmoUser>
		<FireModes>
			<noSnapshot>true</noSnapshot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>
	
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_MiniShooter"]/description</xpath>
		<value>
			<description>A portable automated turret armed with a long-range rifle. It fires single powerful shots at extended range, but its simple AI makes friendly fire possible.</description>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_MiniShooter"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>1.16</turretBurstCooldownTime>
		</value>
	</Operation>

	<!-- ========== Fake Rifle ========== -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_FakeRifle</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.00</ShotSpread>
			<SwayFactor>0.00</SwayFactor>
			<Bulk>7.90</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.00</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_FakeBullet_CE</defaultProjectile>
			<warmupTime>1.5</warmupTime>
			<range>40</range>
			<ticksBetweenBurstShots>10</ticksBetweenBurstShots>
			<burstShotCount>5</burstShotCount>
			<soundCast>GunShotA</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<aimedBurstShotCount>3</aimedBurstShotCount>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>

	<!-- ========== Cannon ========== -->
	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="Turret_RSCannon"]/inspectorTabs</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="Turret_RSCannon"
			]/building/turretBurstCooldownTime </xpath>
		<value>
			<turretBurstCooldownTime>5</turretBurstCooldownTime>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Artillery_RSCannon</defName>
		<statBases>
			<RangedWeapon_Cooldown>2</RangedWeapon_Cooldown>
			<SightsEfficiency>3</SightsEfficiency>
			<ShotSpread>0.02</ShotSpread>
			<SwayFactor>1.89</SwayFactor>
			<Bulk>20</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>1.13</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_81mmMortarShellRimsenal_HE</defaultProjectile>
			<warmupTime>5</warmupTime>
			<range>62</range>
			<soundCast>Mortar_LaunchA</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<reloadTime>5</reloadTime>
			<ammoSet>AmmoSet_81mmMortarShellRimsenal</ammoSet>
		</AmmoUser>
		<FireModes>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>

	<!-- ========== Common to all Defensive Turrets ========== -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Turret_RSCannon"]/thingClass </xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="Turret_RSCannon"]/comps/li[@Class="CompProperties_Refuelable"] </xpath>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Turret_RSCannon"]/statBases </xpath>
		<value>
			<AimingAccuracy>0.5</AimingAccuracy>
		</value>
	</Operation>
	

	<!--========== Common to all Sentry Turrets ========== -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="Turret_EMPLobber" or
			defName="Turret_FireLobber" or
			defName="Turret_MiniSlugger" or
			defName="Turret_MiniShooter"
			]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Turret_Rotarygun"]</xpath>
		<value>
			<thingClass>CombatExtended.Building_CIWS_CE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[
			defName="Turret_EMPLobber" or
			defName="Turret_FireLobber" or
			defName="Turret_Rotarygun" or
			defName="Turret_MiniSlugger" or
			defName="Turret_MiniShooter"
			]/comps/li[@Class="CompProperties_Refuelable"] </xpath>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[
			defName="Turret_EMPLobber" or
			defName="Turret_FireLobber" or
			@Name="RSHeavyTurret" or
			defName="Turret_MiniSlugger" or
			defName="Turret_MiniShooter"
			]/statBases </xpath>
		<value>
			<AimingAccuracy>1.0</AimingAccuracy>
		</value>
	</Operation>

	<!--========== Common ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="Turret_EMPLobber" or
			defName="Turret_FireLobber" or
			@Name="RSHeavyTurret" or
			defName="RSDummy" or
			defName="Turret_RSCannon" or
			defName="Turret_MiniSlugger" or
			defName="Turret_MiniShooter"
			]/fillPercent </xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[
			defName="Turret_EMPLobber" or
			defName="Turret_FireLobber" or
			defName="Turret_Rotarygun" or
			defName="Turret_MiniShooter" or
			defName="Turret_RSCannon"
			]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<!-- ========== Impact Mine ========== -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="ImpactMine"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
		<value>
			<li Class="CompProperties_Explosive">
				<explosiveDamageType>KineticImpact</explosiveDamageType>
				<explosiveRadius>3.5</explosiveRadius>
				<wickTicks>
					<min>10</min>
					<max>15</max>
				</wickTicks>
			</li>
		</value>
	</Operation>

	<!-- ========== Explosive Barrel ========== -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="FuelBarrel"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
		<value>
			<li Class="CompProperties_Explosive">
				<explosiveDamageType>PrometheumFlame</explosiveDamageType>
				<explosiveRadius>3</explosiveRadius>
				<preExplosionSpawnThingDef>FilthPrometheum</preExplosionSpawnThingDef>
				<preExplosionSpawnChance>1</preExplosionSpawnChance>
			</li>
		</value>
	</Operation>

	<!-- ========== Smart Mine ========== -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_Smartmine</defName>
		<statBases>
			<RangedWeapon_Cooldown>5</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.25</ShotSpread>
			<SwayFactor>0</SwayFactor>
			<Bulk>10</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_81mmMortarShellRimsenal_HE</defaultProjectile>
			<warmupTime>1</warmupTime>
			<range>5</range>
			<soundCast>Mortar_LaunchA</soundCast>
			<muzzleFlashScale>20</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<reloadTime>12</reloadTime>
			<ammoSet>AmmoSet_81mmMortarShellRimsenal</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>
</Patch>