Ejemplo n.º 1
0
 bool setup()
 {
     if(module != null) return true;
     module = part.GetModule<ModuleWheel>();
     if(module == null) return false;
     module.wheels.ForEach(w => saved_wheels.Add(new WheelFrictionChanger(w)));
     return true;
 }
Ejemplo n.º 2
0
 bool setup()
 {
     if(module != null) return true;
     module = part.Modules.OfType<ModuleWheel>().FirstOrDefault();
     if(module == null) return false;
     module.wheels.ForEach(w => saved_wheels.Add(new WheelFrictionChanger(w)));
     return true;
 }
Ejemplo n.º 3
0
 protected override void DI_Start(StartState state)
 {
     if (HighLogic.LoadedSceneIsFlight)
     {
         this.wheel = this.part.Modules.OfType <ModuleWheel>().Single();
     }
     if (!this.wheel.damageable)
     {
         this.enabled = false;
     }
 }
Ejemplo n.º 4
0
 bool setup()
 {
     if (module != null)
     {
         return(true);
     }
     module = part.Modules.OfType <ModuleWheel>().FirstOrDefault();
     if (module == null)
     {
         return(false);
     }
     module.wheels.ForEach(w => saved_wheels.Add(new WheelFrictionChanger(w)));
     return(true);
 }
Ejemplo n.º 5
0
        private void Turn(DriveCommand dc, FlightCtrlState fs)
        {
            ModuleWheel m = new ModuleWheel();

            if (Math.Abs(Quaternion.Angle(mRoverRot, mVessel.ReferenceTransform.rotation)) < dc.target)
            {
                fs.wheelThrottle = mThrottlePID.Control(dc.speed - RoverSpeed);
                fs.wheelSteer    = dc.steering;
            }
            else
            {
                fs.wheelThrottle = 0;
                fs.wheelSteer    = 0;
                mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
                dc.mode = DriveCommand.DriveMode.Off;
                dc      = null;
            }
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            Debug.Log(moduleName + ".Start(): v01.06");

            WheelModule = (ModuleWheel)GetModule("ModuleWheel");

            if (null == WheelModule)
            {
                Debug.LogWarning(moduleName + ".Start(): Did not find Wheel Module.");
                return;
            }

            // get the wheel grip
            if (forwardStiffnessMult < 0 || sidewaysStiffnessMult < 0)
            {
                forwardStiffnessMult = WheelModule.forwardStiffnessMult;
                sidewaysStiffnessMult = WheelModule.sidewaysStiffnessMult;
            }

            SetupStockPlus();
        }
        }  // GetModule

        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            Debug.Log(moduleName + ".Start(): v01.06");

            WheelModule = (ModuleWheel)GetModule("ModuleWheel");

            if (null == WheelModule)
            {
                Debug.LogWarning(moduleName + ".Start(): Did not find Wheel Module.");
                return;
            }

            // get the wheel grip
            if (forwardStiffnessMult < 0 || sidewaysStiffnessMult < 0)
            {
                forwardStiffnessMult  = WheelModule.forwardStiffnessMult;
                sidewaysStiffnessMult = WheelModule.sidewaysStiffnessMult;
            }

            SetupStockPlus();
        }
Ejemplo n.º 8
0
 protected override void DI_Start(StartState state)
 {
     if (HighLogic.LoadedSceneIsFlight)
     {
         this.wheel = this.part.Modules.OfType<ModuleWheel>().Single();
     }
     if (!this.wheel.hasMotor) {
         this.enabled = false;
     }
 }
Ejemplo n.º 9
0
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     wheel = base.part.FindModuleImplementing<ModuleWheel>();
 }
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     this.module = base.part.FindModuleImplementing<ModuleWheel>();
 }
Ejemplo n.º 11
0
        public override void OnStart(StartState state)
        {
            if (state == StartState.Editor || state == StartState.None) return;

            SetupParticles();
            if (scrapeSparks)
                SetupLight();

            if (part.Modules.Contains("ModuleWheel")) // Suppress the log message on failure.
                moduleWheel = part.Modules["ModuleWheel"] as ModuleWheel;
            wheelCollider = part.GetComponent<WheelCollider>();
            if (wheelCollider == null)
            {
                ModuleLandingGear gear = part.GetComponent<ModuleLandingGear>();
                if (gear != null)
                {
                    wheelCollider = gear.wheelCollider;
                }
            }

            SetupAudio();

            GameEvents.onGamePause.Add(OnPause);
            GameEvents.onGameUnpause.Add(OnUnpause);

            #if DEBUG
            for (int i = 0; i < spheres.Length; i++)
            {
                spheres[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                Destroy(spheres[i].collider);
            }
            spheres[0].renderer.material.color = Color.red;
            spheres[1].renderer.material.color = Color.green;
            #endif
        }
 private void Turn(DriveCommand dc, FlightCtrlState fs)
 {
     ModuleWheel m = new ModuleWheel();
     if (Math.Abs(Quaternion.Angle(mRoverRot, mVessel.ReferenceTransform.rotation)) < dc.target) {
         fs.wheelThrottle = mThrottlePID.Control(dc.speed - RoverSpeed);
         fs.wheelSteer = dc.steering;
     } else {
         fs.wheelThrottle = 0;
         fs.wheelSteer = 0;
         mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
         dc.mode = DriveCommand.DriveMode.Off;
         dc = null;
     }
 }
Ejemplo n.º 13
0
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     wheel = base.part.FindModuleImplementing <ModuleWheel>();
 }
    public float FindTorque(ModuleWheel w)
    {
        var fc = w.torqueCurve;
        var t = 0f;
        var res = fc.Evaluate(t);

        while (res > 0) {
            t += 10;
            res = fc.Evaluate(t);
        }

        while (res == 0) {
            t--;
            res = fc.Evaluate(t);
        }

        while (res > 0) {
            t += 0.1f;
            res = fc.Evaluate(t);
        }

        return t;
    }
Ejemplo n.º 15
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     this.module = base.part.FindModuleImplementing <ModuleWheel>();
 }