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


   <!--=============== 40mm gun turret ===============-->



  <ThingDef ParentName="BuildingBase">
	<defName>Turret_40mmGun</defName>
    <label>bofors 40mm</label>
    <description>A 40mm flak gun. leaves gun crates when deconstructed.	Must be manned. Cannot fire over wall. Explodes when damaged.</description>
	<thingClass>AAA.Building_TurretGunCustom</thingClass>
	<graphicData>
      <texPath>AAA/turret/TurretBoforsTire</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <drawSize>(7.0,7.0)</drawSize>
      <damageData>
        <rect>(0.38,0.2,0.56375,0.8)</rect>
        <cornerTL>Damage/Corner</cornerTL>
      </damageData>
    </graphicData>
	 <uiIconPath>AAA/icon/TurretTop_Bofors</uiIconPath>

    <minifiedDef>MinifiedFurniture</minifiedDef>
    <altitudeLayer>Building</altitudeLayer>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(0,0,-2)</interactionCellOffset>
    <stealable>false</stealable>
	<rotatable>true</rotatable>
      <size>(3,3)</size>
	<statBases>
      <MaxHitPoints>480</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <WorkToBuild>3900</WorkToBuild>
      <Mass>2000</Mass>
      <Beauty>-20</Beauty>
    </statBases>
    <passability>PassThroughOnly</passability>
    <pathCost>50</pathCost>
    <fillPercent>0.4</fillPercent>
    <castEdgeShadows>true</castEdgeShadows>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>
    <tickerType>Normal</tickerType>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <designationCategory>Security</designationCategory>
	<costStuffCount>100</costStuffCount>
		<costList>
			<Steel>300</Steel>
			<AAA_Crate_Bofors>1</AAA_Crate_Bofors>
		</costList>
    <leaveResourcesWhenKilled>true</leaveResourcesWhenKilled>
   <inspectorTabs>
      <li>ITab_Shells</li>
    </inspectorTabs>
    <comps>
      <li Class="CompProperties_Forbiddable"/>
      <li Class="CompProperties_Mannable">
        <manWorkType>Violent</manWorkType>
      </li>
	  <li Class="AAA.CompProperties_TurretTopSize">
        <topSize>(3.5,3.5,3.5)</topSize>
      </li>
	  <li Class="CompProperties_Explosive">
        <explosiveRadius>2.9</explosiveRadius>
        <explosiveDamageType>Bomb</explosiveDamageType>
      </li>
	   <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>300</basePowerConsumption>
      </li>
         <li Class="CompProperties_Flickable"/>
  
    </comps>

    <building>
		<turretGunDef>Artillery_40mmGun</turretGunDef>
		<turretTopGraphicPath>AAA/turret/TurretTop_Bofors</turretTopGraphicPath>
		<turretBurstWarmupTime>6.5</turretBurstWarmupTime>
		<turretBurstCooldownTime>30.0</turretBurstCooldownTime>

		<buildingTags>
       	<li>Artillery</li>
		</buildingTags>
	</building>

    <researchPrerequisites>
      <li>AAA_Autocannon</li>
    </researchPrerequisites>
  </ThingDef>
  <!--=============== Mortar turret ===============-->


  <ThingDef Name="AAA_Base40mmWeapon" Abstract="True">
    <category>Item</category>
    <thingClass>ThingWithComps</thingClass>
	     <label>artillery error</label>
    <useHitPoints>false</useHitPoints>
    <equipmentType>Primary</equipmentType>
    <tickerType>Never</tickerType>
    <techLevel>Industrial</techLevel>
    <destroyOnDrop>True</destroyOnDrop>
	<canBeSpawningInventory>false</canBeSpawningInventory>
    <menuHidden>True</menuHidden>
    <tradeability>Never</tradeability>
    <weaponTags>
      <li>Artillery</li>
    </weaponTags>
    <comps>
      <li>
        <compClass>CompEquippable</compClass>
      </li>


   </comps>
    <building>
      <fixedStorageSettings>
        <filter>
          <categories>
            <li>AAA_40mmShells</li>
          </categories>
        </filter>
      </fixedStorageSettings>
      <defaultStorageSettings>
        <filter>
          <categories>
            <li>AAA_40mmShells</li>
          </categories>
        </filter>
      </defaultStorageSettings>
    </building>
	<designationHotKey>Misc3</designationHotKey>

  </ThingDef>
  <ThingDef ParentName="AAA_Base40mmWeapon">
    <defName>Artillery_40mmGun</defName>
    <label>40mm gun</label>
    <description>Bofors 40mm gun . </description>
    <weaponTags>
      <li>Artillery_BaseDestroyer</li>
    </weaponTags>
	 <statBases>
      <AccuracyTouch>0.40</AccuracyTouch>
      <AccuracyShort>0.55</AccuracyShort>
      <AccuracyMedium>0.47</AccuracyMedium>
      <AccuracyLong>0.35</AccuracyLong>
      <RangedWeapon_Cooldown>2.46</RangedWeapon_Cooldown>
      <DeteriorationRate>0</DeteriorationRate>
    </statBases>
	<comps>
		 <li Class="AAA.CompProperties_ReproductiveProjectile">
			<loadcount>7</loadcount>
		</li>
	</comps>
    <verbs>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <forceNormalTimeSpeed>false</forceNormalTimeSpeed>
        <hasStandardCommand>true</hasStandardCommand>
        <warmupTime>4.8</warmupTime>
        <forcedMissRadius>1</forcedMissRadius>
        <requireLineOfSight>true</requireLineOfSight>
        <minRange>7</minRange>
        <range>60</range>
		<burstShotCount>4</burstShotCount>
        <ticksBetweenBurstShots>50</ticksBetweenBurstShots>
		<soundCast>AAA_40mm_shot</soundCast>
		<soundCastTail>GunTail_Heavy</soundCastTail>
        <muzzleFlashScale>20</muzzleFlashScale>
        <targetParams>
          <canTargetLocations>true</canTargetLocations>
        </targetParams>

      </li>
    </verbs>
	 </ThingDef>




	 <!--=============== 40mm gun turret ===============-->
  <ThingDef ParentName="BuildingBase">
	<defName>AAA_Turret_Dual40mmGun</defName>
    <label>Dual Bofors 40mm</label>
    <description>Dual 40mm flak gun. leaves gun crates when deconstructed. Must be manned. Cannot fire over wall. Explodes when damaged.</description>
	<thingClass>AAA.Building_TurretGunCustom</thingClass>
	<graphicData>
      <texPath>AAA/turret/TurretBottom Bofors</texPath>

      <graphicClass>Graphic_Single</graphicClass>
      <drawSize>(3.0,3.0)</drawSize>
      <damageData>
        <rect>(0.38,0.2,0.56375,0.8)</rect>
        <cornerTL>Damage/Corner</cornerTL>
      </damageData>
    </graphicData>
	 <uiIconPath>AAA/icon/TurretTop_DualBofors2</uiIconPath>

    <minifiedDef>MinifiedFurniture</minifiedDef>
    <altitudeLayer>Building</altitudeLayer>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <stealable>false</stealable>
	<rotatable>true</rotatable>
      <size>(2,2)</size>
	<statBases>
      <MaxHitPoints>380</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <WorkToBuild>5900</WorkToBuild>
      <Mass>3000</Mass>
      <Beauty>-20</Beauty>
    </statBases>
    <passability>PassThroughOnly</passability>
    <pathCost>50</pathCost>
    <fillPercent>0.4</fillPercent>
    <castEdgeShadows>true</castEdgeShadows>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>
    <tickerType>Normal</tickerType>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <designationCategory>Security</designationCategory>
	<costStuffCount>50</costStuffCount>
		<costList>
			<Steel>350</Steel>
			<AAA_Crate_Bofors>2</AAA_Crate_Bofors>
		</costList>
    <leaveResourcesWhenKilled>true</leaveResourcesWhenKilled>
   <inspectorTabs>
      <li>ITab_Shells</li>
    </inspectorTabs>
    <comps>
      <li Class="CompProperties_Forbiddable"/>
      <li Class="CompProperties_Mannable">
        <manWorkType>Violent</manWorkType>
      </li>
	  <li Class="AAA.CompProperties_TurretTopSize">
        <topSize>(3.5,3.5,3.5)</topSize>
      </li>
	  <li Class="CompProperties_Explosive">
        <explosiveRadius>2.9</explosiveRadius>
        <explosiveDamageType>Bomb</explosiveDamageType>
      </li>
	   <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>500</basePowerConsumption>
      </li>

    </comps>

    <building>
		<turretGunDef>AAA_Artillery_Dual40mmGun</turretGunDef>
		<turretTopGraphicPath>AAA/turret/TurretTop_DualBofors4</turretTopGraphicPath>
		<turretBurstWarmupTime>6.5</turretBurstWarmupTime>
		<turretBurstCooldownTime>40.0</turretBurstCooldownTime>

		<buildingTags>
       	<li>Artillery</li>
		</buildingTags>
	</building>

    <researchPrerequisites>
      <li>AAA_MultipleAutocannon</li>
    </researchPrerequisites>
  </ThingDef>


  <ThingDef ParentName="AAA_Base40mmWeapon">
    <defName>AAA_Artillery_Dual40mmGun</defName>
    <label>Dual 40mm gun</label>
    <description>Dual Bofors 40mm machine gun . </description>
    <weaponTags>
      <li>Artillery_BaseDestroyer</li>
    </weaponTags>
	 <statBases>
      <AccuracyTouch>0.40</AccuracyTouch>
      <AccuracyShort>0.35</AccuracyShort>
      <AccuracyMedium>0.30</AccuracyMedium>
      <AccuracyLong>0.20</AccuracyLong>
      <RangedWeapon_Cooldown>2.46</RangedWeapon_Cooldown>
      <DeteriorationRate>0</DeteriorationRate>
    </statBases>
	<comps>
		 <li Class="AAA.CompProperties_ReproductiveProjectile">
			<loadcount>7</loadcount>
		</li>
	</comps>
    <verbs>
      <li>
        <verbClass>AAA_Verb_ShootMultiple</verbClass>
        <forceNormalTimeSpeed>false</forceNormalTimeSpeed>
        <hasStandardCommand>true</hasStandardCommand>
        <warmupTime>4.8</warmupTime>
        <forcedMissRadius>2</forcedMissRadius>
        <requireLineOfSight>true</requireLineOfSight>
        <minRange>7</minRange>
        <range>60</range>
		<burstShotCount>4</burstShotCount>
        <ticksBetweenBurstShots>50</ticksBetweenBurstShots>
		<soundCast>AAA_40mm_shot</soundCast>
		<soundCastTail>GunTail_Heavy</soundCastTail>
        <muzzleFlashScale>20</muzzleFlashScale>
        <targetParams>
          <canTargetLocations>true</canTargetLocations>
        </targetParams>

      </li>
    </verbs>
	 </ThingDef>





	 	<!--===============Quad 40mm gun turret ===============-->
  <ThingDef ParentName="BuildingBase">
	<defName>AAA_Turret_Quad40mmGun</defName>
    <label>Quad Bofors 40mm</label>
    <description>Quad 40mm flak gun. leaves gun crates when deconstructed. Must be manned. Cannot fire over wall. Explodes when damaged.</description>
	<thingClass>AAA.Building_TurretGunCustom</thingClass>
	<graphicData>
      <texPath>AAA/turret/TurretBottomBofors2</texPath>

      <graphicClass>Graphic_Single</graphicClass>
      <drawSize>(3.0,3.0)</drawSize>
      <damageData>
        <rect>(0.38,0.2,0.56375,0.8)</rect>
        <cornerTL>Damage/Corner</cornerTL>
      </damageData>
    </graphicData>
	 <uiIconPath>AAA/icon/TurretTop_QuadBofors</uiIconPath>

    <minifiedDef>MinifiedFurniture</minifiedDef>
    <altitudeLayer>Building</altitudeLayer>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(0,0,-2)</interactionCellOffset>
    <stealable>false</stealable>
	<rotatable>true</rotatable>
      <size>(3,3)</size>
	<statBases>
      <MaxHitPoints>480</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <WorkToBuild>7900</WorkToBuild>
      <Mass>5000</Mass>
      <Beauty>-20</Beauty>
    </statBases>
    <passability>PassThroughOnly</passability>
    <pathCost>50</pathCost>
    <fillPercent>0.4</fillPercent>
    <castEdgeShadows>true</castEdgeShadows>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>
    <tickerType>Normal</tickerType>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <designationCategory>Security</designationCategory>
	<costStuffCount>50</costStuffCount>
		<costList>
			<Steel>550</Steel>
			<AAA_Crate_Bofors>4</AAA_Crate_Bofors>
		</costList>
    <leaveResourcesWhenKilled>true</leaveResourcesWhenKilled>
   <inspectorTabs>
      <li>ITab_Shells</li>
    </inspectorTabs>
    <comps>
      <li Class="CompProperties_Forbiddable"/>
      <li Class="CompProperties_Mannable">
        <manWorkType>Violent</manWorkType>
      </li>
	  <li Class="AAA.CompProperties_TurretTopSize">
        <topSize>(3.5,3.5,3.5)</topSize>
      </li>
	  <li Class="CompProperties_Explosive">
        <explosiveRadius>2.9</explosiveRadius>
        <explosiveDamageType>Bomb</explosiveDamageType>
      </li>
	   <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>900</basePowerConsumption>
      </li>

    </comps>

    <building>
		<turretGunDef>AAA_Artillery_Dual40mmGun</turretGunDef>
		<turretTopGraphicPath>AAA/turret/TurretTop_QuadBofors</turretTopGraphicPath>
		<turretBurstWarmupTime>4.0</turretBurstWarmupTime>
		<turretBurstCooldownTime>5.0</turretBurstCooldownTime>

		<buildingTags>
       	<li>Artillery</li>
		</buildingTags>
	</building>

    <researchPrerequisites>
      <li>AAA_MultipleAutocannon</li>
    </researchPrerequisites>
  </ThingDef>


  <ThingDef ParentName="AAA_Base40mmWeapon">
    <defName>AAA_Artillery_Quad40mmGun</defName>
    <label>Dual 40mm gun</label>
    <description>Dual Bofors 40mm machine gun . </description>
    <weaponTags>
      <li>Artillery_BaseDestroyer</li>
    </weaponTags>
	 <statBases>
      <AccuracyTouch>0.40</AccuracyTouch>
      <AccuracyShort>0.35</AccuracyShort>
      <AccuracyMedium>0.30</AccuracyMedium>
      <AccuracyLong>0.20</AccuracyLong>
      <RangedWeapon_Cooldown>2.46</RangedWeapon_Cooldown>
      <DeteriorationRate>0</DeteriorationRate>
    </statBases>
	<comps>
		 <li Class="AAA.CompProperties_ReproductiveProjectile">
			<loadcount>7</loadcount>
		</li>
	</comps>
    <verbs>
      <li>
        <verbClass>AAA_Verb_ShootMultiple</verbClass>
        <forceNormalTimeSpeed>false</forceNormalTimeSpeed>
        <hasStandardCommand>true</hasStandardCommand>
        <warmupTime>4.8</warmupTime>
        <forcedMissRadius>2</forcedMissRadius>
        <requireLineOfSight>true</requireLineOfSight>
        <minRange>7</minRange>
        <range>60</range>
		<burstShotCount>8</burstShotCount>
        <ticksBetweenBurstShots>50</ticksBetweenBurstShots>
		<soundCast>AAA_40mm_shot</soundCast>
		<soundCastTail>GunTail_Heavy</soundCastTail>
        <muzzleFlashScale>20</muzzleFlashScale>
        <targetParams>
          <canTargetLocations>true</canTargetLocations>
        </targetParams>

      </li>
    </verbs>
	 </ThingDef>







	 <!-- ======== Crate ======== -->

  <ThingDef ParentName="ResourceBase">
    <defName>AAA_Crate_Bofors</defName>
    <label>40mm machine gun crate</label>
    <description>40mm Bofors anti aircraft artillery. This is too heavy to hold. you need to make a turret for this.</description>
    <thingClass>ThingWithComps</thingClass>
    <graphicData>
      <texPath>AAA/Crate</texPath>
      <graphicClass>Graphic_Single</graphicClass>
	   <drawSize>(1,1)</drawSize>
    </graphicData>
    <soundInteract>Metal_Drop</soundInteract>
    <soundDrop>Standard_Drop</soundDrop>
    <stackLimit>1</stackLimit>

    <statBases>
      <MaxHitPoints>300</MaxHitPoints>
      <MarketValue>9050</MarketValue>
      <Mass>840</Mass>
      <Flammability>0</Flammability>
			<DeteriorationRate>0</DeteriorationRate>
		</statBases>
    <intricate>true</intricate>
    <thingCategories>
      <li>WeaponsRanged</li>
    </thingCategories>
    <tradeTags>
      <li>Exotic</li>
    </tradeTags>

  </ThingDef>


  </Defs>
