コード例 #1
0
ファイル: SSTUEventRename.cs プロジェクト: Joshg213/SSTULabs
 public RenameEntry(ConfigNode node)
 {
     moduleIndex = node.GetIntValue("moduleIndex");
     isAction = node.GetBoolValue("isAction");
     onTick = node.GetBoolValue("onTick");
     eventName = node.GetStringValue("eventName");
     newGuiName = node.GetStringValue("newGuiName");
 }
コード例 #2
0
ファイル: EngineMount.cs プロジェクト: SixDasher/SSTULabs
 public EngineMount(ConfigNode node)
 {
     name = node.GetStringValue("name");
     layoutNames = node.GetValues("layoutName");
     defaultDiameter = node.GetFloatValue("size", defaultDiameter);
     minDiameter = node.GetFloatValue("minSize", minDiameter);
     maxDiameter = node.GetFloatValue("maxSize", maxDiameter);
     engineSpacing = node.GetFloatValue("engineSpacing", engineSpacing);
     canAdjustSize = node.GetBoolValue("canAdjustSize", canAdjustSize);
     rotateEngineModels = node.GetBoolValues("rotateEngines");
     mountDefinition = SSTUEngineMountDefinition.getMountDefinition(name);
 }
コード例 #3
0
ファイル: ModelData.cs プロジェクト: SixDasher/SSTULabs
 public ModelData(ConfigNode node)
 {
     name = node.GetStringValue("name", String.Empty);
     modelName = node.GetStringValue("modelName", String.Empty);
     techLimit = node.GetStringValue("techLimit", techLimit);
     height = node.GetFloatValue("height", height);
     volume = node.GetFloatValue("volume", volume);
     mass = node.GetFloatValue("mass", mass);
     cost = node.GetFloatValue("cost", cost);
     diameter = node.GetFloatValue("diameter", diameter);
     verticalOffset = node.GetFloatValue("verticalOffset", verticalOffset);
     invertModel = node.GetBoolValue("invertModel", invertModel);
 }
コード例 #4
0
ファイル: FairingData.cs プロジェクト: Joshg213/SSTULabs
 //to be called on initial prefab part load; populate the instance with the default values from the input node
 public virtual void load(ConfigNode node, GameObject root)
 {
     fairingBase = new FairingContainer(root, cylinderSides, numOfSections, wallThickness);
     fairingBase.outsideUV = new UVArea(0.00390625f, 0.00390625f, 0.49609375f, 0.99609375f);
     fairingBase.insideUV = new UVArea(0.50390625f, 0.00390625f, 0.99609375f, 0.99609375f);
     fairingBase.edgesUV = new UVArea(0.00390625f, 0.00390625f, 0.49609375f, 0.99609375f);
     rotationOffset = node.GetVector3("rotationOffset", Vector3.zero);
     topY = node.GetFloatValue("topY", topY);
     bottomY = node.GetFloatValue("bottomY", bottomY);
     capSize = node.GetFloatValue("capSize", capSize);
     wallThickness = node.GetFloatValue("wallThickness", wallThickness);
     maxPanelHeight = node.GetFloatValue("maxPanelHeight", maxPanelHeight);
     cylinderSides = node.GetIntValue("cylinderSides", cylinderSides);
     numOfSections = node.GetIntValue("numOfSections", numOfSections);
     topRadius = node.GetFloatValue("topRadius", topRadius);
     bottomRadius = node.GetFloatValue("bottomRadius", bottomRadius);
     canAdjustTop = node.GetBoolValue("canAdjustTop", canAdjustTop);
     canAdjustBottom = node.GetBoolValue("canAdjustBottom", canAdjustBottom);
     removeMass = node.GetBoolValue("removeMass", removeMass);
     fairingJettisonMass = node.GetFloatValue("fairingJettisonMass", fairingJettisonMass);
     jettisonForce = node.GetFloatValue("jettisonForce", jettisonForce);
     jettisonDirection = node.GetVector3("jettisonDirection", jettisonDirection);
     fairingName = node.GetStringValue("name", fairingName);
 }
コード例 #5
0
 private void loadLookConstraint(ConfigNode node)
 {
     String transformName = node.GetStringValue("transformName");
     String targetName = node.GetStringValue("targetName");
     bool singleTarget = node.GetBoolValue("singleTarget", false);
     Transform[] movers = part.FindModelTransforms(transformName);
     Transform[] targets = part.FindModelTransforms(targetName);
     int len = movers.Length;
     SSTULookConstraint lookConst;
     for (int i = 0; i < len; i++)
     {
         lookConst = new SSTULookConstraint(node, movers[i], singleTarget ? targets[0] : targets[i], part);
         constraints.Add(lookConst);
     }
 }
コード例 #6
0
 public ParachuteModelData(ConfigNode node, Vector3 retracted, Vector3 semi, Vector3 full, int index, bool main)
 {
     name = node.GetStringValue("name");
     definition = SSTUParachuteDefinitions.getDefinition(name);
     modelName = definition.modelName;
     localPosition = node.GetVector3("localPosition");
     retractedUpVector = node.GetVector3("retractedUpVector");
     semiDeployedUpVector = node.GetVector3("semiDeployedUpVector");
     fullDeployedUpVector = node.GetVector3("fullDeployedUpVector");
     texture = node.GetStringValue("texture", texture);
     debug = node.GetBoolValue("debug");
     retractedScale = retracted;
     semiDeployedScale = semi;
     fullDeployedScale = full;
     this.index = index;
     this.main = main;
 }
コード例 #7
0
 public EngineClusterLayoutMountData(ConfigNode node)
     : base(node)
 {
     canAdjustSize = node.GetBoolValue("canAdjustSize", canAdjustSize);
     initialDiameter = node.GetFloatValue("size", initialDiameter);
     minDiameter = node.GetFloatValue("minSize", initialDiameter);
     maxDiameter = node.GetFloatValue("maxSize", initialDiameter);
     rotateEngines = node.GetFloatValuesCSV("rotateEngines", new float[] {});
     engineSpacing = node.GetFloatValue("engineSpacing", engineSpacing);
     if (String.IsNullOrEmpty(modelDefinition.modelName)) { canAdjustSize = false; }
 }
コード例 #8
0
        /// <summary>
        /// Merges global and local config nodes for an engine layout<para/>
        /// Local node values have priority if they are present; any non-specified local values are defaulted
        /// to the global value
        /// </summary>
        /// <param name="global"></param>
        /// <param name="local"></param>
        /// <returns></returns>
        private ConfigNode mergeNodes(ConfigNode global, ConfigNode local)
        {
            ConfigNode output = new ConfigNode("MOUNT");
            global.CopyTo(output);
            if (local.HasValue("canAdjustSize"))
            {
                output.RemoveValues("canAdjustSize");
                output.AddValue("canAdjustSize", local.GetBoolValue("canAdjustSize"));
            }
            if (local.HasValue("size"))
            {
                output.RemoveValues("size");
                output.AddValue("size", local.GetFloatValue("size"));
            }
            if (local.HasValue("minSize"))
            {
                output.RemoveValues("minSize");
                output.AddValue("minSize", local.GetFloatValue("minSize"));
            }
            if (local.HasValue("maxSize"))
            {
                output.RemoveValues("maxSize");
                output.AddValue("maxSize", local.GetFloatValue("maxSize"));
            }
            if (local.HasValue("engineSpacing"))
            {
                output.RemoveValues("engineSpacing");
                output.AddValue("engineSpacing", local.GetFloatValue("engineSpacing"));
            }
            if (local.HasValue("rotateEngines"))
            {
                output.RemoveValues("rotateEngines");
                output.AddValue("rotateEngines", local.GetStringValue("rotateEngines"));
            }

            return output;
        }
コード例 #9
0
ファイル: SSTUMeshSwitch.cs プロジェクト: Joshg213/SSTULabs
 public MeshNodeData(ConfigNode inputNode, Part inputPart)
 {
     nodeName = inputNode.GetStringValue("name");
     if (String.IsNullOrEmpty(nodeName)) { MonoBehaviour.print("ERROR!! : Node name was null for meshswitch node data!!"); }
     nodeEnabled = inputNode.GetBoolValue("enabled", true);
     this.part = inputPart;
     if (inputNode.HasValue("position"))
     {
         nodePosition = inputNode.GetVector3("position");
     }
     else if (nodeEnabled == true)
     {
         MonoBehaviour.print("ERROR -- no position assigned, but node: " + nodeName + " is enabled for mesh switch");
         nodePosition = Vector3.zero;
     }
     if (inputNode.HasValue("orientation"))
     {
         nodeOrientation = inputNode.GetVector3("orientation");
     }
     else if (nodeEnabled == true)
     {
         MonoBehaviour.print("ERROR -- no orientation assigned, but node: " + nodeName + " is enabled for mesh switch");
         nodeOrientation = Vector3.zero;
     }
     nodeSize = inputNode.GetIntValue("size", 2);
 }
コード例 #10
0
ファイル: EngineMount.cs プロジェクト: SixDasher/SSTULabs
        public SSTUEngineMountDefinition(ConfigNode node)
        {
            mountName = node.GetStringValue("name");
            modelName = node.GetStringValue("modelName");
            invertModel = node.GetBoolValue("invertModel", invertModel);
            singleModel = node.GetBoolValue("singleModel", singleModel);
            verticalOffset = node.GetFloatValue("verticalOffset");
            height = node.GetFloatValue("height", height);
            fairingDisabled = node.GetBoolValue("fairingDisabled", fairingDisabled);
            fairingTopOffset = node.GetFloatValue("fairingTopOffset");
            mountMass = node.GetFloatValue("mass", mountMass);
            defaultDiameter = node.GetFloatValue("defaultDiameter", defaultDiameter);
            volume = node.GetFloatValue("volume", volume);
            rcsVerticalPosition = node.GetFloatValue("rcsVerticalPosition", rcsVerticalPosition);
            rcsHorizontalPosition = node.GetFloatValue("rcsHorizontalPosition", rcsHorizontalPosition);
            rcsVerticalRotation = node.GetFloatValue("rcsVerticalRotation");
            rcsHorizontalRotation = node.GetFloatValue("rcsHorizontalRotation");

            if (node.HasValue("node"))
            {
                String[] vals = node.GetStringValues("node");
                foreach (String val in vals) { nodePositions.Add(new AttachNodeData(val)); }
                if (invertModel) { foreach (AttachNodeData data in nodePositions) { data.invert(); } }
            }
        }
コード例 #11
0
ファイル: ModelData.cs プロジェクト: Joshg213/SSTULabs
 public MountModelData(ConfigNode node)
     : base(node)
 {
     layoutNames = node.GetValues("layoutName");
     defaultDiameter = node.GetFloatValue("size", defaultDiameter);
     minDiameter = node.GetFloatValue("minSize", minDiameter);
     maxDiameter = node.GetFloatValue("maxSize", maxDiameter);
     engineSpacing = node.GetFloatValue("engineSpacing", engineSpacing);
     canAdjustSize = node.GetBoolValue("canAdjustSize", canAdjustSize);
     rotateEngineModels = node.GetBoolValues("rotateEngines");
     singleModel = node.GetBoolValue("singleModel", singleModel);
 }
コード例 #12
0
ファイル: ModelData.cs プロジェクト: Joshg213/SSTULabs
        public ModelDefinition(ConfigNode node)
        {
            name = node.GetStringValue("name", String.Empty);
            modelName = node.GetStringValue("modelName", String.Empty);
            techLimit = node.GetStringValue("techLimit", techLimit);
            height = node.GetFloatValue("height", height);
            volume = node.GetFloatValue("volume", volume);
            mass = node.GetFloatValue("mass", mass);
            cost = node.GetFloatValue("cost", cost);
            diameter = node.GetFloatValue("diameter", diameter);
            verticalOffset = node.GetFloatValue("verticalOffset", verticalOffset);
            invertForTop = node.GetBoolValue("invertForTop", invertForTop);
            invertForBottom = node.GetBoolValue("invertForBottom", invertForBottom);

            fairingDisabled = node.GetBoolValue("fairingDisabled", fairingDisabled);
            fairingTopOffset = node.GetFloatValue("fairingTopOffset");
            rcsVerticalPosition = node.GetFloatValue("rcsVerticalPosition", rcsVerticalPosition);
            rcsHorizontalPosition = node.GetFloatValue("rcsHorizontalPosition", rcsHorizontalPosition);
            rcsVerticalRotation = node.GetFloatValue("rcsVerticalRotation", rcsVerticalRotation);
            rcsHorizontalRotation = node.GetFloatValue("rcsHorizontalRotation", rcsHorizontalRotation);

            defaultTextureSet = node.GetStringValue("defaultTextureSet");

            String[] attachNodeStrings = node.GetValues("node");
            int len = attachNodeStrings.Length;
            attachNodeData = new AttachNodeBaseData[len];
            for (int i = 0; i < len; i++)
            {
                attachNodeData[i] = new AttachNodeBaseData(attachNodeStrings[i]);
            }

            ConfigNode[] textureSetNodes = node.GetNodes("TEXTURESET");
            len = textureSetNodes.Length;
            textureSets = new ModelTextureSet[len];
            for (int i = 0; i < len; i++)
            {
                textureSets[i] = new ModelTextureSet(textureSetNodes[i]);
            }
            if (node.HasValue("surface"))
            {
                surfaceNode = new AttachNodeBaseData(node.GetStringValue("surface"));
            }
            else
            {
                String val = (diameter*0.5f) + ",0,0,1,0,0,2";
                surfaceNode = new AttachNodeBaseData(val);
            }
        }
コード例 #13
0
ファイル: ModelData.cs プロジェクト: SixDasher/SSTULabs
 public SingleModelData(ConfigNode node) : base(node)
 {
     name = node.GetStringValue("name", String.Empty);
     modelName = node.GetStringValue("modelName", String.Empty);
     height = node.GetFloatValue("height", height);
     volume = node.GetFloatValue("volume", volume);
     diameter = node.GetFloatValue("diameter", diameter);
     verticalOffset = node.GetFloatValue("verticalOffset", verticalOffset);
     invertModel = node.GetBoolValue("invertModel", invertModel);
 }
コード例 #14
0
ファイル: ConverterRecipe.cs プロジェクト: SixDasher/SSTULabs
 public ConverterResourceEntry loadFromNode(ConfigNode node)
 {
     resourceName = node.GetStringValue("resourceName");
     resourceAmount = node.GetFloatValue("resourceAmount");
     stopIfFull = node.GetBoolValue("stopIfFull");
     if (PartResourceLibrary.Instance.resourceDefinitions.Contains(resourceName))
     {
         resourceDefID = PartResourceLibrary.Instance.resourceDefinitions[resourceName].id;
     }
     else
     {
         MonoBehaviour.print("ERROR, could not locate resource definition for name: " + resourceName);
     }
     return this;
 }
コード例 #15
0
 public SSTUEngineLayoutMountOption(ConfigNode node)
 {
     mountName = node.GetStringValue("name");
     upperStage = node.GetBoolValue("upperStage", upperStage);
     lowerStage = node.GetBoolValue("lowerStage", lowerStage);
 }