PART
{
    // Kerbal Space Program - Part Config

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

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

    // --- node definitions ---
    node_attach = 0.0, 0.06188124, 0, 0, 1, 0, 0
    node_stack_top = 0.0, 0.06188124, 0, 0, 1, 0, 0

    // --- editor parameters ---
    TechRequired = precisionEngineering
    entryCost = 1400
    cost = 1200
    category = none
    bdacategory = Missiles
    subcategory = 0
    bulkheadProfiles = srf
    title = #loc_BDArmory_part_bahaAim9_title //AIM-9 Sidewinder Missile
    manufacturer = #loc_BDArmory_agent_title //Bahamuto Dynamics
    description = #loc_BDArmory_part_bahaAim9_description //Short range heat seeking missile with limited flare rejection capabilities.
    // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
    attachRules = 1,1,0,0,1
	tags = #loc_BDArmory_part_bahaAim9_tags
    // --- standard part parameters ---
    mass = 0.085
    dragModelType = default
    maximum_drag = 0.01
    minimum_drag = 0.01
    angularDrag = 2
    crashTolerance = 5
    maxTemp = 3600


    MODULE
    {
        name = MissileLauncher

        shortName = AIM-9

        thrust = 22 //KN thrust during boost phase
        cruiseThrust = 12 //thrust during cruise phase
        dropTime = 0.1 //how many seconds after release until engine ignites
        boostTime = 3.5 //seconds of boost phase
        cruiseTime = 30 //seconds of cruise phase
        guidanceActive = true //missile has guidanceActive
        maxTurnRateDPS = 45 //degrees per second
        decoupleSpeed = 5
        decoupleForward = false

        audioClipPath = BDArmory/Sounds/rocketLoop
        exhaustPrefabPath = BDArmory/Models/exhaust/smallExhaust
        boostExhaustPrefabPath = BDArmory/Models/exhaust/mediumExhaust
        boostExhaustTransformName = boostTransform
        boostTransformName = boostTransform

        optimumAirspeed = 894

        aero = true
        liftArea = 0.002
        steerMult = 4
        maxTorque = 35
        maxAoA = 55
        //aeroSteerDamping = 4.5
        torqueRampUp = 50
        gLimit = 30

        engineFailureRate = 0    // Probability the missile engine will fail to start (0-1), evaluated once on missile launch
		guidanceFailureRate = 0  // Probability the missile guidance will fail per second (0-1), evaluated every frame after launch

        homingType = aam
        terminalHoming = true
        terminalHomingType = ProNav
        terminalHomingRange = 3000
        pronavGain = 7

        missileType = missile
        targetingType = heat
        seekerTimeout = 1 //timelimit without a detected target before heat-seeking guidance fails (default is 1).
        heatThreshold = 50   // Distance-adjusted heat of target in order to be detected by missile, lower value results in better detection range
        frontAspectHeatModifier = 1 // Modifies the heat signature of craft when ASPECTED_IR_SEEKERS = true in BDA settings.cfg. Useful for making rear-aspect only heaters (set frontAspectHeatModifier < 1), ex:
        // Heat value within 50 deg cone of non-prop engine exhaust: (Engine Heat)
        // Heat value outside of 50 deg cone of engine exhaust (or a prop engine): (Engine Heat) * frontAspectHeatModifier * (Internally Calculated Occlusion Factor)
        maxOffBoresight = 90 //maximum angle, from the boresight, that the missile can track the target. This also controls how the missile can launch off boresight. When launched from the air at another air target with uncagedLock = false, launch off boresight is at 0.35*maxOffBoresight, otherwise it is at 0.75*,maxOffBoresight (uncagedLock = true OR either launching craft or target is landed/splashed).
		uncagedLock = false // true: Allows missile to be cued to a radar target, also controls launch conditions, see above
        // allAspect = false // DEPRECATED - use uncagedLock instead
        targetCoM = false // if true: target CoM instead of hottest part
        lockedSensorFOV = 6 // How much the seeker can see in the direction it is looking (in terms of angle cone).
        flareEffectivity = 1 // Modifies how the missile targeting is affected by flares, 1 is fully affected (normal behavior), lower values mean less affected (0 is ignores flares), higher values means more affected. This is a simple multiplier for flares, use the locked sensor bias curves for more sophisticated flare rejection behavior.
        lockedSensorFOVBias
        {
            // floatcurve to define how the missile weights targets and flares off the center of where the seeker is looking
            // is only active once the missile has locked onto a target
            // should be set from 0 (seeker is looking directly at target/flare) to at least lockedSensorFOV/2 (target/flare is on edge of sensor FOV)
            // it is recommended that the value at 0 be set to 1.0 and max value set to 0. Here is an example of an effective flare rejection curve:
            //		key = angle off seeker centerline   weighting bias
            //		key = 0.0   1       // Highest weighing on centerline
            //		key = 3     0.83    // 17% lower weighting at edge of sensor FOV
            //		key = 10    0.25    // Beyond Sidewinder FOV, provided for example purposes for large sensor FOV missiles
            //		key = 30    0.1     //
            //		key = 90    0.0     // Beyond 90 flare/target is behind missile
            // This set up will maxmize flare effectiviness:
            //		key = 0.0   1
            //		key = 90    1
            // This is the current default curve (same as 1.4.0.7 BDAc Sidewinder):
					key = 0 1 0 0
					key = 0.6 0.993333333333333 -0.0222222222222222 -0.0222222222222222
					key = 1.2 0.973333333333333 -0.0444444444444444 -0.0444444444444444
					key = 1.8 0.94 -0.0666666666666667 -0.0666666666666667
					key = 2.4 0.893333333333333 -0.0888888888888889 -0.0888888888888889
					key = 3 0.833333333333333 -0.111111111111111 -0.111111111111111
            // For other missiles it will scale from 0 to lockedSensorFOV/2 instead of 0 to 3 (3 = lockedSensorFOV/2 for Sidewinder)
        }
        lockedSensorVelocityBias
        {
            // floatcurve to define how the missile weights targets and flares based on the angle between their velocity vectors
            // is only active once the missile has locked onto a target
            // should be set from 0 (tracked target and flare/alternate target have aligned velocity vectors)
            // to an angle less than 180 (tracked target and flare/alternate target travelling in opposite directions)
            // it is recommended that the value at 0 be set to 1.0 and max key value be 0. Here is an example of an effective flare rejection curve:
            //		key = angle between velocities			weighting bias
            //		key = 0.0   1       // Highest weighing for target/flare travelling in same direction as tracked target
            //		key = 3.0   0.83    //
            //		key = 10    0.25    //
            //		key = 30    0.1     //
            //		key = 90    0.0     // ignore flares travelling perpendicular to target or in opposite direction
            // This set up will maxmize flare effectiviness:
            //		key = 0.0 1
            //		key = 180 1
            // This is the current default curve (same as 1.4.0.7 BDAc Sidewinder):
                    key = 0.0 1
                    key = 180 1
        }

        minStaticLaunchRange = 200
        maxStaticLaunchRange = 15000

        engageAir = true
        engageMissile = false
        engageGround = false
        engageSLW = false

    }
    MODULE
    {
        name = BDExplosivePart
        tntMass = 15
        warheadType = ContinuousRod
        fuseFailureRate = 0	// How often the explosive fuse will fail to detonate (0-1), evaluated once on detonation trigger
    }
}
