<?xml version="1.0" encoding="utf-8" ?>
<Defs>
  <!--=============== C-RAM turret ===============-->

	<ThingDef ParentName="BuildingBase">
    <defName>CIWS_Turret</defName>
    <label>C-RAM turret</label>
    <thingClass>AAA.Building_TurretGunCustom</thingClass>
	  <graphicData>
			<texPath>AAA/turret/TurretBottom</texPath>
			<graphicClass>Graphic_Single</graphicClass>
			<drawSize>(2,2)</drawSize>
			<damageData>
        <rect>(0.2,0.2,0.6,0.6)</rect>
			</damageData>
    </graphicData>

   <uiIconPath>AAA/icon/TurretTop_C-RAM</uiIconPath>

	<minifiedDef>MinifiedFurniture</minifiedDef>
    <altitudeLayer>Building</altitudeLayer>
    <stealable>false</stealable>
    <rotatable>true</rotatable>
      <size>(2,2)</size>
	<statBases>
      <MaxHitPoints>320</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <WorkToBuild>40900</WorkToBuild>
      <Mass>300</Mass>
      <Beauty>-20</Beauty>
    </statBases>
    <tickerType>Normal</tickerType>
    <comps>
      <li Class="CompProperties_Explosive">
        <explosiveRadius>3.9</explosiveRadius>
        <explosiveDamageType>Bomb</explosiveDamageType>
        <chanceNeverExplodeFromDamage>0.5</chanceNeverExplodeFromDamage>
      </li>
      <li Class="CompProperties_Forbiddable"/>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>2000</basePowerConsumption>
      </li>
      <li Class="CompProperties_Flickable"/>
      <li Class="CompProperties_Breakdownable"/>
	  <li Class="AAA.CompProperties_TurretTopSize">
        <topSize>(2.0,2.0,2.0)</topSize>
      </li>
    </comps>
    <description>A close-in weapon system turret. Fires at nearby enemies Automatically. Its hacked-together AI brain isn't very smart, and can't shoot down incoming projectile.  Explodes when damaged.</description>
    <passability>Impassable</passability>
    <castEdgeShadows>true</castEdgeShadows>
    <hasTooltip>true</hasTooltip>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>
    <costStuffCount>75</costStuffCount>
    <costList>
      <Steel>600</Steel>
      <Component>25</Component>
    </costList>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <designationCategory>Security</designationCategory>
    <specialDisplayRadius>25.9</specialDisplayRadius>
    <building>
			<ai_combatDangerous>true</ai_combatDangerous>
      <turretGunDef>Gun_CIWS_turret</turretGunDef>
      <turretBurstCooldownTime>7.85</turretBurstCooldownTime>
      <turretTopGraphicPath>AAA/turret/TurretTop_C-RAM</turretTopGraphicPath>
    </building>
	<staticSunShadowHeight>0.60</staticSunShadowHeight>

    <designationHotKey>Misc2</designationHotKey>
    <researchPrerequisites>
      <li>AAA_Gatling</li>
    </researchPrerequisites>
  </ThingDef>

  <ThingDef ParentName="BaseBullet">
    <defName>Bullet_CIWS_turret</defName>
    <label>improvised turret bullet</label>
    <graphicData>
      <texPath>Things/Projectile/Bullet_Small</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
	<thingClass>Projectile_Explosive</thingClass>
	<comps>
	  <li Class="AAA.CompProperties_ProjectileMultiple">
			<pellets>1</pellets>
		    <!--forsedScatterRadius>0.5</forsedScatterRadius-->
			<scatterRadiusAt10tilesAway>0.3</scatterRadiusAt10tilesAway>
	  </li>
    </comps>
    <projectile>
      <damageDef>Bomb</damageDef>
      <!--damageAmountBase>2</damageAmountBase-->
      <damageAmountBase>20</damageAmountBase>
	<explosionRadius>0.9</explosionRadius>
      <speed>60</speed>
    </projectile>
  </ThingDef>

  <ThingDef ParentName="BaseHumanGun">
    <defName>Gun_CIWS_turret</defName>
    <label>Gun_C-RAM turret gun</label>
    <graphicData>
      <texPath>Things/Item/Equipment/WeaponRanged/ChargeRifle</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <menuHidden>true</menuHidden>
    <description>Jury-rigged gun attached to a turret.</description>
    <soundInteract>InteractRifle</soundInteract>
    <canBeSpawningInventory>false</canBeSpawningInventory>
    <tradeability>Never</tradeability>
    <destroyOnDrop>true</destroyOnDrop>
    <useHitPoints>false</useHitPoints>
    <statBases>
      <AccuracyTouch>0.20</AccuracyTouch>
      <AccuracyShort>0.15</AccuracyShort>
      <AccuracyMedium>0.11</AccuracyMedium>
      <AccuracyLong>0.12</AccuracyLong>
      <RangedWeapon_Cooldown>15.66</RangedWeapon_Cooldown>
      <DeteriorationRate>0</DeteriorationRate>
    </statBases>
    <weaponTags>
      <li>TurretGun</li>
    </weaponTags>
    <verbs>
      <li>
        <verbClass>AAA_Verb_ShootMultiple</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>Bullet_CIWS_turret</defaultProjectile>
        <warmupTime>2.0</warmupTime>
       <minRange>2</minRange>
  <forcedMissRadius>1</forcedMissRadius>
	 <range>19.9</range>
        <ticksBetweenBurstShots>1</ticksBetweenBurstShots>
        <burstShotCount>60</burstShotCount>
        <soundCast>AAA_gatling_shot</soundCast>
        <soundCastTail>GunTail_Light</soundCastTail>
        <muzzleFlashScale>12</muzzleFlashScale>
      </li>
    </verbs>
  </ThingDef>



  </Defs>
