PART
{
name = ERS_WheelFS
module = Part
author = Alexustas

MODEL
{
   model = ASET/ERS/Parts/ERSWheel        
}

scale = 1
rescaleFactor = 1

//node_stack_wheelmount = 0.3064924, 0.06158525, 0.0, 1.0, 0.0, 0.0, 1
node_stack_forward = 0.7549194, 0.1884706, -0.4652916, 1.0, 0.0, 0.0, 1
node_stack_backward = 0.7549194, 0.1884706, 0.4652916, 1.0, 0.0, 0.0, 1
node_attach = 0.7745876, 0.1908177, -0.04101187, 1.0, 1.0, 0.0, 1

TechRequired = fieldScience
entryCost = 5200

cost = 550
category = Utility
subcategory = 0
title = ERS Wheel (Stock)
manufacturer = A.S.E.T.
description = 

attachRules = 1,1,0,1,0

mass = 0.15
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 1
maxTemp = 1000 

crashTolerance = 50
breakingForce = 80
breakingTorque = 150

bulkheadProfiles = srf
tags = drive ground roll rover wheel ers

//----------------------- Stock Wheel Stuff ---------------------------

//----------------------- Effects -----------------------
EFFECTS
	{
		deploy
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_start
				volume = 0 0
				volume = 1 0.7
				pitch = 0.75
			}
			AUDIO_LOOP
			{
				channel = Ship
				clip = Squad/Sounds/elev_loop
				volume = 0 0
				volume = 1 0.7
				pitch = 0.55
			}
		}
		deployed
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_stop
				volume = 0 0
				volume = 1 0.7
				pitch = 0.50
			}
		}
		retract
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_stop
				volume = 0 0
				volume = 1 0.7
				pitch = 0.60
			}
			AUDIO_LOOP
			{
				channel = Ship
				clip = Squad/Sounds/elev_loop
				volume = 0 0
				volume = 1 0.7
				pitch = 0.50
			}
		}
		retracted
		{
			AUDIO
			{
				channel = Ship
				clip = Squad/Sounds/elev_start
				volume = 0 0
				volume = 1 0.7
				pitch = 0.75
			}
		}
	}

	MODULE
	{
		name = ModuleWheelBase
		
		wheelColliderTransformName = wheelCollider		
		wheelTransformName = wheel
		
		wheelType = MOTORIZED

		// setting this to true will override the radius and center parameters
		FitWheelColliderToMesh = False		
		radius = 0.55
		center = 0,0,0
		mass = 0.150
		groundHeightOffset = 0
				
		TooltipTitle = Rover Wheel
		TooltipPrimaryField = Motorized
		
		//frictionSharpness = 150.0
	}
	
	MODULE
	{
		name = ModuleWheelSuspension
		baseModuleIndex = 0
		suspensionTransformName = suspensionTraverse
		
		suspensionDistance = 0.25
		targetPosition = 0.5			
		springRatio = 12
		damperRatio = 1.0
	}	
	
	MODULE
	{
		name = ModuleWheelSteering
		baseModuleIndex = 0
		
		caliperTransformName = steering
		
		steeringResponse = 2
		steeringCurve
		{
			key = 0 20
			key = 10 9//6
			key = 30 3.0//1.5
		}
	}
	
	MODULE
	{
		name = ModuleWheelMotor
		baseModuleIndex = 0
		
		wheelSpeedMax = 59//37 208 kph
		driveResponse = 2
		
		torqueCurve
		{
			key = 0 2.0 0 0
			key = 10 1.4 0 0//2.5 2.0 0 0
			key = 52 0.5 0 0//36 0.5 0 0
			key = 58 0 0 0//38 0 0 0
		}
		RESOURCE
		{
			name = ElectricCharge
			rate = 3.5//7
		}		
		idleDrain = 0.0//0.1////0.5
	}	
	
	MODULE
	{
		name = ModuleWheelBrakes
		baseModuleIndex = 0
		
		maxBrakeTorque = 6
		brakeResponse = 1
		statusLightModuleIndex = 6
	}	
	
	MODULE
	{
		name = ModuleWheelDeployment
		baseModuleIndex = 0
		
		animationTrfName = ERSwheelExportGO
		animationStateName = Retract
		deployedPosition = 0
		deployTargetTransformName = suspensionNeutralPoint
		
		TsubSys = 0.0
		useStandInCollider = True
		slaveModules = 8
		
		fxDeploy = deploy
		fxRetract = retract
		fxDeployed = deployed
		fxRetracted = retracted
	}

	MODULE
	{
		name = ModuleStatusLight		
		//lightObjName = StatusLight
		lightMeshRendererName = ERSWheelBCKEmissiveObj
		lightMatPropertyName = _EmissiveColor
		colorOn = #ff4433
		colorOff = #000000
	}
	
	MODULE
	{
		name = ModuleWheelDamage
		baseModuleIndex = 0
		
		damagedTransformName = bastedwheel
		undamagedTransformName = wheel
		
		stressTolerance = 500
		impactTolerance = 100
		deflectionMagnitude = 1.0
		deflectionSharpness = 2.0
		slipMagnitude = 15
		slipSharpness = 2.0
	}

	MODULE
	{
		name = FXModuleLookAtConstraint
		CONSTRAINLOOKFX
		{
			targetName = ERS_WheelSuspFixedParts
			rotatorsName = ERS_WheelSuspMovingParts
		}
		CONSTRAINLOOKFX
		{
			targetName = ERS_WheelSuspMovingParts
			rotatorsName = ERS_WheelSuspFixedParts
		}
		CONSTRAINLOOKFX
		{
			targetName = ERS_WheelSuspFixedPartsBACK
			rotatorsName = ERS_WheelSuspMovingPartsBACK
		}
		CONSTRAINLOOKFX
		{
			targetName = ERS_WheelSuspMovingPartsBACK
			rotatorsName = ERS_WheelSuspFixedPartsBACK
		}
		
		CONSTRAINLOOKFX
		{
			targetName = PistonMovingLocFWD
			rotatorsName = PistonFixedLocFWD
		}
	}
	
//----------------- JSI PartUtilities Stuff -----------------------


//----------------- Toggle Wheels Mount -----------------------


//----------------- Components  ----------------------- 

//----------------- Forward Suspension Mount ----------------------- 
MODULE
{
	name = JSIPartComponentToggle
	moduleID = ForwardSusp
	componentName = ERS_WheelBase,ERS_WheelSuspFixedParts,ERS_WheelSuspMovingParts
	componentIsEnabled = true
	controlRendering = true
	controlColliders = true
	activeInEditor = true
	activeInFlight = false
	activeWhenUnfocused = false
	toggleMenuString = Toggle Suspension
	showEnableDisableOption = false
	showToggleOption = false
}

//----------------- Backward Suspension Mount----------------------- 

MODULE
{
	name = JSIPartComponentToggle
	moduleID = BackwardSusp
	componentName = ERS_WheelBaseBACK,ERS_WheelSuspFixedPartsBACK,ERS_WheelSuspMovingPartsBACK
	componentIsEnabled = true
	controlRendering = true
	controlColliders = true
	activeInEditor = true
	activeInFlight = false
	activeWhenUnfocused = false
	toggleMenuString = Toggle Suspension
	showEnableDisableOption = false
	showToggleOption = false
}

//----------------- Tire Forward Pattern----------------------- 
MODULE
{
	name = JSIPartComponentToggle
	moduleID = ForwardTire
	componentName = WheelsTire01FWD,WheelsTire02FWD
	componentIsEnabled = true
	controlRendering = true
	controlColliders = true
	activeInEditor = true
	activeInFlight = false
	activeWhenUnfocused = false
	toggleMenuString = Toggle Tire
	showEnableDisableOption = false
	showToggleOption = false
}
//----------------- Tire Backward Pattern----------------------- 
MODULE
{
	name = JSIPartComponentToggle
	moduleID = BackwardTire
	componentName = WheelsTire01BCK,WheelsTire02BCK
	componentIsEnabled = true
	controlRendering = true
	controlColliders = true
	activeInEditor = true
	activeInFlight = false
	activeWhenUnfocused = false
	toggleMenuString = Toggle Tire
	showEnableDisableOption = false
	showToggleOption = false
}

//----------------- Groups ----------------------- 
//----------------- Suspension ----------------------- 
MODULE
{
	name = JSIPartComponentGroup
	groupID = SuspToggle
	areComponentsEnabled = true
	persistAfterEditor = true
	activeInEditor = true
	activeInFlight = false
	activeWhenUnfocused = false
	componentToggles = !BackwardSusp|ForwardSusp
	toggleMenuString = Toggle Suspension
	showEnableDisableOption = false
	showToggleOption = true
	managedNodes = !forward|backward
}
//----------------- Tire ----------------------- 
MODULE
{
	name = JSIPartComponentGroup
	groupID = TireToggle
	areComponentsEnabled = true
	persistAfterEditor = true
	activeInEditor = true
	activeInFlight = false
	activeWhenUnfocused = false
	componentToggles = !BackwardTire|ForwardTire
	toggleMenuString = Toggle Tires
	showEnableDisableOption = false
	showToggleOption = true

}	



}
