// This Methods loads the correct fuel mode public override void SetDefaultFuelMode() { if (FuelModes == null) { Debug.Log("[KSPI]: MSRC SetDefaultFuelMode - load fuel modes"); FuelModes = GetReactorFuelModes(); } CurrentFuelMode = (fuel_mode < FuelModes.Count) ? FuelModes[fuel_mode] : FuelModes.FirstOrDefault(); }
public override void SetDefaultFuelMode() { Debug.Log("[KSPI]: FusionReactor SetDefaultFuelMode"); if (FuelModes == null) { Debug.Log("[KSPI]: FusionReactor SetDefaultFuelMode - load fuel modes"); FuelModes = GetReactorFuelModes(); } if (!string.IsNullOrEmpty(fuel_mode_name) && FuelModes.Any(m => m.ModeGUIName == fuel_mode_name)) { CurrentFuelMode = FuelModes.First(m => m.ModeGUIName == fuel_mode_name); } else if (!string.IsNullOrEmpty(fuel_mode_variant) && FuelModes.Any(m => m.Variants.Any(l => l.Name == fuel_mode_variant))) { CurrentFuelMode = FuelModes.First(m => m.Variants.Any(l => l.Name == fuel_mode_variant)); } else if (fuelmode_index >= 0 && FuelModes.Any(m => m.Index == fuelmode_index)) { CurrentFuelMode = FuelModes.First(m => m.Index == fuelmode_index); } else if (FuelModes.Any(m => m.Index == fuel_mode)) { CurrentFuelMode = FuelModes.First(m => m.Index == fuel_mode); } else { CurrentFuelMode = (fuel_mode < FuelModes.Count) ? FuelModes[fuel_mode] : FuelModes.FirstOrDefault(); } fuel_mode = FuelModes.IndexOf(CurrentFuelMode); }