private void updateRCSThrust() { rcsBlockModule.renameRCSThrustTransforms(rcsThrustTransformName); ModuleRCS rcsModule = part.GetComponent <ModuleRCS>(); if (rcsModule != null) { ModelRCSModuleData data = rcsBlockModule.layoutOptions.definition.rcsModuleData; float thrust = data.getThrust(rcsBlockModule.moduleVerticalScale); rcsModule.thrusterPower = thrust; } }
private void init() { if (initialized) { return; } initialized = true; standoffRotatedRoot = part.transform.FindRecursive("SSTUModularRCSStructureRoot"); if (standoffRotatedRoot == null) { standoffRotatedRoot = new GameObject("SSTUModularRCSStructureRoot").transform; standoffRotatedRoot.NestToParent(part.transform.FindRecursive("model")); standoffRotatedRoot.Rotate(90, -90, 0); } modelRotatedRoot = part.transform.FindRecursive("SSTUModularRCSBlockRoot"); if (modelRotatedRoot == null) { modelRotatedRoot = new GameObject("SSTUModularRCSBlockRoot").transform; modelRotatedRoot.NestToParent(part.transform.FindRecursive("model")); modelRotatedRoot.Rotate(0, 0, 0); } ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData); ModelDefinitionLayoutOptions[] blocks = SSTUModelData.getModelDefinitions(node.GetNodes("MODEL")); ModelDefinitionLayoutOptions[] structs = SSTUModelData.getModelDefinitions(node.GetNodes("STRUCTURE")); modelTransform = modelRotatedRoot.FindOrCreate("ModularRCSModel"); rcsBlockModule = new ModelModule <SSTUModularRCS>(part, this, modelTransform, ModelOrientation.CENTRAL, nameof(currentModel), nameof(currentLayout), nameof(currentTexture), nameof(modelPersistentData), null, null, null, null); rcsBlockModule.name = "RCSBlock"; rcsBlockModule.getSymmetryModule = m => m.rcsBlockModule; rcsBlockModule.setupModelList(blocks); rcsBlockModule.getValidOptions = () => blocks; rcsBlockModule.setupModel(); rcsBlockModule.updateSelections(); standoffTransform = standoffRotatedRoot.FindOrCreate("ModularRCSStandoff"); standoffModule = new ModelModule <SSTUModularRCS>(part, this, standoffTransform, ModelOrientation.TOP, nameof(currentStructure), nameof(currentLayout), nameof(currentStructureTexture), nameof(structurePersistentData), null, null, null, null); standoffModule.name = "Standoff"; standoffModule.getSymmetryModule = m => m.standoffModule; standoffModule.setupModelList(structs); standoffModule.getValidOptions = () => structs; standoffModule.setupModel(); standoffModule.updateSelections(); updateModelScale(); updateMassAndCost(); rcsBlockModule.renameRCSThrustTransforms(rcsThrustTransformName); updateAttachNodes(false); }