Пример #1
0
 private ListValue GetPartsNamed(string partName)
 {
     return(PartValueFactory.Construct(GetRawPartsNamed(partName), Shared));
 }
Пример #2
0
        private ListValue GetPartsInGroup(string groupName)
        {
            var    matchGroup = KSPActionGroup.None;
            string upperName  = groupName.ToUpper();

            // TODO: later refactor:  put this in a Dictionary lookup instead, and then share it
            // by both this code and the code in ActionGroup.cs:
            if (upperName == "SAS")
            {
                matchGroup = KSPActionGroup.SAS;
            }
            if (upperName == "GEAR")
            {
                matchGroup = KSPActionGroup.Gear;
            }
            if (upperName == "LIGHTS")
            {
                matchGroup = KSPActionGroup.Light;
            }
            if (upperName == "BRAKES")
            {
                matchGroup = KSPActionGroup.Brakes;
            }
            if (upperName == "RCS")
            {
                matchGroup = KSPActionGroup.RCS;
            }
            if (upperName == "ABORT")
            {
                matchGroup = KSPActionGroup.Abort;
            }
            if (upperName == "AG1")
            {
                matchGroup = KSPActionGroup.Custom01;
            }
            if (upperName == "AG2")
            {
                matchGroup = KSPActionGroup.Custom02;
            }
            if (upperName == "AG3")
            {
                matchGroup = KSPActionGroup.Custom03;
            }
            if (upperName == "AG4")
            {
                matchGroup = KSPActionGroup.Custom04;
            }
            if (upperName == "AG5")
            {
                matchGroup = KSPActionGroup.Custom05;
            }
            if (upperName == "AG6")
            {
                matchGroup = KSPActionGroup.Custom06;
            }
            if (upperName == "AG7")
            {
                matchGroup = KSPActionGroup.Custom07;
            }
            if (upperName == "AG8")
            {
                matchGroup = KSPActionGroup.Custom08;
            }
            if (upperName == "AG9")
            {
                matchGroup = KSPActionGroup.Custom09;
            }
            if (upperName == "AG10")
            {
                matchGroup = KSPActionGroup.Custom10;
            }

            ListValue kScriptParts = new ListValue();

            if (matchGroup == KSPActionGroup.None)
            {
                return(kScriptParts);
            }

            foreach (global::Part p in Vessel.parts)
            {
                // See if any of the parts' actions are this action group:
                bool hasPartAction = p.Actions.Any(a => a.actionGroup.Equals(matchGroup));
                if (hasPartAction)
                {
                    kScriptParts.Add(PartValueFactory.Construct(p, Shared));
                    continue;
                }

                var  modules         = p.Modules.Cast <PartModule>();
                bool hasModuleAction = modules.Any(pm => pm.Actions.Any(a => a.actionGroup.Equals(matchGroup)));
                if (hasModuleAction)
                {
                    kScriptParts.Add(PartValueFactory.Construct(p, Shared));
                }
            }
            return(kScriptParts);
        }
Пример #3
0
 public ListValue GetAllParts()
 {
     return(PartValueFactory.Construct(Vessel.Parts, Shared));
 }
Пример #4
0
 private ListValue GetModulesNamed(StringValue modName)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetModulesNamed(modName));
 }
Пример #5
0
 private ListValue GetPartsTagged(string tagName)
 {
     return(PartValueFactory.Construct(GetRawPartsTagged(tagName), Shared));
 }
Пример #6
0
 private ListValue GetPartsTaggedPattern(StringValue tagPattern)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsTaggedPattern(tagPattern));
 }
Пример #7
0
 /// <summary>
 /// Get all the parts which have at least SOME non-default name:
 /// </summary>
 /// <returns></returns>
 private ListValue GetAllTaggedParts()
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetAllTaggedParts());
 }
Пример #8
0
 private ListValue GetPartsTagged(StringValue tagName)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsTagged(tagName));
 }
Пример #9
0
 private ListValue GetPartsTitledPattern(StringValue partTitlePattern)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsTitledPattern(partTitlePattern));
 }
Пример #10
0
 private ListValue GetPartsNamed(StringValue partName)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsNamed(partName));
 }
Пример #11
0
 private ListValue GetPartsDubbedPattern(StringValue searchPattern)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsDubbedPattern(searchPattern));
 }
Пример #12
0
 private ListValue GetPartsDubbed(StringValue searchTerm)
 {
     return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsDubbed(searchTerm));
 }