protected virtual void setTankSetFromEditor(String newTankSet, bool updateSymmetry) { TankSet newSet = Array.Find(tankSets, m => m.name == newTankSet); currentTankSetModule = newSet; string variant = lastSelectedVariant; string newTankName = newSet.getDefaultModel(lastSelectedVariant); this.updateUIChooseOptionControl("currentTankType", newSet.getModelNames(), newSet.getTankDescriptions(), true, newTankName); setMainTankModuleFromEditor(newTankName, false); Fields["currentTankType"].guiActiveEditor = newSet.Length > 1; //re-seat this if it was changed in the 'setMainTankModuleFromEditor' method //will allow for user-initiated main-tank changes to still change the 'last variant' but will //persist the variant if the newly selected set did not contain the selected variant //so that it will persist to the next set selection, OR be reseated on the next user-tank selection within the current set if (!currentTankSetModule.hasVariant(variant)) { lastSelectedVariant = variant; } if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent <SSTUModularFuelTank>().setTankSetFromEditor(newTankSet, false); } } }
protected virtual void setTankSetFromEditor(String newTankSet, bool updateSymmetry) { TankSet newSet = Array.Find(tankSets, m => m.name == newTankSet); currentTankSetModule = newSet; string variant = lastSelectedVariant; string newTankName = newSet.getDefaultModel(lastSelectedVariant); this.updateUIChooseOptionControl("currentTankType", newSet.getModelNames(), newSet.getTankDescriptions(), true, newTankName); setMainTankModuleFromEditor(newTankName, false); Fields["currentTankType"].guiActiveEditor = newSet.Length > 1; //re-seat this if it was changed in the 'setMainTankModuleFromEditor' method //will allow for user-initiated main-tank changes to still change the 'last variant' but will //persist the variant if the newly selected set did not contain the selected variant //so that it will persist to the next set selection, OR be reseated on the next user-tank selection within the current set if (!currentTankSetModule.hasVariant(variant)) { lastSelectedVariant = variant; } if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent<SSTUModularFuelTank>().setTankSetFromEditor(newTankSet, false); } } }