public static void UpdateAvailableComponents(VesselConfig CFG) { AvailableComponents.Clear(); foreach (var c in Components.Keys) { var cmp = Components[c]; var reqs = cmp.Component.GetCustomAttributes(typeof(RequireModules), true) as RequireModules[]; var available = true; if (reqs != null && reqs.Length > 0) { foreach (var req in reqs) { foreach (var m in req.Modules) { available &= TCAModulesDatabase.ModuleAvailable(m, CFG); if (!available) { break; } } if (!available) { break; } } } if (available) { AvailableComponents[c] = cmp; } } }
public override void Awake() { base.Awake(); width = 600; height = 400; GameEvents.onEditorShipModified.Add(OnShipModified); GameEvents.onEditorLoad.Add(OnShipLoad); GameEvents.onEditorRestart.Add(Reset); Available = false; //module availability HasMacroProcessor = TCAModulesDatabase.ModuleAvailable(typeof(MacroProcessor)); HasVTOLAssist = TCAModulesDatabase.ModuleAvailable(typeof(VTOLAssist)); HasVTOLControls = TCAModulesDatabase.ModuleAvailable(typeof(VTOLControl)); HasFlightStabilizer = TCAModulesDatabase.ModuleAvailable(typeof(FlightStabilizer)); HasAltitudeControl = TCAModulesDatabase.ModuleAvailable(typeof(AltitudeControl)); //update TCA part infos foreach (var ap in PartLoader.LoadedPartsList) { foreach (var mi in ap.moduleInfos) { if (mi.moduleName != ModuleTCA.TCA_NAME) { continue; } mi.info = TCAScenario.ModuleStatusString(); mi.primaryInfo = "<b>TCA:</b> " + mi.info; } } }
public void UpdateInfo() { info = PartLoader.getPartInfoByName(Name); if (info == null) { return; } Title = info.title; Purchased = Utils.PartIsPurchased(Name); Active = modules.All(m => TCAModulesDatabase.ModuleAvailable(m.Module)); }
public void UpdateInfo(VesselConfig CFG = null) { if (info == null) { info = PartLoader.getPartInfoByName(Name); if (info != null) { Title = info.title; Description = info.description; } if (string.IsNullOrEmpty(Title)) { Title = Utils.ParseCamelCase(Name); } } Purchased = Utils.PartIsPurchased(Name); Active = Modules.All(m => TCAModulesDatabase.ModuleAvailable(m.Module, CFG)); }
void update_modules() { Modules.Clear(); TCAModulesDatabase.ValidModules .ForEach(t => Modules.Add(t, TCAModulesDatabase.ModuleAvailable(t, CFG))); }