public override void OnStart(PartModule.StartState state) { base.OnStart(state); if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris) && vessel.parts.Count > 1) { GameEvents.onGamePause.Add(new EventVoid.OnEvent(this.OnPause)); GameEvents.onGameUnpause.Add(new EventVoid.OnEvent(this.OnUnPause)); KFMW = this.part.GetComponentInChildren<KFModuleWheel>(); if (!Equals(KFMW, null)) tweakScaleCorrector = KFMW.tweakScaleCorrector; KFLog.Warning(string.Format("TS Corrector: {0}", tweakScaleCorrector)); colliderList = Extensions.SplitString(colliderNames); for (int i = 0; i < colliderList.Count(); i++) { colliders.Add(transform.SearchStartsWith(colliderList[i]).GetComponent<WheelCollider>()); objectCount++; } susTrav = transform.SearchStartsWith(susTravName); initialPosition = susTrav.localPosition; susTravIndex = Extensions.SetAxisIndex(susTravAxis); MoveSuspension(susTravIndex, -lastFrameTraverse, susTrav); //to get the initial stuff correct if (objectCount > 0) { //KFLog.Error(string.Format("lastFrameTraverse {0}", lastFrameTraverse)); StartCoroutine("WaitAndStart"); } else KFLog.Error("KFSuspension not configured correctly"); } }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsFlight || (Equals(vessel.vesselType, VesselType.Debris) || Equals(vessel.vesselType, VesselType.EVA))) return; #if DEBUG KFLog.Log("ModulePropeller called."); #endif _KFModuleWheel = part.GetComponentInChildren<KFModuleWheel>(); base.OnStart(state); }
public override void OnStart(PartModule.StartState state) { if (HighLogic.LoadedSceneIsFlight && (!Equals(vessel.vesselType, VesselType.Debris) || !Equals(vessel.vesselType, VesselType.EVA))) { _KFModuleWheel = part.GetComponentInChildren <KFModuleWheel>(); _steering = part.FindModelTransform(steeringObject); initialSteeringAngle = _steering.transform.localEulerAngles; steeringIndex = steeringAxis.SetAxisIndex(); base.OnStart(state); StartCoroutine(Steering()); } }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); if (HighLogic.LoadedSceneIsEditor) { foreach (ModuleAnimateGeneric ma in part.FindModulesImplementing <ModuleAnimateGeneric>()) { ma.Actions["ToggleAction"].active = false; ma.Events["Toggle"].guiActive = false; ma.Events["Toggle"].guiActiveEditor = false; } } if (HighLogic.LoadedSceneIsFlight) { #if DEBUG KFLog.Log("Repulsor Wheel started"); #endif foreach (ModuleAnimateGeneric ma in part.FindModulesImplementing <ModuleAnimateGeneric>()) { ma.Events["Toggle"].guiActive = false; } _moduleWheel = part.GetComponentInChildren <KFModuleWheel>(); _moduleWheel.Events["ApplySettings"].guiActive = false; foreach (WheelCollider wc in part.GetComponentsInChildren <WheelCollider>()) { wcList.Add(wc); } for (int i = 0; i < wcList.Count(); i++) { wfForwardList.Add(wcList[i].forwardFriction.stiffness); wfSideList.Add(wcList[i].sidewaysFriction.stiffness); susDistList.Add(wcList[i].suspensionDistance); } if (repulsorMode) { UpdateColliders("repulsor"); } if (!repulsorMode) { UpdateColliders("wheel"); } effectPowerMax = resourceConsumptionRate * Time.deltaTime; KFLog.Log(string.Format("\"effectPowerMax\" = {0}", effectPowerMax)); } }
public override void OnStart(PartModule.StartState state) { if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris) && vessel.parts.Count > 1) { _KFModuleWheel = part.GetComponentInChildren<KFModuleWheel>(); _steering = part.FindModelTransform(steeringObject); initialSteeringAngle = _steering.transform.localEulerAngles; steeringIndex = Extensions.SetAxisIndex(steeringAxis); base.OnStart(state); StartCoroutine(Steering()); } }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsFlight || (Equals(vessel.vesselType, VesselType.Debris) || Equals(vessel.vesselType, VesselType.EVA))) { return; } #if DEBUG KFLog.Log("ModulePropeller called."); #endif _KFModuleWheel = part.GetComponentInChildren <KFModuleWheel>(); base.OnStart(state); }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); print(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); _skinnedMeshRenderer = part.GetComponentInChildren<SkinnedMeshRenderer>(); _trackSurface = _skinnedMeshRenderer.gameObject; _moduleWheel = part.GetComponentInChildren<KFModuleWheel>(); if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris)) { trackMaterial = _trackSurface.renderer.material; Vector2 trackTiling = trackMaterial.mainTextureScale; trackTiling = new Vector2(trackTiling.x * _moduleWheel.directionCorrector, trackTiling.y); trackMaterial.SetTextureScale("_MainTex", trackTiling); trackMaterial.SetTextureScale("_BumpMap", trackTiling); } }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); bPrecisionModeActive = false; _KFModuleWheel = part.GetComponent<KFModuleWheel>(); originalSmoothSpeed = _KFModuleWheel.smoothSpeed; appliedSmoothSpeed = originalSmoothSpeed; originalResourceConsumption = _KFModuleWheel.resourceConsumptionRate; appliedResourceConsumption = originalResourceConsumption; #if DEBUG KFLog.Log(string.Format("Original Smooth Speed = {0}", originalSmoothSpeed)); KFLog.Log(string.Format("Boosted Smooth Speed = {0}", (originalSmoothSpeed * smoothSpeedMult))); #endif }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); bPrecisionModeActive = false; _KFModuleWheel = part.GetComponent <KFModuleWheel>(); originalSmoothSpeed = _KFModuleWheel.smoothSpeed; appliedSmoothSpeed = originalSmoothSpeed; originalResourceConsumption = _KFModuleWheel.resourceConsumptionRate; appliedResourceConsumption = originalResourceConsumption; #if DEBUG KFLog.Log(string.Format("Original Smooth Speed = {0}", originalSmoothSpeed)); KFLog.Log(string.Format("Boosted Smooth Speed = {0}", (originalSmoothSpeed * smoothSpeedMult))); #endif }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); print(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); _skinnedMeshRenderer = part.GetComponentInChildren <SkinnedMeshRenderer>(); _trackSurface = _skinnedMeshRenderer.gameObject; _moduleWheel = part.GetComponentInChildren <KFModuleWheel>(); if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris)) { trackMaterial = _trackSurface.renderer.material; Vector2 trackTiling = trackMaterial.mainTextureScale; trackTiling = new Vector2(trackTiling.x * _moduleWheel.directionCorrector, trackTiling.y); trackMaterial.SetTextureScale("_MainTex", trackTiling); trackMaterial.SetTextureScale("_BumpMap", trackTiling); } }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris)) { GameEvents.onGamePause.Add(OnPause); GameEvents.onGameUnpause.Add(OnUnPause); _moduleWheel = part.GetComponentInChildren <KFModuleWheel>(); if (!Equals(_moduleWheel, null)) { tweakScaleCorrector = _moduleWheel.tweakScaleCorrector; } KFLog.Warning(string.Format("TS Corrector: {0}", tweakScaleCorrector)); colliderList = colliderNames.SplitString(); for (int i = 0; i < colliderList.Count(); i++) { colliders.Add(transform.SearchStartsWith(colliderList[i]).GetComponent <WheelCollider>()); objectCount++; } susTrav = transform.SearchStartsWith(susTravName); initialPosition = susTrav.localPosition; susTravIndex = susTravAxis.SetAxisIndex(); MoveSuspension(susTravIndex, -fLastFrameTraverse, susTrav); if (objectCount > 0) { StartCoroutine("WaitAndStart"); } else { KFLog.Error("KFSuspension not configured correctly"); } } }
public override void OnStart(PartModule.StartState state) { _KFModuleWheel = part.GetComponentInChildren <KFModuleWheel>(); tweakScaleCorrector = _KFModuleWheel.tweakScaleCorrector; if (!isConfigured) { foreach (WheelCollider wc in part.GetComponentsInChildren <WheelCollider>()) { if (wc.name.StartsWith(colliderName, StringComparison.Ordinal)) { _wheelCollider = wc; fSuspensionDistance = wc.suspensionDistance; #if DEBUG KFLog.Log(string.Format("SuspensionDistance is: {0}.", suspensionDistance)); #endif isConfigured = true; } } } if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris)) { GameEvents.onGamePause.Add(new EventVoid.OnEvent(OnPause)); GameEvents.onGameUnpause.Add(new EventVoid.OnEvent(OnUnPause)); // Find named onjects in part. foreach (WheelCollider wc in part.GetComponentsInChildren <WheelCollider>()) { if (wc.name.StartsWith(colliderName, StringComparison.Ordinal)) { _wheelCollider = wc; } } foreach (Transform tr in part.GetComponentsInChildren <Transform>()) { if (tr.name.StartsWith(wheelName, StringComparison.Ordinal)) { _wheel = tr; } if (tr.name.StartsWith(steeringName, StringComparison.Ordinal)) { _trackSteering = tr; } if (tr.name.StartsWith(sustravName, StringComparison.Ordinal)) { _susTrav = tr; } } initialPosition = _susTrav.localPosition; susTravIndex = susTravAxis.SetAxisIndex(); steeringIndex = steeringAxis.SetAxisIndex(); if (_KFModuleWheel.hasSteering) { initialSteeringAngles = _trackSteering.transform.localEulerAngles; #if DEBUG KFLog.Log(string.Format("initial steering angles are \"{0}\"", initialSteeringAngles)); #endif } directionCorrector = useDirectionCorrector ? _KFModuleWheel.directionCorrector : 1; _wheelRotation = new Vector3(wheelRotationX, wheelRotationY, wheelRotationZ); if (Equals(lastFrameTraverse, 0)) //check to see if we have a value in persistance { #if DEBUG KFLog.Log("Last frame = 0. Setting suspension distance."); #endif lastFrameTraverse = _wheelCollider.suspensionDistance; } #if DEBUG KFLog.Log(string.Format("Last frame = {0}", lastFrameTraverse)); #endif couroutinesActive = true; MoveSuspension(susTravIndex, -lastFrameTraverse, _susTrav); //to get the initial stuff correct if (_KFModuleWheel.hasSteering) { StartCoroutine("Steering"); #if DEBUG KFLog.Log("Starting steering coroutine."); #endif } if (trackedWheel) { StartCoroutine("TrackedWheel"); } else { StartCoroutine("IndividualWheel"); } if (hasSuspension) { KFLog.Warning("KFWheel suspension module is deprecated. Please use KFSuspension."); StartCoroutine("Suspension"); } part.force_activate(); } base.OnStart(state); }
//OnStart public override void OnStart(PartModule.StartState state) { _KFModuleWheel = part.GetComponentInChildren<KFModuleWheel>(); tweakScaleCorrector = _KFModuleWheel.tweakScaleCorrector; if (!isConfigured) { foreach (WheelCollider wc in part.GetComponentsInChildren<WheelCollider>()) { if (wc.name.StartsWith(colliderName, StringComparison.Ordinal)) { _wheelCollider = wc; suspensionDistance = wc.suspensionDistance; //KFLog.Error(string.Format("SuspensionDistance is: {0}.", suspensionDistance)); isConfigured = true; } } } // disable once RedundantIfElseBlock else { //KFLog.Error("Already configured - skipping."); } if (HighLogic.LoadedSceneIsEditor) { // Do absolutely nothing! } if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris) && vessel.parts.Count > 1) { GameEvents.onGamePause.Add(new EventVoid.OnEvent(OnPause)); GameEvents.onGameUnpause.Add(new EventVoid.OnEvent(OnUnPause)); //find named onjects in part foreach (WheelCollider wc in part.GetComponentsInChildren<WheelCollider>()) { if (wc.name.StartsWith(colliderName, StringComparison.Ordinal)) _wheelCollider = wc; } foreach (Transform tr in part.GetComponentsInChildren<Transform>()) { if (tr.name.StartsWith(wheelName, StringComparison.Ordinal)) _wheel = tr; if (tr.name.StartsWith(steeringName, StringComparison.Ordinal)) _trackSteering = tr; if (tr.name.StartsWith(sustravName, StringComparison.Ordinal)) _susTrav = tr; } //end find named objects initialPosition = _susTrav.localPosition; susTravIndex = Extensions.SetAxisIndex(susTravAxis); steeringIndex = Extensions.SetAxisIndex(steeringAxis); if (_KFModuleWheel.hasSteering) { initialSteeringAngles = _trackSteering.transform.localEulerAngles; //KFLog.Log(initialSteeringAngles); } // Again, if/else can be made into a single line. - Gaalidas directionCorrector = useDirectionCorrector ? _KFModuleWheel.directionCorrector : 1; _wheelRotation = new Vector3(wheelRotationX, wheelRotationY, wheelRotationZ); if (Equals(lastFrameTraverse, 0)) //check to see if we have a value in persistance { //KFLog.Error("Last frame = 0. Setting"); lastFrameTraverse = _wheelCollider.suspensionDistance; //KFLog.Error(lastFrameTraverse); } //KFLog.Error("Last frame ="); //KFLog.Error(lastFrameTraverse); couroutinesActive = true; MoveSuspension(susTravIndex, -lastFrameTraverse, _susTrav); //to get the initial stuff correct if (_KFModuleWheel.hasSteering) { StartCoroutine("Steering"); //KFLog.Error("starting steering coroutine"); } if (trackedWheel) StartCoroutine("TrackedWheel"); else StartCoroutine("IndividualWheel"); if (hasSuspension) { KFLog.Error("WARNING: KFWheel suspension module is deprecated. Please use KFSuspension"); StartCoroutine("Suspension"); } part.force_activate(); }//end flight base.OnStart(state); }
public override void OnStart(PartModule.StartState state) { base.OnStart(state); if (HighLogic.LoadedSceneIsEditor) { foreach (ModuleAnimateGeneric ma in part.FindModulesImplementing<ModuleAnimateGeneric>()) { ma.Actions["ToggleAction"].active = false; ma.Events["Toggle"].guiActive = false; ma.Events["Toggle"].guiActiveEditor = false; } } if (HighLogic.LoadedSceneIsFlight) { KFLog.Log("Repulsor Wheel started"); foreach (ModuleAnimateGeneric ma in part.FindModulesImplementing<ModuleAnimateGeneric>()) ma.Events["Toggle"].guiActive = false; _moduleWheel = part.GetComponentInChildren<KFModuleWheel>(); _moduleWheel.Events["ApplySettings"].guiActive = false; foreach (WheelCollider wc in part.GetComponentsInChildren<WheelCollider>()) wcList.Add(wc); for (int i = 0; i < wcList.Count(); i++) { wfForwardList.Add(wcList[i].forwardFriction.stiffness); wfSideList.Add(wcList[i].sidewaysFriction.stiffness); susDistList.Add(wcList[i].suspensionDistance); } if (repulsorMode) UpdateColliders("repulsor"); if (!repulsorMode) UpdateColliders("wheel"); effectPowerMax = resourceConsumptionRate * Time.deltaTime; KFLog.Log(string.Format("\"effectPowerMax\" = {0}", effectPowerMax)); } }
//OnStart public override void OnStart(PartModule.StartState state) { _KFModuleWheel = part.GetComponentInChildren<KFModuleWheel>(); tweakScaleCorrector = _KFModuleWheel.tweakScaleCorrector; if (!isConfigured) { foreach (WheelCollider wc in part.GetComponentsInChildren<WheelCollider>()) { if (wc.name.StartsWith(colliderName, StringComparison.Ordinal)) { _wheelCollider = wc; suspensionDistance = wc.suspensionDistance; #if DEBUG KFLog.Log(string.Format("SuspensionDistance is: {0}.", suspensionDistance)); #endif isConfigured = true; } } } if (HighLogic.LoadedSceneIsFlight && !Equals(vessel.vesselType, VesselType.Debris)) { GameEvents.onGamePause.Add(new EventVoid.OnEvent(OnPause)); GameEvents.onGameUnpause.Add(new EventVoid.OnEvent(OnUnPause)); // Find named onjects in part. foreach (WheelCollider wc in part.GetComponentsInChildren<WheelCollider>()) { if (wc.name.StartsWith(colliderName, StringComparison.Ordinal)) _wheelCollider = wc; } foreach (Transform tr in part.GetComponentsInChildren<Transform>()) { if (tr.name.StartsWith(wheelName, StringComparison.Ordinal)) _wheel = tr; if (tr.name.StartsWith(steeringName, StringComparison.Ordinal)) _trackSteering = tr; if (tr.name.StartsWith(sustravName, StringComparison.Ordinal)) _susTrav = tr; } initialPosition = _susTrav.localPosition; susTravIndex = KFExtensions.SetAxisIndex(susTravAxis); steeringIndex = KFExtensions.SetAxisIndex(steeringAxis); if (_KFModuleWheel.hasSteering) { initialSteeringAngles = _trackSteering.transform.localEulerAngles; #if DEBUG KFLog.Log(string.Format("initial steering angles are \"{0}\"", initialSteeringAngles)); #endif } directionCorrector = useDirectionCorrector ? _KFModuleWheel.directionCorrector : 1; _wheelRotation = new Vector3(wheelRotationX, wheelRotationY, wheelRotationZ); if (Equals(lastFrameTraverse, 0)) //check to see if we have a value in persistance { #if DEBUG KFLog.Log("Last frame = 0. Setting suspension distance."); #endif lastFrameTraverse = _wheelCollider.suspensionDistance; } #if DEBUG KFLog.Log(string.Format("Last frame = {0}", lastFrameTraverse)); #endif couroutinesActive = true; MoveSuspension(susTravIndex, -lastFrameTraverse, _susTrav); //to get the initial stuff correct if (_KFModuleWheel.hasSteering) { StartCoroutine("Steering"); #if DEBUG KFLog.Log("Starting steering coroutine."); #endif } if (trackedWheel) StartCoroutine("TrackedWheel"); else StartCoroutine("IndividualWheel"); if (hasSuspension) { KFLog.Warning("KFWheel suspension module is deprecated. Please use KFSuspension."); StartCoroutine("Suspension"); } part.force_activate(); } base.OnStart(state); }