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

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

	<!-- Replace vanilla thingClass -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientSecurityTurret"]/thingClass </xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

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

	<!-- Make turrets taller -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientSecurityTurret"]/fillPercent</xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientPointDefense"]</xpath>
		<value>
			<fillPercent>0.95</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[
			defName="VFEA_Turret_AncientSecurityTurret" or
			defName="VFEA_Turret_AncientPointDefense"
			]/statBases </xpath>
		<value>
			<AimingAccuracy>0.75</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientSecurityTurret"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>1.1</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientPointDefense"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>1.25</ShootingAccuracyTurret>
		</value>
	</Operation>

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

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientSecurityTurret" or defName="VFEA_Turret_AncientPointDefense"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientSecurityTurret"]/fillPercent</xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<!-- Make turrets taller -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFEA_Turret_AncientSecurityTurret"]/statBases/MaxHitPoints</xpath>
		<value>
			<MaxHitPoints>125</MaxHitPoints>
		</value>
	</Operation>

	<!-- Ancient Security Turret -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>VFEA_Gun_AncientSecurityTurret</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.35</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.05</ShotSpread>
			<SwayFactor>0.78</SwayFactor>
			<Bulk>10.00</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>0.71</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_556x45mmNATO_FMJ</defaultProjectile>
			<warmupTime>1.2</warmupTime>
			<range>54</range>
			<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
			<burstShotCount>10</burstShotCount>
			<soundCast>GunShotA</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>300</magazineSize>
			<reloadTime>9.5</reloadTime>
			<ammoSet>AmmoSet_556x45mmNATO</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- Ancient Point Defense Gun -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>VFEA_Gun_AncientPointDefenseTurret</defName>
		<statBases>
			<RangedWeapon_Cooldown>0.35</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.05</ShotSpread>
			<SwayFactor>1.32</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>0.25</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_556x45mmNATO_FMJ</defaultProjectile>
			<warmupTime>2.3</warmupTime>
			<range>62</range>
			<burstShotCount>50</burstShotCount>
			<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
			<soundCast>Shot_Minigun</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
			<targetParams>
				<canTargetLocations>True</canTargetLocations>
			</targetParams>
		</Properties>
		<AmmoUser>
			<magazineSize>1000</magazineSize>
			<reloadTime>9.2</reloadTime>
			<ammoSet>AmmoSet_556x45mmNATO</ammoSet>
		</AmmoUser>
		<weaponTags Inherit="False">
			<li>TurretGun</li>
		</weaponTags>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFEA_Gun_AncientPointDefenseTurret"]/verbs</xpath>
		<value>
			<li Class="CombatExtended.VerbProperties_CIWSProjectile">
				<verbClass>CombatExtended.VerbCIWSProjectile</verbClass>
				<recoilAmount>0.25</recoilAmount>
				<hasStandardCommand>true</hasStandardCommand>
				<defaultProjectile>Bullet_556x45mmNATO_FMJ</defaultProjectile>
				<warmupTime>0.4</warmupTime>
				<range>105</range>
				<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
				<burstShotCount>10</burstShotCount>
				<soundCast>Shot_Minigun</soundCast>
				<soundCastTail>GunTail_Heavy</soundCastTail>
				<muzzleFlashScale>9</muzzleFlashScale>
				<recoilPattern>Mounted</recoilPattern>
				<holdFireLabel>HoldCloseInProjectilesFire</holdFireLabel>
				<holdFireDesc>HoldCloseInProjectilesFireDesc</holdFireDesc>
			</li>
			<li Class="CombatExtended.VerbProperties_CIWSSkyfaller">
				<verbClass>CombatExtended.VerbCIWSSkyfaller</verbClass>
				<recoilAmount>0.25</recoilAmount>
				<hasStandardCommand>true</hasStandardCommand>
				<defaultProjectile>Bullet_556x45mmNATO_FMJ</defaultProjectile>
				<warmupTime>0.4</warmupTime>
				<range>105</range>
				<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
				<burstShotCount>10</burstShotCount>
				<soundCast>Shot_Minigun</soundCast>
				<soundCastTail>GunTail_Heavy</soundCastTail>
				<muzzleFlashScale>9</muzzleFlashScale>
				<recoilPattern>Mounted</recoilPattern>
				<holdFireLabel>HoldCloseInSkyfallersFire</holdFireLabel>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFEA_Gun_AncientPointDefenseTurret"]/comps</xpath>
		<value>
			<li>
				<compClass>CombatExtended.CompVerbDisabler</compClass>
			</li>
		</value>
	</Operation>

</Patch>