/// <summary> /// Updates the mount module from user input in the editor /// </summary> /// <param name="newMount"></param> /// <param name="updateSymmetry"></param> private void updateMountFromEditor(String newMount, bool updateSymmetry) { SRBNozzleData mod = Array.Find(nozzleModules, m => m.name == newMount); if (mod != null && mod != currentNozzleModule) { //finally, clear any existing models from prefab, and initialize the currently configured models resetTransformParents(); currentNozzleModule.destroyCurrentModel(); currentNozzleModule = mod; currentNozzleModule.setupModel(part, part.transform.FindRecursive(baseTransformName), ModelOrientation.BOTTOM); currentNozzleName = currentNozzleModule.name; currentGimbalOffset = 0; } if (!currentNozzleModule.isValidTextureSet(currentNozzleTexture)) { currentNozzleTexture = currentNozzleModule.modelDefinition.defaultTextureSet; } currentNozzleModule.enableTextureSet(currentNozzleTexture); updateModelScaleAndPosition(); updatePartResources(); updatePartMass(); updateAttachnodes(true); updateThrustOutput(); currentNozzleModule.setupTransformDefaults(part.transform.FindRecursive(thrustTransformName), part.transform.FindRecursive(gimbalTransformName)); updateGimbalOffset(); updateEngineISP(); updateEditorValues(); updateGui(); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent<SSTUModularBooster>().updateMountFromEditor(newMount, false); } GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); } }
/// <summary> /// Updates the mount module from user input in the editor /// </summary> /// <param name="newMount"></param> /// <param name="updateSymmetry"></param> private void updateMountFromEditor(String newMount, bool updateSymmetry) { SRBNozzleData mod = Array.Find(nozzleModules, m => m.name == newMount); if (mod != null && mod != currentNozzleModule) { //finally, clear any existing models from prefab, and initialize the currently configured models resetTransformParents(); currentNozzleModule.destroyCurrentModel(); currentNozzleModule = mod; currentNozzleModule.setupModel(part.transform.FindRecursive(baseTransformName), ModelOrientation.BOTTOM); currentGimbalOffset = 0; } currentNozzleName = currentNozzleModule.name; if (!currentNozzleModule.isValidTextureSet(currentNozzleTexture)) { currentNozzleTexture = currentNozzleModule.getDefaultTextureSet(); } currentNozzleModule.enableTextureSet(currentNozzleTexture); currentNozzleModule.updateTextureUIControl(this, "currentNozzleTexture", currentNozzleTexture); updateModelScaleAndPosition(); updateEffectsScale(); updateContainerVolume(); updatePartMass(); updatePartCost(); updateAttachnodes(true); currentNozzleModule.setupTransformDefaults(part.transform.FindRecursive(thrustTransformName), part.transform.FindRecursive(gimbalTransformName)); updateGimbalOffset(); updateEngineISP(); updateEditorValues(); updateThrustOutput(); float val = currentNozzleModule.gimbalAdjustmentRange; this.updateUIFloatEditControl("currentGimbalOffset", -val, val, 2f, 1f, 0.1f, true, currentGimbalOffset); updateGui(); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent<SSTUModularBooster>().updateMountFromEditor(newMount, false); } } SSTUStockInterop.fireEditorUpdate(); SSTUModInterop.onPartGeometryUpdate(part, true); }