public StockProcFairingGeoUpdater(ModuleProceduralFairing fairing, GeometryPartModule geoModule) { this.fairing = fairing; this.geoModule = geoModule; if (HighLogic.LoadedSceneIsEditor) prevPanelBounds = new List<Bounds>(); }
public StockProcFairingGeoUpdater(ModuleProceduralFairing fairing, GeometryPartModule geoModule) { this.fairing = fairing; this.geoModule = geoModule; if (HighLogic.LoadedSceneIsEditor) { prevPanelBounds = new List <Bounds>(); } else if (HighLogic.LoadedSceneIsFlight) { SetupFlightEvents(); } }
internal Fairing(Part part) { Part = part; var internalPart = part.InternalPart; fairing = internalPart.Module <ModuleProceduralFairing> (); if (internalPart.HasModule("ProceduralFairingDecoupler")) { proceduralFairing = new Module(part, internalPart.Module("ProceduralFairingDecoupler")); } if (fairing == null && proceduralFairing == null) { throw new ArgumentException("Part is not a fairing"); } }
//really, could probably just move this back to the base class, possibly with a config bool for toggling enable of the secondary updates public void Start() { TextureSet ts = TexturesUnlimitedLoader.getTextureSet(textureSet); if (ts != null) { //apply the textur set to the base model, use set-specified mask colors (does not support user recoloring) ts.enable(part.transform.FindRecursive("model"), ts.maskColors); TextureSetMaterialData tsmd = ts.textureData[materialIndex]; //adjust the already existing fairing materials and fairing panels ModuleProceduralFairing mpf = part.GetComponent <ModuleProceduralFairing>(); if (mpf != null) { if (mpf.FairingMaterial != null && mpf.FairingConeMaterial != null) { tsmd.apply(mpf.FairingMaterial); tsmd.apply(mpf.FairingConeMaterial); } if (mpf.Panels != null && mpf.Panels.Count > 0)//cones are included in regular panels { int len = mpf.Panels.Count; for (int i = 0; i < len; i++) { tsmd.apply(mpf.Panels[i].mat); tsmd.apply(mpf.Panels[i].go.GetComponent <Renderer>().material); } } } } //prev shader-only code... //Shader shader = TexturesUnlimitedLoader.getShader(this.shader); //if (mpf != null && shader != null && mpf.FairingMaterial != null) //{ // mpf.FairingMaterial.shader = shader; // if (mpf.FairingConeMaterial != null) { mpf.FairingConeMaterial.shader = shader; } // MonoBehaviour.print("Adjusted MPF materials!"); // if (mpf.Panels != null && mpf.Panels.Count > 0)//cones are included in regular panels // { // int len = mpf.Panels.Count; // for (int i = 0; i < len; i++) // { // mpf.Panels[i].mat.shader = shader; // mpf.Panels[i].go.GetComponent<Renderer>().material.shader = shader; // } // } //} }
private void applyConfig(Transform root, TextureSet set, bool useSetColors, bool useIconShaders = false) { if (set == null) { return; } RecoloringData[] colors = useSetColors? set.maskColors : customColors; if (useSetColors) { customColors = set.maskColors; saveColors(customColors); } //apply the texture set to the base model (and trusses?) set.enable(root, colors, useIconShaders); if (stockFairing) { TextureSetMaterialData tsmd = set.textureData[0]; //adjust the already existing fairing materials and fairing panels ModuleProceduralFairing mpf = part.GetComponent <ModuleProceduralFairing>(); if (mpf != null) { Material mat; if (mpf.FairingMaterial != null && mpf.FairingConeMaterial != null) { mat = mpf.FairingMaterial; tsmd.apply(mat, useIconShaders); tsmd.applyRecoloring(mat, colors); mat = mpf.FairingConeMaterial; tsmd.apply(mat, useIconShaders); tsmd.applyRecoloring(mat, colors); } if (mpf.Panels != null && mpf.Panels.Count > 0)//cones are included in regular panels { int len = mpf.Panels.Count; for (int i = 0; i < len; i++) { mat = mpf.Panels[i].mat; tsmd.apply(mat, useIconShaders); tsmd.applyRecoloring(mat, colors); mat = mpf.Panels[i].go.GetComponent <Renderer>().material; tsmd.apply(mat, useIconShaders); tsmd.applyRecoloring(mat, colors); } } } } }
private IEnumerator WaitAndUpdateMaterials() { yield return(null); if (string.IsNullOrEmpty(serializedNode)) { this.LogError("Serialized node is null or empty!"); yield break; } ConfigNode node = ConfigNode.Parse(serializedNode).nodes[0]; ModuleProceduralFairing fairingModule = part.FindModuleImplementing <ModuleProceduralFairing>(); if (fairingModule == null) { this.LogError("No fairing module found on part!"); yield break; } MaterialModifierParser parser = new MaterialModifierParser(); foreach (ConfigNode node2 in node.nodes) { IMaterialModifier modifier; try { modifier = parser.Parse(node2); } catch (Exception ex) { this.LogException($"cannot parse node as material modifier: \n{node2.ToString()}\n", ex); continue; } modifier.Modify(fairingModule.FairingMaterial); modifier.Modify(fairingModule.FairingConeMaterial); modifier.Modify(fairingModule.FairingFlightMaterial); modifier.Modify(fairingModule.FairingFlightConeMaterial); foreach (ProceduralFairings.FairingPanel fairingPanel in fairingModule.Panels) { MeshRenderer renderer = fairingPanel.go.GetComponent <MeshRenderer>(); modifier.Modify(renderer.material); } } }
private void ApplyAeroStressFailure() { bool failureOccured = false; if (part.Modules.Contains <ModuleProceduralFairing>()) { ModuleProceduralFairing fairing = part.Modules.GetModule <ModuleProceduralFairing>(); fairing.ejectionForce = 0.5f; fairing.DeployFairing(); failureOccured = true; } List <Part> children = part.children; // ReSharper disable once ForCanBeConvertedToForeach -> decouple modifies collection for (int i = 0; i < children.Count; i++) { Part child = children[i]; child.decouple(25); failureOccured = true; } if (part.parent) { part.decouple(25); failureOccured = true; } if (!failureOccured || !vessel) { return; } vessel.SendMessage("AerodynamicFailureStatus"); string msg = Localizer.Format("FARFlightLogAeroFailure", KSPUtil.PrintTimeStamp(FlightLogger.met), part.partInfo.title); FlightLogger.eventLog.Add(msg); if (FARDebugValues.aeroFailureExplosions) { FXMonger.Explode(part, partTransform.position, (float)projectedArea.totalArea * 0.0005f); } }
public StockProcFairingGeoUpdater(ModuleProceduralFairing fairing, GeometryPartModule geoModule) { this.fairing = fairing; this.geoModule = geoModule; if (validParts == null) { FARLogger.Info("Fairing event setup"); validParts = new Dictionary <Part, GeometryPartModule>(); GameEvents.onFairingsDeployed.Add(FairingDeployGeometryUpdate); } validParts.Add(geoModule.part, geoModule); if (HighLogic.LoadedSceneIsEditor) { prevPanelBounds = new List <Bounds>(); } }
private void ApplyAeroStressFailure() { bool failureOccured = false; if (part.Modules.Contains("ModuleProceduralFairing")) { ModuleProceduralFairing fairing = (ModuleProceduralFairing)part.Modules["ModuleProceduralFairing"]; fairing.ejectionForce = 0.5f; fairing.DeployFairing(); failureOccured = true; } List <Part> children = part.children; for (int i = 0; i < children.Count; i++) { Part child = children[i]; child.decouple(25); failureOccured = true; } if (part.parent) { part.decouple(25); failureOccured = true; } if (failureOccured) { if (vessel) { vessel.SendMessage("AerodynamicFailureStatus"); string msg = String.Format("[{0:D2}:{1:D2}:{2:D2}] {3} failed due to aerodynamic stresses.", FlightLogger.met_hours, FlightLogger.met_mins, FlightLogger.met_secs, part.partInfo.title); FlightLogger.eventLog.Add(msg); if (FARDebugValues.aeroFailureExplosions) { FXMonger.Explode(part, partTransform.position, (float)projectedArea.totalArea * 0.0005f); } } } }
private void SetupIGeometryUpdaters() { geometryUpdaters = new List<IGeometryUpdater>(); if(part is CompoundPart) { CompoundPartGeoUpdater compoundUpdate = new CompoundPartGeoUpdater((CompoundPart)part, this); geometryUpdaters.Add(compoundUpdate); } if(part.Modules.Contains<ModuleProceduralFairing>()) { List<ModuleProceduralFairing> fairings = part.Modules.GetModules<ModuleProceduralFairing>(); for (int i = 0; i < fairings.Count; ++i) { ModuleProceduralFairing fairing = fairings[i]; StockProcFairingGeoUpdater fairingUpdater = new StockProcFairingGeoUpdater(fairing, this); geometryUpdaters.Add(fairingUpdater); } } if(part.Modules.Contains<ModuleJettison>()) { List<ModuleJettison> engineFairings = part.Modules.GetModules<ModuleJettison>(); for (int i = 0; i < engineFairings.Count; ++i) { ModuleJettison engineFairing = engineFairings[i]; StockJettisonTransformGeoUpdater fairingUpdater = new StockJettisonTransformGeoUpdater(engineFairing, this); geometryUpdaters.Add(fairingUpdater); } } if (part.Modules.Contains<ModuleAsteroid>()) { ModuleAsteroid asteroidModule = part.Modules.GetModule<ModuleAsteroid>(); StockProcAsteroidGeoUpdater asteroidUpdater = new StockProcAsteroidGeoUpdater(asteroidModule, this); geometryUpdaters.Add(asteroidUpdater); } }
public override void OnStart(StartState state) { base.OnStart(state); Debug.Log("MPFFix.OnStart(): v01.09"); FairingModule = (ModuleProceduralFairing)GetModule("ModuleProceduralFairing"); if (null == FairingModule) { Debug.LogWarning("ModuleProceduralFairingFix.Start(): Did not find Fairing Module."); return; } SetupStockPlus(); if (plusEnabled == true) { if (ejectionForce < 0) { ejectionForce = FairingModule.ejectionForce; } if (nArcs == 0) { nArcs = FairingModule.nArcs; } } GameEvents.onPartRemove.Add(RemovePart); //part.CoPOffset /= 2; //part.CoLOffset = part.CoPOffset; part.CoPOffset = Vector3.zero; part.CoLOffset = Vector3.zero; }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); if (string.IsNullOrEmpty(configNodeData)) { configNodeData = node.ToString(); } mpf = part.GetComponent<ModuleProceduralFairing>(); updateModelScale();//for prefab part... updateEditorFields(); }
public void Start() { mpf = part.GetComponent <ModuleProceduralFairing>(); updateModelScale();//make sure to update the mpf after it is initialized updateTextureSet(false); }
// Returns the info-text of the given part with the given upgrades to be displayed in the GUI-comparison. private String getPartInfo(Part part, KRnDUpgrade upgradesToApply = null) { String info = ""; KRnDUpgrade originalUpgrades = null; try { KRnDModule rndModule = KRnD.getKRnDModule(part); if (rndModule == null || (originalUpgrades = rndModule.getCurrentUpgrades()) == null) { return(info); } // Upgrade the part to get the correct info, we revert it back to its previous values in the finally block below: KRnD.updatePart(part, upgradesToApply); List <ModuleEngines> engineModules = KRnD.getEngineModules(part); ModuleRCS rcsModule = KRnD.getRcsModule(part); ModuleReactionWheel reactionWheelModule = KRnD.getReactionWheelModule(part); ModuleDeployableSolarPanel solarPanelModule = KRnD.getSolarPanelModule(part); ModuleWheelBase landingLegModule = KRnD.getLandingLegModule(part); PartResource electricChargeResource = KRnD.getChargeResource(part); ModuleGenerator generatorModule = KRnD.getGeneratorModule(part); PartModule fissionGenerator = KRnD.getFissionGeneratorModule(part); List <ModuleResourceConverter> converterModules = KRnD.getConverterModules(part); ModuleParachute parachuteModule = KRnD.getParachuteModule(part); ModuleProceduralFairing fairingModule = KRnD.getFairingModule(part); List <PartResource> fuelResources = KRnD.getFuelResources(part); // Basic stats: info = "<color=#FFFFFF><b>Dry Mass:</b> " + part.mass.ToString("0.#### t") + "\n"; info += "<b>Max Temp.:</b> " + part.maxTemp.ToString("0.#") + "/" + part.skinMaxTemp.ToString("0.#") + " °K\n"; if (landingLegModule != null) { info += "<b>Crash Tolerance:</b> " + part.crashTolerance.ToString("0.#### m/s") + "\n"; } if (electricChargeResource != null) { info += "<b>Electric Charge:</b> " + electricChargeResource.maxAmount.ToString() + "\n"; } // Fuels: if (fuelResources != null) { foreach (PartResource fuelResource in fuelResources) { // Reformat resource-names like "ElectricCharge" to "Electric Charge": String fuelName = fuelResource.resourceName.ToString(); fuelName = Regex.Replace(fuelName, @"([a-z])([A-Z])", "$1 $2"); info += "<b>" + fuelName + ":</b> " + fuelResource.maxAmount.ToString() + "\n"; } } // Module stats: info += "\n"; if (engineModules != null) { foreach (ModuleEngines engineModule in engineModules) { info += "<color=#99FF00><b>Engine"; if (engineModules.Count > 1) { info += " (" + engineModule.engineID.ToString() + ")"; } info += ":</b></color>\n" + engineModule.GetInfo(); if (engineModules.Count > 1) { info += "\n"; } } } if (rcsModule) { info += "<color=#99FF00><b>RCS:</b></color>\n" + rcsModule.GetInfo(); } if (reactionWheelModule) { info += "<color=#99FF00><b>Reaction Wheel:</b></color>\n" + reactionWheelModule.GetInfo(); } if (solarPanelModule) { info += "<color=#99FF00><b>Solar Panel:</b></color>\n" + KRnD.getSolarPanelInfo(solarPanelModule); } if (generatorModule) { info += "<color=#99FF00><b>Generator:</b></color>\n" + generatorModule.GetInfo(); } if (fissionGenerator) { info += "<color=#99FF00><b>Fission-Generator:</b></color>\n" + fissionGenerator.GetInfo(); } if (converterModules != null) { foreach (ModuleResourceConverter converterModule in converterModules) { info += "<color=#99FF00><b>Converter " + converterModule.ConverterName + ":</b></color>\n" + converterModule.GetInfo() + "\n"; } } if (parachuteModule) { info += "<color=#99FF00><b>Parachute:</b></color>\n" + parachuteModule.GetInfo(); } if (fairingModule) { info += "<color=#99FF00><b>Fairing:</b></color>\n" + fairingModule.GetInfo(); } info += "</color>"; } catch (Exception e) { Debug.LogError("[KRnDGUI] getPartInfo(): " + e.ToString()); } finally { try { if (originalUpgrades != null) { KRnD.updatePart(part, originalUpgrades); } } catch (Exception e) { Debug.LogError("[KRnDGUI] getPartInfo() restore of part failed: " + e.ToString()); } } return(info); }
public override void OnStart(StartState state) { base.OnStart(state); mpf = part.GetComponent<ModuleProceduralFairing>(); ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData); textureSets = TextureSet.loadTextureSets(node.GetNodes("TEXTURESET")); int len = textureSets.Length; string[] textureSetNames = new string[len]; for (int i = 0; i < len; i++) { textureSetNames[i] = textureSets[i].setName; } this.updateUIChooseOptionControl("currentTextureSet", textureSetNames, textureSetNames, true, currentTextureSet); updateModelScale(); updateTexture(currentTextureSet); updateNodePositions(false); this.updateUIFloatEditControl("currentDiameter", minDiameter, maxDiameter, diameterIncrement*2f, diameterIncrement, diameterIncrement*0.05f, true, currentDiameter); Fields["currentDiameter"].uiControlEditor.onFieldChanged = onDiameterUpdated; Fields["currentTextureSet"].uiControlEditor.onFieldChanged = onTextureUpdated; Fields["currentTextureSet"].guiActiveEditor = textureSets.Length > 1; updateEditorFields(); }
// Recurse through the master branch and the newly placed symmetric branch, copying over part info. void UpdatePartAndChildren(Part SourcePart, Part UpdatePart, SymmetryMethod SymMethod) { if (null == SourcePart || null == UpdatePart) { // Null parts were passed to the updater. This should not happen, but just in case... return; } // Fix the bug where staging icons split from each other. UpdatePart.originalStage = SourcePart.originalStage; // This shouldn't be needed anymore. if (0 == UpdatePart.symmetryCounterparts.Count) { // This part has no mirrored parts. No need to copy the action groups. return; } CheckAndAddCounterpart(SourcePart, UpdatePart); PropagateCounterparts(SourcePart); // Propagates symmetry method throughout the branch. If it ever hits radial symmetry, the rest of the // branch needs to be listed as symmetry to prevent editor breakage with nested mirror symmetry. if (SourcePart.symmetryCounterparts.Count > 1) { SymMethod = SymmetryMethod.Radial; } //if(SourcePart.symMethod == SymmetryMethod.Radial) //{ // SymMethod = SymmetryMethod.Radial; //} // Debug.LogWarning("SymmMethod: " + SymMethod); SourcePart.symMethod = SymMethod; UpdatePart.symMethod = SymMethod; if (SourcePart.Modules.Count != UpdatePart.Modules.Count) { Debug.LogError("SAFix.onPartAttach(): Part Copy Error. Module Count Mismatch."); return; } // Loop through all the modules. Action groups are stored inside the PartModules for (int IndexModules = 0; IndexModules < UpdatePart.Modules.Count; IndexModules++) { if (SourcePart.Modules[IndexModules].Actions.Count != UpdatePart.Modules[IndexModules].Actions.Count) { Debug.LogError("SAFix.UpdatePartAndChildren(): Actions Mismatch in Module. Action copy aborted at Module: " + SourcePart.Modules[IndexModules].moduleName); return; } // Loop through all the Actions for this module. for (int IndexActions = 0; IndexActions < SourcePart.Modules[IndexModules].Actions.Count; IndexActions++) { // Copy the Action's triggers. // Debug.LogWarning("Module/Action " + UpdatePart.Modules[IndexModules].Actions[IndexActions].name); UpdatePart.Modules[IndexModules].Actions[IndexActions].actionGroup = SourcePart.Modules[IndexModules].Actions[IndexActions].actionGroup; } if ("ModuleProceduralFairing" == SourcePart.Modules[IndexModules].moduleName) { Debug.Log("SymmetryActionFix: Fixing Procedural Fairing"); ModuleProceduralFairing MPFSource = (ModuleProceduralFairing)SourcePart.Modules[IndexModules]; ModuleProceduralFairing MPFUpdate = (ModuleProceduralFairing)UpdatePart.Modules[IndexModules]; if (MPFSource.xSections.Count != 0) { MPFUpdate.xSections.AddRange(MPFSource.xSections); MethodInfo MPFMethod = MPFUpdate.GetType().GetMethod("SpawnMeshes", BindingFlags.NonPublic | BindingFlags.Instance); if (MPFMethod != null) { MPFMethod.Invoke(MPFUpdate, new object[] { true }); } } } } for (int IndexChild = 0; IndexChild < UpdatePart.children.Count; IndexChild++) { // Go through all the children parts and copy the actions. UpdatePartAndChildren(SourcePart.children[IndexChild], UpdatePart.children[IndexChild], SymMethod); } } // UpdatePartAndChild
public override void OnLoad(ConfigNode node) { base.OnLoad(node); pm = part.Modules.GetModule <ModuleProceduralFairing>(); }
public PartStats(Part part) { this.mass = part.mass; if (part.partInfo.variant != null) { kRnDVariants = KRnD.getVariants(part); currentVariant = part.partInfo.variant.Name; currentVariantMass = part.partInfo.variant.Mass; variantBaseMass = part.baseVariant.Mass; } if (kRnDVariants != null) { hasVariants = true; } else { currentVariantMass = 0; variantBaseMass = 0; hasVariants = false; } this.skinMaxTemp = part.skinMaxTemp; this.intMaxTemp = part.maxTemp; // There should only be one or the other, engines or RCS: List <ModuleEngines> engineModules = KRnD.getEngineModules(part); ModuleRCS rcsModule = KRnD.getRcsModule(part); if (engineModules != null) { this.maxFuelFlows = new List <float>(); this.atmosphereCurves = new List <FloatCurve>(); for (int i = 0; i < engineModules.Count; i++) { ModuleEngines engineModule = engineModules[i]; this.maxFuelFlows.Add(engineModule.maxFuelFlow); FloatCurve atmosphereCurve = new FloatCurve(); for (int i5 = 0; i5 < engineModule.atmosphereCurve.Curve.length; i5++) { Keyframe frame = engineModule.atmosphereCurve.Curve[i5]; atmosphereCurve.Add(frame.time, frame.value); } this.atmosphereCurves.Add(atmosphereCurve); } } else if (rcsModule) { this.maxFuelFlows = new List <float>(); this.atmosphereCurves = new List <FloatCurve>(); this.maxFuelFlows.Add(rcsModule.thrusterPower); FloatCurve atmosphereCurve = new FloatCurve(); for (int i = 0; i < rcsModule.atmosphereCurve.Curve.length; i++) { Keyframe frame = rcsModule.atmosphereCurve.Curve[i]; atmosphereCurve.Add(frame.time, frame.value); } this.atmosphereCurves.Add(atmosphereCurve); } ModuleReactionWheel reactionWheel = KRnD.getReactionWheelModule(part); if (reactionWheel) { this.torque = reactionWheel.RollTorque; // There is also pitch- and yaw-torque, but they should all be the same } // WIP //ModuleDataTransmitter dataTransmitter = KRnD.getDataTransmitterModule(part); //if (dataTransmitter) //{ // this.antPower = dataTransmitter.antennaPower; //} ModuleResourceHarvester resourceHarvester = KRnD.getResourceHarvesterModule(part); if (resourceHarvester) { this.harvester = resourceHarvester.Efficiency; } ModuleActiveRadiator activeRadiator = KRnD.getActiveRadiatorModule(part); if (activeRadiator) { this.radiatorEfficiency = activeRadiator.maxEnergyTransfer; } ModuleDeployableSolarPanel solarPanel = KRnD.getSolarPanelModule(part); if (solarPanel) { this.chargeRate = solarPanel.chargeRate; } ModuleWheelBase landingLeg = KRnD.getLandingLegModule(part); if (landingLeg) { this.crashTolerance = part.crashTolerance; // Every part has a crash tolerance, but we only want to improve landing legs. } PartResource electricCharge = KRnD.getChargeResource(part); if (electricCharge != null) { this.batteryCharge = electricCharge.maxAmount; } ModuleGenerator generator = KRnD.getGeneratorModule(part); if (generator != null) { generatorEfficiency = new Dictionary <String, double>(); for (int i = 0; i < generator.resHandler.outputResources.Count; i++) { ModuleResource outputResource = generator.resHandler.outputResources[i]; generatorEfficiency.Add(outputResource.name, outputResource.rate); } } PartModule fissionGenerator = KRnD.getFissionGeneratorModule(part); if (fissionGenerator != null) { fissionPowerGeneration = KRnD.getGenericModuleValue(fissionGenerator, "PowerGeneration"); } // There might be different converter-modules in the same part with different names (eg for Fuel, Monopropellant, etc): List <ModuleResourceConverter> converterList = KRnD.getConverterModules(part); if (converterList != null) { converterEfficiency = new Dictionary <String, Dictionary <String, double> >(); for (int i = 0; i < converterList.Count; i++) { ModuleResourceConverter converter = converterList[i]; Dictionary <String, double> thisConverterEfficiency = new Dictionary <String, double>(); for (int i2 = 0; i2 < converter.outputList.Count; i2++) { ResourceRatio resourceRatio = converter.outputList[i2]; thisConverterEfficiency.Add(resourceRatio.ResourceName, resourceRatio.Ratio); } converterEfficiency.Add(converter.ConverterName, thisConverterEfficiency); } } ModuleParachute parachute = KRnD.getParachuteModule(part); if (parachute) { this.chuteMaxTemp = parachute.chuteMaxTemp; } ModuleProceduralFairing fairing = KRnD.getFairingModule(part); if (fairing) { this.fairingAreaMass = fairing.UnitAreaMass; } List <PartResource> fuelResources = KRnD.getFuelResources(part); if (fuelResources != null) { fuelCapacities = new Dictionary <string, double>(); fuelCapacitiesSum = 0; for (int i = 0; i < fuelResources.Count; i++) { PartResource fuelResource = fuelResources[i]; fuelCapacities.Add(fuelResource.resourceName, fuelResource.maxAmount); fuelCapacitiesSum += fuelResource.maxAmount; } } }
public override void OnStart(StartState state) { base.OnStart(state); Debug.Log("MPFFix.OnStart(): v01.09"); FairingModule = (ModuleProceduralFairing) GetModule("ModuleProceduralFairing"); if (null == FairingModule) { Debug.LogWarning("ModuleProceduralFairingFix.Start(): Did not find Fairing Module."); return; } SetupStockPlus(); if (plusEnabled == true) { if (ejectionForce < 0) { ejectionForce = FairingModule.ejectionForce; } if (nArcs == 0) { nArcs = FairingModule.nArcs; } } GameEvents.onPartRemove.Add(RemovePart); //part.CoPOffset /= 2; //part.CoLOffset = part.CoPOffset; part.CoPOffset = Vector3.zero; part.CoLOffset = Vector3.zero; }
protected override void LoadPartModules() { base.LoadPartModules(); pm = part.Modules.GetModule <ModuleProceduralFairing>(); }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); if (node.HasNode("TECHLIMIT") || node.HasNode("TEXTURESET")) { configNodeData = node.ToString(); } mpf = part.GetComponent<ModuleProceduralFairing>(); updateModelScale();//for prefab part... updateTexture(); }
public void Start() { mpf = part.GetComponent<ModuleProceduralFairing>(); updateModelScale();//make sure to update the mpf after it is initialized updateTexture(); }
public void Start() { mpf = part.GetComponent<ModuleProceduralFairing>(); updateModelScale();//make sure to updat the mpf after it is linked }
public override void OnStart(StartState state) { base.OnStart(state); mpf = part.GetComponent<ModuleProceduralFairing>(); ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData); techLimits = TechLimitHeightDiameter.loadTechLimits(node.GetNodes("TECHLIMIT")); textureSets = TextureSet.loadTextureSets(node.GetNodes("TEXTURESET")); updateTechLimits(); updateModelScale(); updateTexture(); updateNodePositions(false); }
public override void OnAwake() { base.OnAwake(); pm = part.Modules.GetModule <ModuleProceduralFairing>(); }