public MechJebModuleScriptActionLoadScript(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     for (int i = 1; i <= 4; i++)
     {
         scriptsList.Add("Slot " + i);
     }
 }
Example #2
0
 public MechJebModuleScriptActionIRSequencer(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     irsequencerParts.Clear();
     irsequencerPartsNames.Clear();
     irsequencerModules.Clear();
     this.actionTypes.Clear();
     this.actionTypes.Add("Start Sequence");
     this.actionTypes.Add("Pause Sequence");
     this.actionTypes.Add("Reset Sequence");
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (Part part in vessel.Parts)
             {
                 if (part.name.Contains("RoboticsControlUnit"))
                 {
                     foreach (PartModule module in part.Modules)
                     {
                         if (module.moduleName.Contains("ModuleSequencer"))
                         {
                             this.irsequencerParts.Add(part);
                             this.irsequencerPartsNames.Add(part.partInfo.title);
                             this.irsequencerModules.Add(module);
                         }
                     }
                 }
             }
         }
     }
     this.updateSequencesList();
 }
 public MechJebModuleScriptActionDockingShield(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     this.actionTypes.Clear();
     this.actionTypes.Add("Open");
     this.actionTypes.Add("Close");
     this.dockingPartsList.Clear();
     this.dockingPartsNames.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (ModuleDockingNode node in vessel.FindPartModulesImplementing <ModuleDockingNode>())
             {
                 if (node.deployAnimator != null)
                 {
                     if (node.deployAnimator.actionAvailable)
                     {
                         dockingPartsList.Add(node.part);
                         dockingPartsNames.Add(node.part.partInfo.title);
                     }
                 }
             }
         }
     }
 }
Example #4
0
        public MechJebModuleScriptActionWhile(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
        {
            actions        = new MechJebModuleScriptActionsList(core, scriptModule, this, actionsList.getDepth() + 1);
            condition      = new MechJebModuleScriptCondition(scriptModule, core, this);
            sBorder        = new GUIStyle();
            sBorder.border = new RectOffset(1, 1, 1, 1);
            Texture2D background = new Texture2D(16, 16, TextureFormat.RGBA32, false);

            for (int x = 0; x < background.width; x++)
            {
                for (int y = 0; y < background.height; y++)
                {
                    if (x == 0 || x == 15 || y == 0 || y == 15)
                    {
                        background.SetPixel(x, y, Color.yellow);
                    }
                    else
                    {
                        background.SetPixel(x, y, Color.clear);
                    }
                }
            }
            background.Apply();
            sBorder.normal.background   = background;
            sBorder.onNormal.background = background;
            sBorder.padding             = new RectOffset(1, 1, 1, 1);
        }
 public MechJebModuleScriptActionCrewTransfer(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     this.crewableParts.Clear();
     this.crewablePartsNamesS.Clear();
     this.crewablePartsNamesT.Clear();
     this.kerbalsNames.Clear();
     this.kerbalsList.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (Part part in vessel.Parts)
             {
                 if (part.CrewCapacity > 0)
                 {
                     crewableParts.Add(part);
                     crewablePartsNamesS.Add(part.partInfo.title);
                     crewablePartsNamesT.Add(part.partInfo.title);
                 }
             }
             foreach (ProtoCrewMember kerbal in vessel.GetVesselCrew())
             {
                 kerbalsNames.Add(kerbal.name);
                 kerbalsList.Add(kerbal);
             }
         }
     }
 }
Example #6
0
 public MechJebModuleScriptActionStaging(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     for (int i = 0; i < StageManager.StageCount; i++)
     {
         stagesList.Add(i + "");
     }
 }
 public MechJebModuleScriptAction(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList, String name)
 {
     this.scriptModule = scriptModule;
     this.core         = core;
     this.name         = name;
     this.actionsList  = actionsList;
 }
Example #8
0
 public MechJebModuleScriptActionsList(MechJebCore core, MechJebModuleScript scriptModule, IMechJebModuleScriptActionsListParent parent, int depth)
 {
     this.core         = core;
     this.scriptModule = scriptModule;
     this.parent       = parent;
     this.depth        = depth;
     this.populateActionNames();
 }
 public MechJebModuleScriptActionRendezvous(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     actionTypes.Add("Align Planes");
     actionTypes.Add("Establish new orbit at");
     actionTypes.Add("Intercept with Hohmann transfer");
     actionTypes.Add("Match velocities at closest approach");
     actionTypes.Add("Get closer");
 }
 public MechJebModuleScriptActionRCS(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     actionTypes.Add("Enable");
     actionTypes.Add("Disable");
     actionObjects.Add("RCS");
     actionObjects.Add("RCS throttle when engines are offline");
     actionObjects.Add("Use RCS for rotation");
     actionObjects.Add("Zero Rvel");
 }
Example #11
0
 public MechJebModuleScriptActionTarget(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     targetTypes.Add("Celestial Body");
     //targetTypes.Add ("Celestial Body Long/Lat"); //TODO: Fix the Lat/Long feature
     foreach (CelestialBody body in FlightGlobals.Bodies)
     {
         bodiesNamesList.Add(body.bodyName);
     }
 }
Example #12
0
 public MechJebModuleScriptActionLoadScript(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     for (int i = 1; i <= 4; i++)
     {
         scriptsList.Add("Slot " + i);
     }
     this.memorySlotsList.Clear();
     this.memorySlotsList.Add("Global Memory");
     this.memorySlotsList.Add("Vessel Memory");
 }
        /*
         * [Persistent(pass = (int)Pass.Type)]
         *  private int actionType;
         * private List<String> actionTypes = new List<String>();
         * //Module Parameters
         */

        public MechJebModuleScriptActionAscent(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
        {
            /*
             * mainBody = core.target.mainBody;
             * targetOrbit = core.target.TargetOrbit;
             * actionTypes.Add("Ascent Guidance");
             * actionTypes.Add("Launching to Rendezvous");
             */
            readModuleConfiguration();
        }
 public MechJebModuleScriptActionAscent(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     this.autopilot    = core.GetComputerModule <MechJebModuleAscentAutopilot>();
     this.ascentModule = core.GetComputerModule <MechJebModuleAscentGuidance>();
     this.mainBody     = core.target.mainBody;
     this.targetOrbit  = core.target.TargetOrbit;
     actionTypes.Add("Ascent Guidance");
     actionTypes.Add("Launching to Rendezvous");
     this.readModuleConfiguration();
 }
Example #15
0
 public MechJebModuleScriptActionThrottle(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     burnRates.Add("0%");
     burnRates.Add("10%");
     burnRates.Add("20%");
     burnRates.Add("30%");
     burnRates.Add("40%");
     burnRates.Add("50%");
     burnRates.Add("60%");
     burnRates.Add("70%");
     burnRates.Add("80%");
     burnRates.Add("90%");
     burnRates.Add("100%");
 }
Example #16
0
 public MechJebModuleScriptActionDockingAutopilot(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     this.autopilot             = core.GetComputerModule <MechJebModuleDockingAutopilot>();;
     this.moduleGuidance        = core.GetComputerModule <MechJebModuleDockingGuidance>();;
     this.speedLimit            = autopilot.speedLimit;
     this.rol                   = autopilot.rol;
     this.forceRol              = autopilot.forceRol;
     this.overridenSafeDistance = autopilot.overridenSafeDistance;
     this.overrideSafeDistance  = autopilot.overrideSafeDistance;
     this.overrideTargetSize    = autopilot.overrideTargetSize;
     this.overridenTargetSize   = autopilot.overridenTargetSize;
     this.safeDistance          = autopilot.safeDistance;
     this.targetSize            = autopilot.targetSize;
     this.drawBoundingBox       = autopilot.drawBoundingBox;
 }
 public MechJebModuleScriptActionManoeuver(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     Operation[] op_list = Operation.getAvailableOperations();
     operation      = new List <Operation>();
     operationNames = new List <String>();
     //Only add the "tested" and "supported" operations
     for (int i = 0; i < op_list.Length; i++)
     {
         if (!op_list[i].getName().ToLower().Contains("advanced transfer") && !op_list[i].getName().ToLower().Contains("transfer to another planet"))
         {
             operation.Add(op_list[i]);
             operationNames.Add(op_list[i].getName());
         }
     }
     //operationNames = new List<Operation>(operation).ConvertAll(x => x.getName()).ToArray();
 }
        public MechJebModuleScriptActionIf(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
        {
            actionsThen     = new MechJebModuleScriptActionsList(core, scriptModule, this, actionsList.getDepth() + 1);
            actionsElse     = new MechJebModuleScriptActionsList(core, scriptModule, this, actionsList.getDepth() + 1);
            condition       = new MechJebModuleScriptCondition(scriptModule, core, this);
            sBorderY        = new GUIStyle();
            sBorderY.border = new RectOffset(1, 1, 1, 1);
            sBorderG        = new GUIStyle();
            sBorderG.border = new RectOffset(1, 1, 1, 1);
            sBorderR        = new GUIStyle();
            sBorderR.border = new RectOffset(1, 1, 1, 1);
            Texture2D backgroundY = new Texture2D(16, 16, TextureFormat.RGBA32, false);
            Texture2D backgroundG = new Texture2D(16, 16, TextureFormat.RGBA32, false);
            Texture2D backgroundR = new Texture2D(16, 16, TextureFormat.RGBA32, false);

            for (int x = 0; x < backgroundY.width; x++)
            {
                for (int y = 0; y < backgroundY.height; y++)
                {
                    if (x == 0 || x == 15 || y == 0 || y == 15)
                    {
                        backgroundY.SetPixel(x, y, Color.yellow);
                        backgroundG.SetPixel(x, y, Color.green);
                        backgroundR.SetPixel(x, y, Color.red);
                    }
                    else
                    {
                        backgroundY.SetPixel(x, y, Color.clear);
                        backgroundG.SetPixel(x, y, Color.clear);
                        backgroundR.SetPixel(x, y, Color.clear);
                    }
                }
            }
            backgroundY.Apply();
            backgroundG.Apply();
            backgroundR.Apply();
            sBorderY.normal.background   = backgroundY;
            sBorderY.onNormal.background = backgroundY;
            sBorderG.normal.background   = backgroundG;
            sBorderG.onNormal.background = backgroundG;
            sBorderR.normal.background   = backgroundR;
            sBorderR.onNormal.background = backgroundR;
            sBorderY.padding             = new RectOffset(1, 1, 1, 1);
            sBorderG.padding             = new RectOffset(1, 1, 1, 1);
            sBorderR.padding             = new RectOffset(1, 1, 1, 1);
        }
Example #19
0
 public MechJebModuleScriptActionUndock(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     //dockingModulesList = currentTargetVessel.FindPartModulesImplementing<ModuleDockingNode>();
     //List<ITargetable> ITargetableList = currentTargetVessel.FindPartModulesImplementing<ITargetable>();
     this.dockingPartsList.Clear();
     this.dockingPartsNames.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (ModuleDockingNode node in vessel.FindPartModulesImplementing <ModuleDockingNode>())
             {
                 dockingPartsList.Add(node.part);
                 dockingPartsNames.Add(node.part.partInfo.title);
             }
         }
     }
 }
Example #20
0
 public MechJebModuleScriptActionTargetDock(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     this.dockingPartsList.Clear();
     this.dockingPartsNames.Clear();
     this.controlPartsNames.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (ModuleDockingNode node in vessel.FindPartModulesImplementing <ModuleDockingNode>())
             {
                 this.dockingPartsList.Add(node.part);
                 this.dockingPartsNames.Add(node.part.partInfo.title);
                 this.controlPartsNames.Add(node.part.partInfo.title);
             }
         }
     }
 }
Example #21
0
 public MechJebModuleScriptActionActiveVessel(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     this.commandParts.Clear();
     this.commandPartsNames.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (Part part in vessel.Parts)
             {
                 if (part.HasModule <ModuleCommand>() && !part.name.Contains("mumech"))
                 {
                     commandParts.Add(part);
                     commandPartsNames.Add(part.partInfo.title);
                 }
             }
         }
     }
 }
 public MechJebModuleScriptActionActivateEngine(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     this.enginePartsList.Clear();
     this.enginePartsNames.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (Part part in vessel.Parts)
             {
                 if (part.IsEngine())
                 {
                     enginePartsList.Add(part);
                     enginePartsNames.Add(part.partInfo.title);
                 }
             }
         }
     }
 }
        public MechJebModuleScriptActionSmartASS(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
        {
            this.smartAss = core.GetComputerModule <MechJebModuleSmartASS>();
            int modeIdx = 0;

            foreach (MechJebModuleSmartASS.Target target in Enum.GetValues(typeof(MechJebModuleSmartASS.Target)))
            {
                if (TargetIsMode[(int)target] && target != MechJebModuleSmartASS.Target.AUTO)
                {
                    isTargetMode.Add(true);
                    modeModes.Add((MechJebModuleSmartASS.Mode) 0);
                    targetModes.Add(target);
                    modeStrings.Add(TargetTexts[(int)target]);
                    targetModeSelectorIdxs[(int)target] = modeIdx++;
                }
            }

            foreach (MechJebModuleSmartASS.Mode mode in Enum.GetValues(typeof(MechJebModuleSmartASS.Mode)))
            {
                if (mode != MechJebModuleSmartASS.Mode.AUTO)
                {
                    modeModes.Add(mode);
                    isTargetMode.Add(false);
                    targetModes.Add((MechJebModuleSmartASS.Target) 0);
                    modeStrings.Add(ModeTexts[(int)mode]);
                    modeModeSelectorIdxs[(int)mode] = modeIdx++;
                    targets[(int)mode]       = new List <MechJebModuleSmartASS.Target>();
                    targetStrings[(int)mode] = new List <String>();
                }
            }

            foreach (MechJebModuleSmartASS.Target target in Enum.GetValues(typeof(MechJebModuleSmartASS.Target)))
            {
                if (!TargetIsMode[(int)target])
                {
                    MechJebModuleSmartASS.Mode mode = Target2Mode[(int)target];
                    targetSelectorIdxs[(int)target] = targets[(int)mode].Count;
                    targets[(int)mode].Add(target);
                    targetStrings[(int)mode].Add(TargetTexts[(int)target]);
                }
            }
        }
 public MechJebModuleScriptCondition(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptAction action)
 {
     this.scriptModule = scriptModule;
     this.core         = core;
     this.action       = action;
     moduleInfoItems   = core.GetComputerModule <MechJebModuleInfoItems>();
     conditionsList    = new List <String>();
     modifiersList     = new List <String>();
     conditionsList.Add("Altitude");
     conditionsList.Add("Speed");
     conditionsList.Add("Distance to target");
     conditionsList.Add("Target Apoapsis");
     conditionsList.Add("Target Periapsis");
     conditionsList.Add("Target Time to closest approach");
     conditionsList.Add("Target Distance to closest approach");
     conditionsList.Add("Target Relative velocity");
     conditionsList.Add("Target inclination");
     conditionsList.Add("Target orbit period");
     conditionsList.Add("Target orbit speed");
     conditionsList.Add("Target time to Ap");
     conditionsList.Add("Target time to Pe");
     conditionsList.Add("Target LAN");
     conditionsList.Add("Target AoP");
     conditionsList.Add("Target eccentricity");
     conditionsList.Add("Target SMA");
     conditionsList.Add("Periapsis in Target SOI");
     conditionsList.Add("Phase angle to target");
     conditionsList.Add("Target planet phase angle");
     conditionsList.Add("Relative inclination");
     conditionsList.Add("Time to AN");
     conditionsList.Add("Time to DN");
     conditionsList.Add("Time to equatorial AN");
     conditionsList.Add("Time to equatorial DN");
     conditionsList.Add("Circular orbit speed");
     conditionsList.Add("Apoapsis");
     conditionsList.Add("Periapsis");
     modifiersList.Add("Smaller than");
     modifiersList.Add("Equal to");
     modifiersList.Add("Greater than");
     modifiersList.Add("Between");
 }
 public MechJebModuleScriptActionActionGroup(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     actionGroups.Add("Abord");
     actionGroups.Add("Brakes");
     actionGroups.Add("Custom01");
     actionGroups.Add("Custom02");
     actionGroups.Add("Custom03");
     actionGroups.Add("Custom04");
     actionGroups.Add("Custom05");
     actionGroups.Add("Custom06");
     actionGroups.Add("Custom07");
     actionGroups.Add("Custom08");
     actionGroups.Add("Custom09");
     actionGroups.Add("Custom10");
     actionGroups.Add("Gear");
     actionGroups.Add("Light");
     actionGroups.Add("None");
     actionGroups.Add("RCS");
     actionGroups.Add("SAS");
     actionGroups.Add("Stage");
 }
 public MechJebModuleScriptActionSAS(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
     this.actionTypes.Clear();
     this.actionTypes.Add("Enable");
     this.actionTypes.Add("Disable");
     this.commandParts.Clear();
     this.commandPartsNames.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (Part part in vessel.Parts)
             {
                 if (part.HasModule <ModuleCommand>() && !part.name.Contains("mumech"))
                 {
                     commandParts.Add(part);
                     commandPartsNames.Add(part.name);
                 }
             }
         }
     }
 }
Example #27
0
        public MechJebModuleScriptActionParallel(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
        {
            actions1        = new MechJebModuleScriptActionsList(core, scriptModule, this, actionsList.getDepth() + 1);
            actions2        = new MechJebModuleScriptActionsList(core, scriptModule, this, actionsList.getDepth() + 1);
            sBorderB        = new GUIStyle();
            sBorderB.border = new RectOffset(1, 1, 1, 1);
            Texture2D backgroundB = new Texture2D(16, 16, TextureFormat.RGBA32, false);

            sBorderY        = new GUIStyle();
            sBorderY.border = new RectOffset(1, 1, 1, 1);
            Texture2D backgroundY = new Texture2D(16, 16, TextureFormat.RGBA32, false);

            for (int x = 0; x < backgroundB.width; x++)
            {
                for (int y = 0; y < backgroundB.height; y++)
                {
                    if (x == 0 || x == 15 || y == 0 || y == 15)
                    {
                        backgroundB.SetPixel(x, y, Color.blue);
                        backgroundY.SetPixel(x, y, Color.yellow);
                    }
                    else
                    {
                        backgroundB.SetPixel(x, y, Color.clear);
                        backgroundY.SetPixel(x, y, Color.clear);
                    }
                }
            }
            backgroundB.Apply();
            backgroundY.Apply();

            sBorderB.normal.background   = backgroundB;
            sBorderB.onNormal.background = backgroundB;
            sBorderB.padding             = new RectOffset(1, 1, 1, 1);
            sBorderY.normal.background   = backgroundY;
            sBorderY.onNormal.background = backgroundY;
            sBorderY.padding             = new RectOffset(1, 1, 1, 1);
        }
 public MechJebModuleScriptActionKos(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     kosParts.Clear();
     kosPartsNames.Clear();
     kosModules.Clear();
     foreach (Vessel vessel in FlightGlobals.Vessels)
     {
         if (vessel.state != Vessel.State.DEAD)
         {
             foreach (Part part in vessel.Parts)
             {
                 foreach (PartModule module in part.Modules)
                 {
                     if (module.moduleName.Contains("kOSProcessor"))
                     {
                         this.kosParts.Add(part);
                         this.kosPartsNames.Add(part.partInfo.title);
                         this.kosModules.Add(module);
                     }
                 }
             }
         }
     }
 }
 public MechJebModuleScriptActionQuicksave(MechJebModuleScript scriptModule, MechJebCore core, MechJebModuleScriptActionsList actionsList) : base(scriptModule, core, actionsList, NAME)
 {
 }
 public MechJebModuleScriptActionExecuteNode(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME)
 {
     actionTypes.Add("Next node");
     actionTypes.Add("All nodes");
 }