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

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

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

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

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

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

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

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

	<!-- Pulse Turret -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Gun_PulseTurret</defName>
		<statBases>
			<SightsEfficiency>1.15</SightsEfficiency>
			<ShotSpread>0.08</ShotSpread>
			<SwayFactor>0.72</SwayFactor>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<NightVisionEfficiency_Weapon>0.5</NightVisionEfficiency_Weapon>
		</statBases>
		<Properties>
			<recoilAmount>0.85</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_DV_PulseRifle_CE</defaultProjectile>
			<ammoConsumedPerShotCount>2</ammoConsumedPerShotCount>
			<warmupTime>1.3</warmupTime>
			<range>55</range>
			<ticksBetweenBurstShots>5</ticksBetweenBurstShots>
			<burstShotCount>10</burstShotCount>
			<soundCast>Shot_PulseMedium</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<AmmoUser>
			<magazineSize>200</magazineSize>
			<reloadTime>7.8</reloadTime>
			<ammoSet>AmmoSet_DV_PulseRifle</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
			<noSingleShot>true</noSingleShot>
		</FireModes>
		<weaponTags Inherit="False">
			<li>TurretGun</li>
		</weaponTags>
	</Operation>
</Patch>