﻿//https://forum.kerbalspaceprogram.com/index.php?/topic/173013-tutorial-for-a-basic-landing-leg/
PART
{
	name = buffaloLandingLeg
	module = Part
	author = Angel-125

	MODEL
	{
		model = WildBlueIndustries/Buffalo/Assets/LandingGear
	}
	rescaleFactor = 1

	node_stack_top = 0, 0, 0, 0, 0, 1, 0

	TechRequired = spaceExploration
	entryCost = 4100
	cost = 140
	category = Ground
	subcategory = 0
	title = Buffalo Landing Leg
	manufacturer = Wild Blue Industries
	description = This leg gives you the ability to lift up your rovers and do things like change the tires.
	attachRules = 1,0,0,0,0
	mass = 0.1
	thermalMassModifier = 3.0
	emissiveConstant = 0.8
	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.2
	angularDrag = 2
	crashTolerance = 12
	maxTemp = 3300
	breakingForce = 2800
	breakingTorque = 2800
	bulkheadProfiles = size0
	tags = ground land leg support
	PhysicsSignificance = 0

	MODULE
	{
		name = ModuleWheelBase
		
		wheelColliderTransformName = wheelCollider		
		
		wheelType = LEG

		// setting this to true will override the radius and center parameters
		FitWheelColliderToMesh = False		
		radius = 0.1
		center = 0,0,0
		mass = 0.040
		autoFrictionAvailable = False
		clipObject = clipCollider
				
		TooltipTitle = #autoLOC_502076 //#autoLOC_502076 = Landing Leg
		TooltipPrimaryField = 
		
		groundHeightOffset = 4
	}

	MODULE
	{
		name = ModuleWheelSuspension
		baseModuleIndex = 0
		suspensionTransformName = suspensionTraverse
		//suspensionColliderName = clipCollider //This is what rests on the ground. Matches with clipObject
			
		//These parameters are the same as in Unity
		suspensionDistance = 0.1
		suspensionOffset = 0 //-0.3		
		springRatio = 20
		targetPosition = 1			
		damperRatio = 1
	}

	MODULE
	{
		name = ModuleWheelDeployment
		baseModuleIndex = 0
		
		animationTrfName = LandingGear
		animationStateName = Deploy
		deployedPosition = 1
		deployTargetTransformName = deployTarget //This becomes the wheel collider
		
		TsubSys = 1 //When wheel collider switches over to deploy target during the animation. 1= end, 0=start
		
		extendDurationFactor = 1
		retractDuractionFactor = 1

		fxDeploy = deploy
		fxRetract = retract
		fxDeployed = deployed
		fxRetracted = retracted
	}

	MODULE
	{
		name = ModuleWheelLock
		maxTorque = 4000
	}

	MODULE
	{
		name = ModuleWheelDamage
		baseModuleIndex = 0
		
		stressTolerance = 99999999
		impactTolerance = 600
		deflectionMagnitude = 1
		deflectionSharpness = 2.0
		slipMagnitude = 0
		slipSharpness = 2.0
		explodeMultiplier = 1.0
	}

	MODULE
	{
		name = FXModuleLookAtConstraint
		CONSTRAINLOOKFX
		{
			targetName = InnerPiston001
			rotatorsName = OuterPiston001
		}
		CONSTRAINLOOKFX
		{
			targetName = OuterPiston001
			rotatorsName = InnerPiston001
		}
	}

	EFFECTS
	{
		deploy
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_start
				volume = 0 0
				volume = 1 0.5
				pitch = 0.5
			}
			AUDIO_LOOP
			{
				channel = Ship
				clip = Squad/Sounds/elev_loop
				volume = 0 0
				volume = 1 0.5
				pitch = 0.5
			}
		}
		deployed
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_stop
				volume = 0 0
				volume = 1 0.5
				pitch = 0.5
			}
		}
		retract
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_start
				volume = 0 0
				volume = 1 0.5
				pitch = 0.5
			}
			AUDIO_LOOP
			{
				channel = Ship
				clip = Squad/Sounds/elev_loop
				volume = 0 0
				volume = 1 0.5
				pitch = 0.6
			}
		}
		retracted
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_stop
				volume = 0 0
				volume = 1 0.5
				pitch = 0.75
			}
		}
	}
}
