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

	<!-- Remove refuelable property -->
	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[
			defName="COMIGO_FloatingTurret_Simple" or
			defName="COMIGO_FloatingTurret_Double" or
			defName="COMIGO_FloatingTurret_Slug" or
			defName="COMIGO_FloatingTurret_EMP"
			]/comps/li[@Class="CompProperties_Refuelable"] </xpath>
	</Operation>

	<!-- Replace vanilla thingClass -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="COMIGO_FloatingTurret_Simple" or
			defName="COMIGO_FloatingTurret_Slug" or
			defName="COMIGO_FloatingTurret_Double" or
			defName="COMIGO_FloatingTurret_EMP"
			]/thingClass </xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<!-- Make turrets taller -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="COMIGO_FloatingTurret_Simple" or
			defName="COMIGO_FloatingTurret_Double" or
			defName="COMIGO_FloatingTurret_Slug" or
			defName="COMIGO_FloatingTurret_EMP"
			]/fillPercent </xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[
			defName="COMIGO_FloatingTurret_Simple" or
			defName="COMIGO_FloatingTurret_Double" or
			defName="COMIGO_FloatingTurret_Slug" or
			defName="COMIGO_FloatingTurret_EMP"
			]/statBases </xpath>
		<value>
			<AimingAccuracy>0.25</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="COMIGO_FloatingTurret_Simple" or
			defName="COMIGO_FloatingTurret_Double" or
			defName="COMIGO_FloatingTurret_Slug" or
			defName="COMIGO_FloatingTurret_EMP"
			]/statBases/ShootingAccuracyTurret </xpath>
		<value>
			<ShootingAccuracyTurret>0.5</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="COMIGO_FloatingTurret_Simple" or
			defName="COMIGO_FloatingTurret_Double" or
			defName="COMIGO_FloatingTurret_Slug" or
			defName="COMIGO_FloatingTurret_EMP"
			]/building/turretBurstCooldownTime </xpath>
		<value>
			<turretBurstCooldownTime>1.6</turretBurstCooldownTime>
		</value>
	</Operation>

	<!-- Simple Turret -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>COMIGO_FloatingTurret_Simple_Gun</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.65</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.07</ShotSpread>
			<SwayFactor>0.82</SwayFactor>
			<Bulk>10.00</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.76</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_556x45mmNATO_FMJ</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>48</range>
			<ticksBetweenBurstShots>7</ticksBetweenBurstShots>
			<burstShotCount>5</burstShotCount>
			<soundCast>GunShotA</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>100</magazineSize>
			<reloadTime>7.8</reloadTime>
			<ammoSet>AmmoSet_556x45mmNATO</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- Double Simple Turret -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>COMIGO_FloatingTurret_Double_Gun</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.65</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.07</ShotSpread>
			<SwayFactor>0.82</SwayFactor>
			<Bulk>10.00</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.76</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_556x45mmNATO_FMJ</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>48</range>
			<ticksBetweenBurstShots>3</ticksBetweenBurstShots>
			<burstShotCount>10</burstShotCount>
			<soundCast>GunShotA</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>200</magazineSize>
			<reloadTime>12</reloadTime>
			<ammoSet>AmmoSet_556x45mmNATO</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- Slug Turret -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="COMIGO_FloatingTurret_Slug"]/description</xpath>
		<value>
			<description>An anchored turret that can float on water and fires a heavy round, capable of defeating armor at long distance.</description>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="COMIGO_FloatingTurret_Slug"]/researchPrerequisites</xpath>
		<value>
			<researchPrerequisites>
				<li>CE_TurretHeavyWeapons</li>
			</researchPrerequisites>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>COMIGO_FloatingTurret_Slug_Gun</defName>
		<statBases>
			<MarketValue>2000</MarketValue>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.01</ShotSpread>
			<SwayFactor>1.6</SwayFactor>
			<RangedWeapon_Cooldown>0.76</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>1.52</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_145x114mm_FMJ</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>75</range>
			<ticksBetweenBurstShots>9</ticksBetweenBurstShots>
			<burstShotCount>8</burstShotCount>
			<soundCast>HeavyMG</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>16</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>40</magazineSize>
			<reloadTime>8.4</reloadTime>
			<ammoSet>AmmoSet_145x114mm</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- EMP Turret -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="COMIGO_FloatingTurret_EMP"]/description</xpath>
		<value>
			<description>An anchored turret that can float and that launches various explosive shells.</description>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="COMIGO_FloatingTurret_EMP"]/label</xpath>
		<value>
			<label>Floating turret with a grenade launcher</label>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>COMIGO_FloatingTurret_EMP_Gun</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.12</ShotSpread>
			<SwayFactor>1.20</SwayFactor>
			<Bulk>8.00</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.83</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_25x40mmGrenade_HE</defaultProjectile>
			<warmupTime>1.1</warmupTime>
			<range>48</range>
			<ticksBetweenBurstShots>6</ticksBetweenBurstShots>
			<burstShotCount>3</burstShotCount>
			<soundCast>Shot_IncendiaryLauncher</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>18</magazineSize>
			<reloadTime>7.8</reloadTime>
			<ammoSet>AmmoSet_25x40mmGrenade</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
		<weaponTags>
			<li>TurretGun</li>
		</weaponTags>
	</Operation>
</Patch>