public MechJebModuleFlightRecorder(MechJebCore core)
     : base(core)
 {
     priority = 2000;
     maximums = new double[typeCount];
     minimums = new double[typeCount];
 }
예제 #2
0
 public override void OnStart(StartState state)
 {
     core = part.Modules.OfType<MechJebCore>().FirstOrDefault();
     eye_base = part.FindModelTransform("r4m0n_Control_point_socket"); //    Rotation: 0, 0, Z Azimuth
     eye_ball = part.FindModelTransform("r4m0n_Control_point_Eye"); //       Rotation: X, 0, 0 Altitude
     lastFlaps = new float[] { 0, 0, 0, 0 };
 }
예제 #3
0
 public MechJebModuleJoke(MechJebCore core)
     : base(core)
 {
     priority = -10000;
     enabled = false;
     hidden = true;
 }
예제 #4
0
        public override void onAttitudeChange(MechJebCore.AttitudeReference oldReference, Quaternion oldTarget, MechJebCore.AttitudeReference newReference, Quaternion newTarget)
        {
            if (!core.attitudeActive && ((mode != Mode.SURFACE) || srf_act))
            {
                mode = Mode.OFF;
            }

            base.onAttitudeChange(oldReference, oldTarget, newReference, newTarget);
        }
예제 #5
0
        public override void OnStart(StartState state)
        {
            core = part.Modules.OfType<MechJebCore>().FirstOrDefault();

            if (state != StartState.None && state != StartState.Editor)
            {
                InitializeLights();
            }
        }
예제 #6
0
        public MechJebModuleRCSController(MechJebCore core)
            : base(core)
        {
            priority = 600;

            Kd = 0.53 / Tf;
            Kp = Kd / (3 * Math.Sqrt(2) * Tf);
            Ki = Kp / (12 * Math.Sqrt(2) * Tf);

            pid = new PIDControllerV2(Kp, Ki, Kd, 1, -1);
        }
 public MechJebModuleManeuverPlanner(MechJebCore core)
     : base(core)
 {
     references[Operation.CIRCULARIZE] = new TimeReference[] { TimeReference.APOAPSIS, TimeReference.PERIAPSIS, TimeReference.ALTITUDE, TimeReference.X_FROM_NOW };
     references[Operation.PERIAPSIS] = new TimeReference[] { TimeReference.X_FROM_NOW, TimeReference.APOAPSIS, TimeReference.PERIAPSIS };
     references[Operation.APOAPSIS] = new TimeReference[] { TimeReference.X_FROM_NOW, TimeReference.APOAPSIS, TimeReference.PERIAPSIS };
     references[Operation.ELLIPTICIZE] = new TimeReference[] { TimeReference.X_FROM_NOW };
     references[Operation.INCLINATION] = new TimeReference[] { TimeReference.EQ_ASCENDING, TimeReference.EQ_DESCENDING, TimeReference.X_FROM_NOW };
     references[Operation.PLANE] = new TimeReference[] { TimeReference.REL_ASCENDING, TimeReference.REL_DESCENDING };
     references[Operation.TRANSFER] = new TimeReference[] { TimeReference.COMPUTED };
     references[Operation.MOON_RETURN] = new TimeReference[] { TimeReference.COMPUTED };
     references[Operation.INTERPLANETARY_TRANSFER] = new TimeReference[] { TimeReference.COMPUTED };
     references[Operation.COURSE_CORRECTION] = new TimeReference[] { TimeReference.COMPUTED };
     references[Operation.LAMBERT] = new TimeReference[] { TimeReference.X_FROM_NOW };
     references[Operation.KILL_RELVEL] = new TimeReference[] { TimeReference.CLOSEST_APPROACH, TimeReference.X_FROM_NOW };
 }
		public object ProcessVariable(string variable)
		{
			activeJeb = vessel.GetMasterMechJeb();
			switch (variable) {
				case "MECHJEBAVAILABLE":
					if (activeJeb != null)
						return 1;
					return -1;
				case "DELTAV":
					if (activeJeb != null) {
						MechJebModuleStageStats stats = activeJeb.GetComputerModule<MechJebModuleStageStats>();
						stats.RequestUpdate(this);
						return stats.vacStats.Sum(s => s.deltaV);
					}
					return null;
				case "DELTAVSTAGE":
					if (activeJeb != null) {
						MechJebModuleStageStats stats = activeJeb.GetComputerModule<MechJebModuleStageStats>();
						stats.RequestUpdate(this);
						return stats.vacStats[stats.vacStats.Length - 1].deltaV;
					}
					return null;
				case "PREDICTEDLANDINGERROR":
					// If there's a failure at any step, exit with a -1.
					// The landing prediction system can be costly, and it
					// expects someone to be registered with it for it to run.
					// So, we'll have a MechJebRPM button to enable landing
					// predictions.  And maybe add it in to the MJ menu.
					if (activeJeb != null && activeJeb.target.PositionTargetExists == true) {
						var predictor = activeJeb.GetComputerModule<MechJebModuleLandingPredictions>();
						if (predictor != null && predictor.enabled) {
							ReentrySimulation.Result result = predictor.GetResult();
							if (result != null && result.outcome == ReentrySimulation.Outcome.LANDED) {
								// We're going to hit something!
								double error = Vector3d.Distance(vessel.mainBody.GetRelSurfacePosition(result.endPosition.latitude, result.endPosition.longitude, 0),
									               vessel.mainBody.GetRelSurfacePosition(activeJeb.target.targetLatitude, activeJeb.target.targetLongitude, 0));
								return error;
							}
						}
					}
					return -1;
			}
			return null;
		}
예제 #9
0
        public MechJebModuleJoke(MechJebCore core)
            : base(core)
        {
            hidden = true;
            enabled = true;

            sorry = core.part.gameObject.AddComponent<AudioSource>();
            WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MechJebPod/snd1.wav");
            if ((sorry != null) && (www != null))
            {
                sorry.clip = www.GetAudioClip(false);
                sorry.volume = 0;
                sorry.Stop();
            }

            glitch = core.part.gameObject.AddComponent<AudioSource>();
            glitchClips = new AudioClip[NUM_GLITCH_SOUNDS];
            for (int i = 0; i < NUM_GLITCH_SOUNDS; i++)
            {
                www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MechJebPod/glitch" + i + ".wav");
                if (www != null)
                {
                    glitchClips[i] = www.GetAudioClip(false);
                }
            }

            foreach (ComputerModule module in core.modules)
            {
                if (module is MechJebModuleAscentAutopilot)
                {
                    ascent = (MechJebModuleAscentAutopilot)module;
                }
                if (module is MechJebModuleLandingAutopilot)
                {
                    landing = (MechJebModuleLandingAutopilot)module;
                }
                if (module is MechJebModuleTranslatron)
                {
                    translatron = (MechJebModuleTranslatron)module;
                }
            }
        }
예제 #10
0
        public MechJebModuleAutom8(MechJebCore core)
            : base(core)
        {
            instance = this;
            luaEnv = LuaRuntime.CreateGlobalEnviroment();
            mechjeb = new LuaTable();
            core.registerLuaMembers(mechjeb);
            luaEnv.SetNameValue("mechjeb", mechjeb);
            luaEnv.SetNameValue("vessel", ObjectToLua.ToLuaValue(vesselState));

            if (KSP.IO.File.Exists<MuMechJeb>("autorun.lua"))
            {
                try
                {
                    LuaRuntime.GlobalEnvironment = luaEnv;
                    LuaRuntime.RunFile("autorun.lua", luaEnv);
                }
                catch (Exception e)
                {
                    A8Console.WriteLine(e.GetType().Name + ": " + e.Message);
                    luaEnv.SetNameValue("lastError", ObjectToLua.ToLuaValue(e));
                }
            }
        }
예제 #11
0
 public MechJebModuleNodeEditor(MechJebCore core) : base(core)
 {
 }
예제 #12
0
 public MechJebModuleAscentAutopilot(MechJebCore core) : base(core)
 {
 }
예제 #13
0
 public MechJebModuleSpaceplaneAutopilot(MechJebCore core) : base(core)
 {
 }
예제 #14
0
 public MechJebModuleDebugArrows(MechJebCore core) : base(core)
 {
     enabled = true;
 }
예제 #15
0
파일: MechJeb.cs 프로젝트: Majiir/MuMechLib
 protected override void onPartAwake()
 {
     core = new MechJebCore();
     core.part = this;
     base.onPartAwake();
 }
 public MechJebModuleStagingController(MechJebCore core)
     : base(core)
 {
     priority = 1000;
 }
예제 #17
0
 public MechJebModuleTargetController(MechJebCore core) : base(core)
 {
 }
예제 #18
0
 public MechJebModuleVesselInfo(MechJebCore core) : base(core)
 {
 }
예제 #19
0
 public MechJebModuleAscentClassicMenu(MechJebCore core)
     : base(core)
 {
     hidden = true;
 }
예제 #20
0
 public MechJebModuleRCSBalancerWindow(MechJebCore core) : base(core)
 {
 }
 public MechJebModuleSolarPanelController(MechJebCore core)
     : base(core)
 {
     priority = 200;
     enabled  = true;
 }
 public MechJebModuleLandingPredictions(MechJebCore core) : base(core)
 {
 }
예제 #23
0
 public MechJebModuleAttitudeAdjustment(MechJebCore core) : base(core)
 {
 }
예제 #24
0
 public MechJebModuleRCSController(MechJebCore core)
     : base(core)
 {
     priority = 600;
     pid = new PIDControllerV2(0, 0, 0, 1, -1);
 }
예제 #25
0
 public MechJebModuleNodeEditor(MechJebCore core)
     : base(core)
 {
 }
예제 #26
0
 public MechJebModuleSpaceplaneGuidance(MechJebCore core) : base(core)
 {
 }
 public MechJebModuleRendezvousGuidance(MechJebCore core) : base(core)
 {
 }
예제 #28
0
 public MechJebModuleGuidanceController(MechJebCore core) : base(core)
 {
 }
예제 #29
0
 public DisplayModule(MechJebCore core)
     : base(core)
 {
     ID = nextID;
     nextID++;
 }
예제 #30
0
 public AutopilotStep(MechJebCore core)
 {
     this.core = core;
 }
예제 #31
0
 public DisplayModule(MechJebCore core)
     : base(core)
 {
     ID = nextID;
     nextID++;
 }
예제 #32
0
 public AutopilotModule(MechJebCore core) : base(core)
 {
 }
 public MechJebModuleRendezvousAutopilotWindow(MechJebCore core) : base(core)
 {
 }
예제 #34
0
 public MechJebModuleInfoItems(MechJebCore core) : base(core)
 {
 }
예제 #35
0
 public MechJebModuleAscentBase(MechJebCore core) : base(core)
 {
 }
예제 #36
0
 public MechJebModuleTranslatron(MechJebCore core) : base(core)
 {
 }
 public MechJebModuleCustomInfoWindow(MechJebCore core)
     : base(core)
 {
 }
 public MechJebModuleManeuverPlanner(MechJebCore core) : base(core)
 {
     operationNames = new List<Operation>(operation).ConvertAll(x => x.getName()).ToArray();
 }
예제 #39
0
 public MechJebModuleAscentAutopilot(MechJebCore core)
     : base(core)
 {
 }
 public MechJebModuleRCSBalancer(MechJebCore core)
     : base(core)
 {
     priority = 700;
 }
 public MechJebModuleSpaceplaneAutopilot(MechJebCore core) : base(core) { }
 public MechJebModuleLandingAutopilot(MechJebCore core)
     : base(core)
 {
 }
 public MechJebModuleTranslatron(MechJebCore core)
     : base(core)
 {
 }
예제 #44
0
 public AutopilotModule(MechJebCore core) : base(core)
 {
 }
예제 #45
0
 // FIXME: pr0 and pv0 need to be moved into the target constraint setting routines and need to not be the responsibility of the caller
 public PontryaginLaunch(MechJebCore core, double mu, Vector3d r0, Vector3d v0, Vector3d pv0, double dV) : base(core, mu, r0, v0, pv0, r0.normalized * 8.0 / 3.0, dV)
 {
 }
 public MechJebModuleStagingController(MechJebCore core)
     : base(core)
 {
     priority = 1000;
 }
 public MechJebModuleCustomWindowEditor(MechJebCore core)
     : base(core)
 {
     showInFlight = true;
     showInEditor = true;
 }
 public MechJebModuleScriptActionPause(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
 }
예제 #49
0
 public MechJebModuleInfoItems(MechJebCore core)
     : base(core)
 {
 }
 public void SetTargetKSC(MechJebCore controller)
 {
     users.Add(controller);
     core.target.SetPositionTarget(mainBody, MechJebModuleLandingGuidance.landingSites[0].latitude, MechJebModuleLandingGuidance.landingSites[0].longitude);
 }
 public MechJebModuleSpaceplaneGuidance(MechJebCore core) : base(core) { }
 public MechJebModuleThrustController(MechJebCore core)
     : base(core)
 {
     priority = 200;
 }
예제 #53
0
 public AutopilotStep(MechJebCore core)
 {
     this.core = core;
 }
예제 #54
0
 public MechJebModuleScriptActionExecuteNode(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     actionTypes.Add("Next node");
     actionTypes.Add("All nodes");
 }
 public MechJebModuleDockingAutopilot(MechJebCore core)
     : base(core)
 {
     lateralPID = new PIDController(Kp, Ki, Kd);
 }
 public MechJebModuleLandingGuidance(MechJebCore core) : base(core)
 {
 }
 public MechJebModuleLandingGuidance(MechJebCore core)
     : base(core)
 {
 }
예제 #58
0
 public MechJebModuleStageStats(MechJebCore core) : base(core)
 {
 }
 public MechJebModuleRCSBalancerWindow(MechJebCore core)
     : base(core)
 {
 }
 public MechJebModuleLandingAutopilot(MechJebCore core)
     : base(core)
 {
 }