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

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_EMRGTurret</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>2.24</SightsEfficiency>
			<ShotSpread>0.05</ShotSpread>
			<SwayFactor>1.19</SwayFactor>
			<Bulk>8.94</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.2</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_12mmRailgun_Sabot</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>86</range>
			<soundCast>EM</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>200</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_12mmRailgun</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="EMTurret"]/statBases</xpath>
		<value>
			<WorkToBuild>83500</WorkToBuild>
			<Bulk>15</Bulk>
		</value>
	</Operation>

	<!-- ========== Canister turret ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_CanisterTurret</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.35</RangedWeapon_Cooldown>
			<SightsEfficiency>1.00</SightsEfficiency>
			<ShotSpread>0.14</ShotSpread>
			<SwayFactor>2.02</SwayFactor>
			<Bulk>10.66</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.34</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_12Gauge_Buck</defaultProjectile>
			<warmupTime>0.6</warmupTime>
			<range>20</range>
			<ticksBetweenBurstShots>3</ticksBetweenBurstShots>
			<burstShotCount>6</burstShotCount>
			<soundCast>Shot_IncendiaryLauncher</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>100</magazineSize>
			<reloadTime>4.9</reloadTime>
			<ammoSet>AmmoSet_12Gauge</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>TRUE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<aimedBurstShotCount>6</aimedBurstShotCount>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="CanisterTurret"]/statBases</xpath>
		<value>
			<WorkToBuild>89500</WorkToBuild>
			<Bulk>20</Bulk>
		</value>
	</Operation>

	<!-- ========== Automatic mortar ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Auto_Artillery_Mortar</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.09</ShotSpread>
			<SwayFactor>0.1</SwayFactor>
			<Bulk>12.9</Bulk>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootMortarCE</verbClass>
			<forceNormalTimeSpeed>false</forceNormalTimeSpeed>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_81mmMortarShell_HE</defaultProjectile>
			<warmupTime>1.2</warmupTime>
			<minRange>30</minRange>
			<range>500</range>
			<burstShotCount>1</burstShotCount>
			<soundCast>Mortar_LaunchA</soundCast>
			<muzzleFlashScale>16</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>25</magazineSize>
			<reloadTime>5</reloadTime>
			<ammoSet>AmmoSet_81mmMortarShell_GlitterTechAutoMortar</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
	</Operation>

	<!-- ========== Automatic cluster mortar ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Auto_Cluster_Mortar</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.09</ShotSpread>
			<SwayFactor>0.1</SwayFactor>
			<Bulk>12.9</Bulk>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootMortarCE</verbClass>
			<forceNormalTimeSpeed>false</forceNormalTimeSpeed>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_81mmMortarShell_HE</defaultProjectile>
			<warmupTime>1.2</warmupTime>
			<minRange>30</minRange>
			<range>500</range>
			<burstShotCount>5</burstShotCount>
			<soundCast>Mortar_LaunchA</soundCast>
			<muzzleFlashScale>16</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>25</magazineSize>
			<reloadTime>5</reloadTime>
			<ammoSet>AmmoSet_81mmMortarShell_GlitterTechClusterMortar</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- ========== Automatic EMP mortar ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Auto_EMP_Mortar</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.09</ShotSpread>
			<SwayFactor>0.1</SwayFactor>
			<Bulk>12.9</Bulk>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootMortarCE</verbClass>
			<forceNormalTimeSpeed>false</forceNormalTimeSpeed>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_81mmMortarShell_EMP</defaultProjectile>
			<warmupTime>1.2</warmupTime>
			<minRange>30</minRange>
			<range>500</range>
			<burstShotCount>5</burstShotCount>
			<soundCast>Mortar_LaunchA</soundCast>
			<muzzleFlashScale>16</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>25</magazineSize>
			<reloadTime>5</reloadTime>
			<ammoSet>AmmoSet_81mmMortarShell_GlitterTechEMPAMortar</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- ========== Long range missile turret ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_RocketswarmLauncher_GT</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.09</ShotSpread>
			<SwayFactor>0.1</SwayFactor>
			<Bulk>12.9</Bulk>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootMortarCE</verbClass>
			<forceNormalTimeSpeed>false</forceNormalTimeSpeed>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_70mmAPKWS_HEAT</defaultProjectile>
			<warmupTime>1.2</warmupTime>
			<minRange>30</minRange>
			<range>500</range>
			<burstShotCount>25</burstShotCount>
			<soundCast>Missile_small</soundCast>
			<muzzleFlashScale>16</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>25</magazineSize>
			<reloadTime>5</reloadTime>
			<ammoSet>AmmoSet_70mmAPKWS</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- ========== Cruise missile turret ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_CMissileTurret</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.09</ShotSpread>
			<SwayFactor>0.1</SwayFactor>
			<Bulk>12.9</Bulk>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootMortarCE</verbClass>
			<forceNormalTimeSpeed>false</forceNormalTimeSpeed>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_TomahawkLAM</defaultProjectile>
			<warmupTime>1.2</warmupTime>
			<minRange>30</minRange>
			<range>500</range>
			<burstShotCount>1</burstShotCount>
			<soundCast>Missile_large</soundCast>
			<muzzleFlashScale>16</muzzleFlashScale>
			<requireLineOfSight>false</requireLineOfSight>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<reloadTime>5</reloadTime>
			<ammoSet>AmmoSet_TomahawkLAM</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
		</FireModes>
	</Operation>

	<!-- ========== Shared settings for direct-fire turrets ========== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[
			defName="EMTurret" or
			defName="CanisterTurret"
			] </xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="EMTurret" or
			defName="CanisterTurret"
			]/statBases/ShootingAccuracyTurret </xpath>
		<value>
			<AimingAccuracy>1.0</AimingAccuracy>
			<ShootingAccuracyTurret>1.0</ShootingAccuracyTurret>
		</value>
	</Operation>

	<!-- Allows turrets to be fired from behind CE embrasures -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[
			defName="EMTurret" or
			defName="CanisterTurret"
			] </xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<!-- ========== Shared settings for mortar and missile Turrets ========== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[
			defName="Auto_Artillery_Mortar" or
			defName="Auto_Cluster_Mortar" or
			defName="Auto_EMP_Mortar" or
			defName="Gun_RocketswarmLauncher_GT" or
			defName="Gun_CMissileTurret"
			]/comps </xpath>
		<value>
			<li Class="CombatExtended.CompProperties_Charges">
				<chargeSpeeds>
					<li>30</li>
					<li>50</li>
					<li>70</li>
					<li>90</li>
				</chargeSpeeds>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@Name="AutoMortarBase_GT"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@Name="AutoMortarBase_GT"]/statBases/WorkToBuild</xpath>
		<value>
			<WorkToBuild>58500</WorkToBuild>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@Name="AutoMortarBase_GT"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>0.875</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[@Name="AutoMortarBase_GT"]/statBases</xpath>
		<value>
			<AimingAccuracy>1</AimingAccuracy>
			<Bulk>25</Bulk>
		</value>
	</Operation>
</Patch>