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

	<!-- === Tools === -->
	<Operation Class="PatchOperationFindMod">
		<mods>
			<li>Big and Small - Enable All Optional Content</li>
			<li>Big and Small - Slimes</li>
			<li>Randy Random's Rayguns - Ordinary Spacer Weapons</li>
		</mods>
		<match Class="PatchOperationSequence">
			<operations>

				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="BMad_ShrinkRay" or defName="BMad_GrowthRay"]/tools</xpath>
					<value>
						<tools>
							<li Class="CombatExtended.ToolCE">
								<label>stock</label>
								<capacities>
									<li>Blunt</li>
								</capacities>
								<power>8</power>
								<cooldownTime>1.55</cooldownTime>
								<chanceFactor>1.5</chanceFactor>
								<armorPenetrationBlunt>2.755</armorPenetrationBlunt>
								<linkedBodyPartsGroup>Stock</linkedBodyPartsGroup>
							</li>
							<li Class="CombatExtended.ToolCE">
								<label>barrel</label>
								<capacities>
									<li>Blunt</li>
								</capacities>
								<power>5</power>
								<cooldownTime>2.02</cooldownTime>
								<armorPenetrationBlunt>1.630</armorPenetrationBlunt>
								<linkedBodyPartsGroup>Barrel</linkedBodyPartsGroup>
							</li>
							<li Class="CombatExtended.ToolCE">
								<label>muzzle</label>
								<capacities>
									<li>Poke</li>
								</capacities>
								<power>8</power>
								<cooldownTime>1.55</cooldownTime>
								<armorPenetrationBlunt>2.755</armorPenetrationBlunt>
								<linkedBodyPartsGroup>Muzzle</linkedBodyPartsGroup>
							</li>
						</tools>
					</value>
				</li>

				<!-- Mod Extensions -->
				<li Class="PatchOperationAddModExtension">
					<xpath>Defs/ThingDef[defName="BMad_ShrinkRay" or defName="BMad_GrowthRay"]</xpath>
					<value>
						<li Class="CombatExtended.GunDrawExtension">
							<DrawSize>1.16,1.16</DrawSize>
							<DrawOffset>0.08,0.0</DrawOffset>
						</li>
					</value>
				</li>

				<!-- === Shrink Ray === -->
				<li Class="CombatExtended.PatchOperationMakeGunCECompatible">
					<defName>BMad_ShrinkRay</defName>
					<statBases>
						<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
						<SightsEfficiency>0.7</SightsEfficiency>
						<ShotSpread>0.07</ShotSpread>
						<SwayFactor>1.33</SwayFactor>
						<Bulk>10</Bulk>
						<Mass>8</Mass>
						<WorkToMake>45000</WorkToMake>
					</statBases>
					<costList>
						<Steel>50</Steel>
						<Plasteel>30</Plasteel>
						<ComponentIndustrial>5</ComponentIndustrial>
						<ComponentSpacer>3</ComponentSpacer>
					</costList>
					<Properties>
						<recoilAmount>1.50</recoilAmount>
						<verbClass>CombatExtended.Verb_ShootCE</verbClass>
						<hasStandardCommand>true</hasStandardCommand>
						<defaultProjectile>Projectile_ShrinkRay</defaultProjectile>
						<warmupTime>1.1</warmupTime>
						<range>19</range>
						<soundCast>Resurrect_Resolve</soundCast>
						<soundCastTail>GunTail_Heavy</soundCastTail>
						<muzzleFlashScale>9</muzzleFlashScale>
					</Properties>
					<AmmoUser>
						<magazineSize>10</magazineSize>
						<reloadTime>3</reloadTime>
						<ammoSet>AmmoSet_ShrinkRay</ammoSet>
					</AmmoUser>
					<FireModes>
						<aiAimMode>AimedShot</aiAimMode>
					</FireModes>
				</li>

				<!-- === Growth Ray === -->
				<li Class="PatchOperationAttributeSet">
					<xpath>Defs/ThingDef[defName="BMad_GrowthRay"]</xpath>
					<attribute>ParentName</attribute>
					<value>BaseHumanMakeableGun</value>
				</li>

				<li Class="PatchOperationAdd">
					<xpath>Defs/ThingDef[defName="BMad_GrowthRay"]</xpath>
					<value>
						<recipeMaker>
							<skillRequirements>
								<Crafting>7</Crafting>
							</skillRequirements>
							<displayPriority>400</displayPriority>
							<workSpeedStat>GeneralLaborSpeed</workSpeedStat>
							<researchPrerequisites>
								<li>GunTurrets</li>
								<li>BS_MadScienceField</li>
							</researchPrerequisites>
						</recipeMaker>
					</value>
				</li>

				<li Class="CombatExtended.PatchOperationMakeGunCECompatible">
					<defName>BMad_GrowthRay</defName>
					<statBases>
						<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
						<SightsEfficiency>0.7</SightsEfficiency>
						<ShotSpread>0.07</ShotSpread>
						<SwayFactor>1.33</SwayFactor>
						<Bulk>10</Bulk>
						<Mass>8</Mass>
						<WorkToMake>45000</WorkToMake>
					</statBases>
					<costList>
						<Steel>50</Steel>
						<Plasteel>30</Plasteel>
						<ComponentIndustrial>5</ComponentIndustrial>
						<ComponentSpacer>3</ComponentSpacer>
					</costList>
					<Properties>
						<recoilAmount>1.50</recoilAmount>
						<verbClass>CombatExtended.Verb_ShootCE</verbClass>
						<hasStandardCommand>true</hasStandardCommand>
						<defaultProjectile>Projectile_GrowthRay</defaultProjectile>
						<warmupTime>1.1</warmupTime>
						<range>19</range>
						<soundCast>Resurrect_Resolve</soundCast>
						<soundCastTail>GunTail_Heavy</soundCastTail>
						<muzzleFlashScale>9</muzzleFlashScale>
					</Properties>
					<AmmoUser>
						<magazineSize>10</magazineSize>
						<reloadTime>3</reloadTime>
						<ammoSet>AmmoSet_GrowthRay</ammoSet>
					</AmmoUser>
					<FireModes>
						<aiAimMode>AimedShot</aiAimMode>
					</FireModes>
				</li>

			</operations>
		</match>
	</Operation>
</Patch>