PART
{
	// Kerbal Space Program - Part Config

	// --- general parameters ---
	name = missileTurretTest
	module = Part
	author = BahamutoD

	// --- asset parameters ---
	mesh = model.mu
	rescaleFactor = 1


	// --- node definitions ---
	node_attach = 0.0, -0.4362216, 0, 0, -1, 0, 0
	node_stack_bottom = 0.0, -0.4362216, 0, 0, -1, 0, 1
	node_stack_missile1 = -0.7069921, 0.439827, 0.8738811, 0, 1, 0, 0
	node_stack_missile2 = 0.7069921, 0.439827, 0.8738811, 0, 1, 0, 0
	node_stack_missile3 = -1.289303, 0.439827, 0.8738811, 0, 1, 0, 0
	node_stack_missile4 = 1.289303, 0.439827, 0.8738811, 0, 1, 0, 0
	node_stack_missile5 = -0.7069921, 0.1269047, 0.8738811, 0, -1, 0, 0
	node_stack_missile6 = 0.7069921, 0.1269047, 0.8738811, 0, -1, 0, 0
	node_stack_missile7 = -1.289303, 0.1269047, 0.8738811, 0, -1, 0, 0
	node_stack_missile8 = 1.289303, 0.1269047, 0.8738811, 0, -1, 0, 0
	stackSymmetry = 1

	// --- editor parameters ---
	TechRequired = precisionEngineering
	entryCost = 3000
	cost = 1000
	category = none
	bdacategory = Missile turrets
	subcategory = 0
	bulkheadProfiles = size1, srf
	title = #loc_BDArmory_part_missileTurretTest_title //Jernas Missile Turret
	manufacturer = #loc_BDArmory_agent_title  //Bahamuto Dynamics
	description = #loc_BDArmory_part_missileTurretTest_description //A turret capable of holding and firing up to 8 small to medium sized missiles.  Comes with an integrated detection and tracking radar.  Warranty void if anything except missiles are mounted.  To enable the turret, select the mounted missile from the weapon manager.
	// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
	attachRules = 1,1,1,0,1
	tags = #loc_BDArmory_part_missileTurretTest_tags 
	// --- standard part parameters ---
	mass = 0.75
	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.2
	angularDrag = 2
	crashTolerance = 60
	maxTemp = 3600


	MODULE
	{
		name = ModuleTurret

		turretID = 0

		pitchTransformName = pitchTransform
		yawTransformName = yawTransform

		pitchSpeedDPS = 55
		yawSpeedDPS = 55

		maxPitch = 75
		minPitch = -8

		yawRange = 360

		smoothRotation = true
		smoothMultiplier = 10

		audioPath = BDArmory/Sounds/hydraulicLoop
		maxAudioPitch = 0.565
		minAudioPitch = 0.15
	}

	MODULE
	{
		name = MissileTurret

		turretID = 0

		finalTransformName = pitchTransform

		disableRadarYaw = true
	}

	MODULE
	{
        name = ModuleRadar

        // -- Section: General Configuration --
        radarName = Jernas Radar		// if left empty part.title is used, but advised to set this to a nice printable text
        rwrThreatType = 0				// IMPORTANT, please set correctly:
                                // 0 = SAM site radar
                                // 1 = Fighter radar (airborne)
                                // 2 = AWACS radar (airborne)
                                // 3, 4 = ACTIVE MISSILE (DO NOT USE UNLESS YOU KNOW WHAT YOU'RE DOING!
                                // 5 = Detection radar (ground/ship based)
                                // 6 = SONAR (ship/submarine based)
        rotationTransformName = scanRotation
	    turretID = 1					// if needed
        resourceDrain = 0.5				// change to higher values for more capable radars, e.g AESA

        // -- Section: Capabilities --
        omnidirectional = true				// false: boresight scan radar
        directionalFieldOfView = 90			// for omni and boresight
        //boresightFOV = 10				// for boresight only
        scanRotationSpeed = 190				// degress per second
        //lockRotationSpeed = 120				// only relevant if canLock
        //lockRotationAngle = 4
        showDirectionWhileScan = true			// can show target direction on radar screen. False: radar echos displayed as block only (no direction)
        //multiLockFOV = 30				// only relevant if canLock
        //lockAttemptFOV = 2				// only relevant if canLock
        maxLocks = 1					//how many targets can be locked/tracked simultaneously. only relevant if canLock

        canScan = true					// scanning/detecting targets (volume search)
        canLock = true					// locking/tracking targets (fire control)
        canTrackWhileScan = true			// continue scanning while tracking a locked target
        canReceiveRadarData = true			// can work as passive data receiver

        minSignalThreshold = 300				// DEPRECATED, NO LONGER USED! use detection float curve!
        minLockedSignalThreshold = 220			// DEPRECATED, NO LONGER USED! use locktrack float curve!

        radarGroundClutterFactor = 0.1			// how much is the radar efficiency reduced to by ground clutter/look-down?
                                // 0.0 = reduced to 0% (=IMPOSSIBLE to detect ground targets)
                                // 1.0 = fully efficient (no difference between air & ground targets)
                                // default if unset: 0.25
                                // Ground targets, especially ships, already have a massively larger RCS than fighters, hence
                                // any ground clutter factor >0.25 is to be considered very good, making an efficient surface/horizon search radar.
                                // values >1.0 are possible, meaning the radar is MORE efficient during look down than vs air targets.

        radarDetectionCurve
        {
          // floatcurve to define at what range (km) which minimum cross section (m^2) can be detected.
          // this defines both min/max range of the radar, and sensitivity/efficiency
          // it is recommended to define an "assured detection range", at which all craft are detected regardless
          //     of their rcs. This is achieved by using a minrcs value of zero, thus detecting everything.
          //        key = distance	rcs
                    key = 0.0	0
                    key = 5	0	//between 0 and 5 km the min cross section is 0, thus assured detection of everything
                    key = 10 10   //
                    key = 15 20   //
                    key = 20 25	// this radar is NOT very good at detection (limited range, needs large rcs)
        }

        radarLockTrackCurve
        {
            // same as detectionCurve, just for locking/tracking purpose
            // ATTENTION: DO NOT USE an "assured locking range" here, as this would render lock-breaking
            //   ECM-jammers & chaff completely ineffective!!
            //      key = distance	rcs
                    key = 0.0	0
                    key = 5	5    //for tracking locks the radar is highly sensitive
                    key = 10 7	//this radar is relatively  good at locking/tracking
                    key = 15 15   //
                    key = 20 20	// this radar is NOT very good at detection (limited range, needs large rcs)
        }

	}

	MODULE
	{
		name = ModuleTurret

		turretID = 1

		pitchTransformName = radarPitch
		yawTransformName = radarYaw

		pitchSpeedDPS = 125
		yawSpeedDPS = 125

		maxPitch = 80
		minPitch = -1

		yawRange = 360

		smoothRotation = true
		smoothMultiplier = 10
	}

}
