private ListValue GetPartsNamed(string partName) { return(PartValueFactory.Construct(GetRawPartsNamed(partName), Shared)); }
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); }
public ListValue GetAllParts() { return(PartValueFactory.Construct(Vessel.Parts, Shared)); }
private ListValue GetModulesNamed(StringValue modName) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetModulesNamed(modName)); }
private ListValue GetPartsTagged(string tagName) { return(PartValueFactory.Construct(GetRawPartsTagged(tagName), Shared)); }
private ListValue GetPartsTaggedPattern(StringValue tagPattern) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsTaggedPattern(tagPattern)); }
/// <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()); }
private ListValue GetPartsTagged(StringValue tagName) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsTagged(tagName)); }
private ListValue GetPartsTitledPattern(StringValue partTitlePattern) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsTitledPattern(partTitlePattern)); }
private ListValue GetPartsNamed(StringValue partName) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsNamed(partName)); }
private ListValue GetPartsDubbedPattern(StringValue searchPattern) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsDubbedPattern(searchPattern)); }
private ListValue GetPartsDubbed(StringValue searchTerm) { return(PartValueFactory.Construct(Vessel.rootPart, Shared).GetPartsDubbed(searchTerm)); }