コード例 #1
0
            /// <summary>
            /// Renders the Window
            /// </summary>
            protected override void Render(Int32 id)
            {
                // Call base
                base.Render(id);

                // Check for PQS
                if (Current.pqsController == null)
                {
                    Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_ADD, () =>
                    {
                        // Create a new PQS
                        GameObject controllerRoot       = new GameObject(Current.name);
                        controllerRoot.transform.parent = Current.transform;
                        PQS pqsVersion = controllerRoot.AddComponent <PQS>();

                        // I am at this time unable to determine some of the magic parameters which cause the PQS to work... (Or just lazy but who cares :P)
                        PSystemBody Laythe = Utility.FindBody(Injector.StockSystemPrefab.rootBody, "Laythe");
                        Utility.CopyObjectFields(Laythe.pqsVersion, pqsVersion);
                        pqsVersion.surfaceMaterial = Laythe.pqsVersion.surfaceMaterial;

                        // Create the fallback material (always the same shader)
                        pqsVersion.fallbackMaterial      = new PQSProjectionFallbackLoader();
                        pqsVersion.fallbackMaterial.name = Guid.NewGuid().ToString();

                        // Create the celestial body transform
                        GameObject mod       = new GameObject("_CelestialBody");
                        mod.transform.parent = controllerRoot.transform;
                        PQSMod_CelestialBodyTransform transform = mod.AddComponent <PQSMod_CelestialBodyTransform>();
                        transform.sphere                        = pqsVersion;
                        transform.forceActivate                 = false;
                        transform.deactivateAltitude            = 115000;
                        transform.forceRebuildOnTargetChange    = false;
                        transform.planetFade                    = new PQSMod_CelestialBodyTransform.AltitudeFade();
                        transform.planetFade.fadeFloatName      = "_PlanetOpacity";
                        transform.planetFade.fadeStart          = 100000.0f;
                        transform.planetFade.fadeEnd            = 110000.0f;
                        transform.planetFade.valueStart         = 0.0f;
                        transform.planetFade.valueEnd           = 1.0f;
                        transform.planetFade.secondaryRenderers = new List <GameObject>();
                        transform.secondaryFades                = new PQSMod_CelestialBodyTransform.AltitudeFade[0];
                        transform.requirements                  = PQS.ModiferRequirements.Default;
                        transform.modEnabled                    = true;
                        transform.order = 10;

                        // Create the material direction
                        mod = new GameObject("_Material_SunLight");
                        mod.transform.parent = controllerRoot.gameObject.transform;
                        PQSMod_MaterialSetDirection lightDirection = mod.AddComponent <PQSMod_MaterialSetDirection>();
                        lightDirection.sphere       = pqsVersion;
                        lightDirection.valueName    = "_sunLightDirection";
                        lightDirection.requirements = PQS.ModiferRequirements.Default;
                        lightDirection.modEnabled   = true;
                        lightDirection.order        = 100;

                        // Create the UV planet relative position
                        mod = new GameObject("_Material_SurfaceQuads");
                        mod.transform.parent = controllerRoot.transform;
                        PQSMod_UVPlanetRelativePosition uvs = mod.AddComponent <PQSMod_UVPlanetRelativePosition>();
                        uvs.sphere       = pqsVersion;
                        uvs.requirements = PQS.ModiferRequirements.Default;
                        uvs.modEnabled   = true;
                        uvs.order        = 999999;

                        // Crete the quad mesh colliders
                        mod = new GameObject("QuadMeshColliders");
                        mod.transform.parent = controllerRoot.gameObject.transform;
                        PQSMod_QuadMeshColliders collider = mod.AddComponent <PQSMod_QuadMeshColliders>();
                        collider.sphere                          = pqsVersion;
                        collider.maxLevelOffset                  = 0;
                        collider.physicsMaterial                 = new PhysicMaterial();
                        collider.physicsMaterial.name            = "Ground";
                        collider.physicsMaterial.dynamicFriction = 0.6f;
                        collider.physicsMaterial.staticFriction  = 0.8f;
                        collider.physicsMaterial.bounciness      = 0.0f;
                        collider.physicsMaterial.frictionCombine = PhysicMaterialCombine.Maximum;
                        collider.physicsMaterial.bounceCombine   = PhysicMaterialCombine.Average;
                        collider.requirements                    = PQS.ModiferRequirements.Default;
                        collider.modEnabled                      = true;
                        collider.order = 100;

                        // Assing the new PQS
                        Current.pqsController              = pqsVersion;
                        pqsVersion.transform.position      = Current.transform.position;
                        pqsVersion.transform.localPosition = Vector3.zero;

                        // Set mode
                        _mode = Modes.List;
                    }, new Rect(20, index * distance + 10, 350, 20));
                    return;
                }

                // Mode List
                if (_mode == Modes.List)
                {
                    // Get the PQS-Spheres and their mods
                    IEnumerable <PQS>    pqsList    = Current.GetComponentsInChildren <PQS>(true);
                    IEnumerable <PQSMod> pqsModList = Current.GetComponentsInChildren <PQSMod>(true);

                    // Scroll
                    BeginScrollView(250, (pqsList.Count() + pqsModList.Count()) * distance + distance * 4, 20);

                    // Index
                    index = 0;

                    // Render
                    foreach (PQS pqs in pqsList)
                    {
                        Button(pqs.ToString(), () =>
                        {
                            _mode   = Modes.PQS;
                            _sphere = pqs;
                        }, new Rect(20, index * distance + 10, 350, 20));
                    }
                    foreach (PQSMod mod in pqsModList)
                    {
                        Button(mod.ToString(), () =>
                        {
                            _mode   = Modes.PQSMod;
                            _sphere = mod.sphere;
                            _mod    = mod;
                        }, new Rect(20, index * distance + 10, 350, 20));
                    }
                    index++;
                    Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_ADD_MOD, () => _mode = Modes.AddMod, new Rect(20, index * distance + 10, 350, 20));
                    if (Current.pqsController.ChildSpheres.All(s => s.name != Current.pqsController.name + "Ocean"))
                    {
                        Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_ADD_OCEAN, () =>
                        {
                            // Generate the PQS object
                            GameObject gameObject = new GameObject("Ocean");
                            gameObject.layer      = Constants.GameLayers.LocalSpace;
                            PQS ocean             = gameObject.AddComponent <PQS>();

                            // Setup materials
                            PSystemBody Body = Utility.FindBody(Injector.StockSystemPrefab.rootBody, "Laythe");
                            foreach (PQS oc in Body.pqsVersion.GetComponentsInChildren <PQS>(true))
                            {
                                if (oc.name != "LaytheOcean")
                                {
                                    continue;
                                }

                                // Copying Laythes Ocean-properties
                                Utility.CopyObjectFields <PQS>(oc, ocean);
                            }

                            // Load our new Material into the PQS
                            ocean.surfaceMaterial      = new PQSOceanSurfaceQuadLoader(ocean.surfaceMaterial);
                            ocean.surfaceMaterial.name = Guid.NewGuid().ToString();

                            // Load fallback material into the PQS
                            ocean.fallbackMaterial      = new PQSOceanSurfaceQuadFallbackLoader(ocean.fallbackMaterial);
                            ocean.fallbackMaterial.name = Guid.NewGuid().ToString();

                            // Create the UV planet relative position
                            GameObject mod       = new GameObject("_Material_SurfaceQuads");
                            mod.transform.parent = gameObject.transform;
                            PQSMod_UVPlanetRelativePosition uvs = mod.AddComponent <PQSMod_UVPlanetRelativePosition>();
                            uvs.sphere       = ocean;
                            uvs.requirements = PQS.ModiferRequirements.Default;
                            uvs.modEnabled   = true;
                            uvs.order        = 999999;

                            // Create the AerialPerspective Material
                            AerialPerspectiveMaterial mat = new AerialPerspectiveMaterial();
                            mat.Create(ocean);

                            // Create the OceanFX
                            OceanFX oceanFX = new OceanFX();
                            oceanFX.Create(ocean);

                            // Apply the Ocean
                            ocean.transform.parent = Current.pqsController.transform;

                            // Add the ocean PQS to the secondary renders of the CelestialBody Transform
                            PQSMod_CelestialBodyTransform transform = Current.pqsController.GetComponentsInChildren <PQSMod_CelestialBodyTransform>(true).FirstOrDefault(mod_ => mod_.transform.parent == Current.pqsController.transform);
                            transform.planetFade.secondaryRenderers.Add(ocean.gameObject);
                            typeof(PQS).GetField("_childSpheres", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(Current.pqsController, null);

                            // Names!
                            ocean.name            = Current.pqsController.name + "Ocean";
                            ocean.gameObject.name = Current.pqsController.name + "Ocean";
                            ocean.transform.name  = Current.pqsController.name + "Ocean";

                            // Set up the ocean PQS
                            ocean.parentSphere            = Current.pqsController;
                            ocean.transform.position      = Current.pqsController.transform.position;
                            ocean.transform.localPosition = Vector3.zero;
                            ocean.radius = Current.Radius;
                        }, new Rect(20, index * distance + 10, 350, 20));
                    }
                    else
                    {
                        Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_REMOVE_OCEAN, () =>
                        {
                            // Find atmosphere the ocean PQS
                            PQS ocean = Current.pqsController.GetComponentsInChildren <PQS>(true).First(pqs => pqs != Current.pqsController);
                            PQSMod_CelestialBodyTransform cbt = Current.pqsController.GetComponentsInChildren <PQSMod_CelestialBodyTransform>(true).First();

                            // Destroy the ocean PQS (this could be bad - destroying the secondary fades...)
                            cbt.planetFade.secondaryRenderers.Remove(ocean.gameObject);
                            typeof(PQS).GetField("_childSpheres", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(Current.pqsController, null);
                            cbt.secondaryFades     = new PQSMod_CelestialBodyTransform.AltitudeFade[0];
                            ocean.transform.parent = null;
                            UnityEngine.Object.Destroy(ocean);
                        }, new Rect(20, index * distance + 10, 350, 20));
                    }

                    // End Scroll
                    EndScrollView();
                }

                // Mode PQS
                if (_mode == Modes.PQS)
                {
                    // Scroll
                    BeginScrollView(250, Utils.GetScrollSize <PQS>() + Utils.GetScrollSize <HazardousOcean>() + distance * 1, 20);

                    // Index
                    index = 0;

                    // Render the PQS
                    RenderObject(_sphere);

                    // If it is an ocean, create an Hazardous Ocean button
                    if (PQSOceanSurfaceQuad.UsesSameShader(_sphere.surfaceMaterial))
                    {
                        Label("hazardousOcean"); index--;
                        if (_sphere.GetComponent <HazardousOcean>() != null)
                        {
                            Button(Localization.LOC_KITTOPIATECH_EDIT, () =>
                            {
                                UIController.Instance.SetEditedObject(KittopiaWindows.Curve, _sphere.GetComponent <HazardousOcean>().heatCurve ?? new FloatCurve(), c => _sphere.GetComponent <HazardousOcean>().heatCurve = c);
                                UIController.Instance.EnableWindow(KittopiaWindows.Curve);
                            }, new Rect(200, index * distance + 10, 75, 20)); index--;
                            Button(Localization.LOC_KITTOPIATECH_REMOVE, () => UnityEngine.Object.DestroyImmediate(_sphere.GetComponent <HazardousOcean>()), new Rect(285, index * distance + 10, 75, 20));
                        }
                        else
                        {
                            Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_ADD_HAZOCEAN, () => _sphere.gameObject.AddComponent <HazardousOcean>(), new Rect(200, index * distance + 10, 170, 20));
                        }
                    }
                    index++;

                    // Rebuild
                    Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_REBUILD, () => _sphere.RebuildSphere());

                    // End Scroll
                    EndScrollView();
                }

                // Mode PQSMod
                if (_mode == Modes.PQSMod)
                {
                    // Scroll
                    BeginScrollView(250, Utils.GetScrollSize(_mod.GetType()) + distance * 5, 20);

                    // Index
                    index = 0;

                    // Render the PQS
                    RenderObject(_mod);
                    index++;

                    // Rebuild
                    Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_REBUILD, () => _sphere.RebuildSphere());

                    // Remove
                    Button(Localization.LOC_KITTOPIATECH_PQSEDITOR_REMOVE_MOD, () =>
                    {
                        _mod.sphere = null;
                        UnityEngine.Object.Destroy(_mod);
                        _mod = null;

                        // Hack
                        _sphere.SetupExternalRender();
                        _sphere.CloseExternalRender();

                        _mode = Modes.List;
                    });

                    // End Scroll
                    EndScrollView();
                }

                // Mode AddPQSMod
                if (_mode == Modes.AddMod)
                {
                    // Get all PQSMod types
                    List <Type> types = Parser.ModTypes.Where(t => t.IsSubclassOf(typeof(PQSMod))).ToList();

                    // Begin Scroll
                    BeginScrollView(250, types.Count * distance + 10, 20);

                    // Index
                    index = 0;

                    // Render the possible types
                    foreach (Type t in types)
                    {
                        Button(t.FullName, () =>
                        {
                            // Hack^6
                            GameObject pqsModObject       = new GameObject(t.Name);
                            pqsModObject.transform.parent = Current.pqsController.transform;
                            PQSMod mod = pqsModObject.AddComponent(t) as PQSMod;
                            mod.sphere = Current.pqsController;

                            if (t == typeof(PQSMod_VoronoiCraters))
                            {
                                PQS mun = Utility.FindBody(Injector.StockSystemPrefab.rootBody, "Mun").pqsVersion;
                                PQSMod_VoronoiCraters craters = mun.GetComponentsInChildren <PQSMod_VoronoiCraters>()[0];
                                PQSMod_VoronoiCraters nc      = pqsModObject.GetComponentsInChildren <PQSMod_VoronoiCraters>()[0];
                                nc.craterColourRamp           = craters.craterColourRamp;
                                nc.craterCurve = craters.craterCurve;
                                nc.jitterCurve = craters.jitterCurve;
                            }
                            else if (t == typeof(PQSMod_VertexPlanet))
                            {
                                PQSMod_VertexPlanet vp     = mod as PQSMod_VertexPlanet;
                                vp.landClasses             = new [] { new PQSMod_VertexPlanet.LandClass("Class", 0, 1, Color.black, Color.white, 0) };
                                vp.continental             = new PQSMod_VertexPlanet.SimplexWrapper(0, 0, 0, 0);
                                vp.continentalRuggedness   = new PQSMod_VertexPlanet.SimplexWrapper(0, 0, 0, 0);
                                vp.continentalSharpness    = new PQSMod_VertexPlanet.NoiseModWrapper(0, 0, 0, 0);
                                vp.continentalSharpnessMap = new PQSMod_VertexPlanet.SimplexWrapper(0, 0, 0, 0);
                                vp.terrainType             = new PQSMod_VertexPlanet.SimplexWrapper(0, 0, 0, 0);
                            }
                            else if (t == typeof(PQSMod_HeightColorMap))
                            {
                                (mod as PQSMod_HeightColorMap).landClasses = new [] { new PQSMod_HeightColorMap.LandClass("Class", 0, 1, Color.black, Color.white, 0) };
                            }
                            else if (t == typeof(PQSMod_HeightColorMap2))
                            {
                                (mod as PQSMod_HeightColorMap2).landClasses = new[] { new PQSMod_HeightColorMap2.LandClass("Class", 0, 1, Color.black, Color.white, 0) };
                            }
                            else if (t == typeof(PQSMod_HeightColorMapNoise))
                            {
                                (mod as PQSMod_HeightColorMapNoise).landClasses = new[] { new PQSMod_HeightColorMapNoise.LandClass("Class", 0, 1, Color.black, Color.white, 0) };
                            }
                            else if (t == typeof(PQSLandControl))
                            {
                                PQSLandControl lc  = mod as PQSLandControl;
                                lc.altitudeSimplex = new Simplex();
                                lc.scatters        = new PQSLandControl.LandClassScatter[0];
                                lc.landClasses     = new [] { new PQSLandControl.LandClass()
                                                              {
                                                                  altitudeRange       = new PQSLandControl.LerpRange(),
                                                                  coverageSimplex     = new Simplex(),
                                                                  longitudeRange      = new PQSLandControl.LerpRange(),
                                                                  latitudeDoubleRange = new PQSLandControl.LerpRange(),
                                                                  latitudeRange       = new PQSLandControl.LerpRange(),
                                                                  scatter             = new PQSLandControl.LandClassScatterAmount[0]
                                                              } };
                                lc.latitudeSimplex  = new Simplex();
                                lc.longitudeSimplex = new Simplex();
                            }

                            // Edit the mod
                            _mod    = mod;
                            _sphere = mod.sphere;
                            _mode   = Modes.PQSMod;
                        }, new Rect(20, index * distance + 10, 350, 20));
                    }


                    // End Scroll
                    EndScrollView();
                }
            }
コード例 #2
0
 public VertexPlanet()
 {
     // Create the base mod
     GameObject modObject = new GameObject("VertexPlanet");
     modObject.transform.parent = Utility.Deactivator;
     _mod = modObject.AddComponent<PQSMod_VertexPlanet>();
     base.mod = _mod;
 }
コード例 #3
0
 public VertexPlanet(PQSMod template)
 {
     _mod = template as PQSMod_VertexPlanet;
     _mod.transform.parent = Utility.Deactivator;
     base.mod = _mod;
 }
コード例 #4
0
            /// <summary>
            /// Writes a PQS to a new config node
            /// </summary>
            public static void WritePQSToConfigNode(PQS pqsVersion, ref ConfigNode body, bool ocean)
            {
                ConfigNode pqs = null;

                if (!ocean)
                {
                    CelestialBody cb        = pqsVersion.GetComponentInParent <CelestialBody>();
                    PQSLoader     pqsLoader = new PQSLoader(cb);
                    pqs = WriteObjectToConfigNode("PQS", ref body, pqsLoader);
                    WriteObjectToConfigNode("Material", ref pqs, pqsLoader.surfaceMaterial);
                    WriteObjectToConfigNode("FallbackMaterial", ref pqs, pqsLoader.fallbackMaterial);
                    if (pqsLoader.physicsMaterial.Value != null)
                    {
                        WriteObjectToConfigNode("PhysicsMaterial", ref pqs, pqsLoader.physicsMaterial);
                    }
                }
                else
                {
                    CelestialBody cb          = pqsVersion.parentSphere.GetComponentInParent <CelestialBody>();
                    OceanLoader   oceanLoader = new OceanLoader(cb);
                    pqs = WriteObjectToConfigNode("Ocean", ref body, oceanLoader);
                    pqs.AddValue("ocean", pqsVersion.parentSphere.mapOcean && cb.ocean);
                    pqs.AddValue("oceanColor", pqsVersion.parentSphere.mapOceanColor);
                    pqs.AddValue("oceanHeight", pqsVersion.parentSphere.mapOceanHeight);
                    pqs.AddValue("density", cb.oceanDensity);
                    WriteObjectToConfigNode("Material", ref pqs, oceanLoader.surfaceMaterial);
                    WriteObjectToConfigNode("FallbackMaterial", ref pqs, oceanLoader.fallbackMaterial);
                    WriteObjectToConfigNode("Fog", ref pqs, new FogLoader(Part.GetComponentUpwards <CelestialBody>(pqsVersion.gameObject)));
                    if (pqsVersion.gameObject.GetComponent <HazardousOcean>() != null)
                    {
                        pqsVersion.gameObject.GetComponent <HazardousOcean>().heatCurve.Save(pqs.AddNode("HazardousOcean"));
                    }
                }

                // Mods
                IEnumerable <PQSMod> mods = pqsVersion.GetComponentsInChildren <PQSMod>(true).Where(m => (ocean || m.sphere == pqsVersion) && !(m is PQSCity) && !(m is PQSCity2));

                // Get all loaded types
                IEnumerable <Type> types = AssemblyLoader.loadedAssemblies.SelectMany(a => a.assembly.GetTypes());

                if (mods.Count() != 0)
                {
                    ConfigNode modsNode = pqs.AddNode("Mods");
                    foreach (PQSMod Mod in mods)
                    {
                        // Fix PQSMods
                        PQSMod mod = Mod;

                        Type loaderType = types.FirstOrDefault(t => t.Name == Mod.GetType().Name.Replace("PQSMod_", "").Replace("PQS", ""));

                        // No loader
                        if (loaderType == null)
                        {
                            continue;
                        }

                        // Create the loader
                        object loader = Activator.CreateInstance(loaderType);

                        // Reflection, because C# being silly... :/
                        PropertyInfo info = loaderType.GetProperty("mod");
                        if (info == null)
                        {
                            continue;
                        }
                        info.SetValue(loader, mod, null);

                        // Load
                        ConfigNode           modNode      = WriteObjectToConfigNode(loaderType.Name, ref modsNode, loader);
                        IEnumerable <PQSMod> existingMods = pqsVersion.GetComponentsInChildren <PQSMod>(true).Where(m => m.GetType() == mod.GetType() && m.sphere == pqsVersion && m.name == mod.name);
                        modNode.AddValue("index", existingMods.ToList().IndexOf(mod));

                        // Submods
                        PQSMod_HeightColorMap hcm = mod as PQSMod_HeightColorMap;
                        if (hcm?.landClasses != null)
                        {
                            ConfigNode landClasses = modNode.AddNode("LandClasses");
                            foreach (PQSMod_HeightColorMap.LandClass landClass in hcm.landClasses)
                            {
                                WriteObjectToConfigNode("Class", ref landClasses, new HeightColorMap.LandClassLoader(landClass));
                            }
                        }
                        PQSMod_HeightColorMap2 hcm2 = mod as PQSMod_HeightColorMap2;
                        if (hcm2?.landClasses != null)
                        {
                            ConfigNode landClasses = modNode.AddNode("LandClasses");
                            foreach (PQSMod_HeightColorMap2.LandClass landClass in hcm2.landClasses)
                            {
                                WriteObjectToConfigNode("Class", ref landClasses, new HeightColorMap2.LandClassLoader(landClass));
                            }
                        }
                        PQSMod_HeightColorMapNoise hcmNoise = mod as PQSMod_HeightColorMapNoise;
                        if (hcmNoise?.landClasses != null)
                        {
                            ConfigNode landClasses = modNode.AddNode("LandClasses");
                            foreach (PQSMod_HeightColorMapNoise.LandClass landClass in hcmNoise.landClasses)
                            {
                                WriteObjectToConfigNode("Class", ref landClasses, new HeightColorMapNoise.LandClassLoader(landClass));
                            }
                        }
                        if (mod is PQSLandControl)
                        {
                            PQSLandControl lc = mod as PQSLandControl;
                            if (lc.altitudeSimplex != null)
                            {
                                KopernicusSimplexWrapper lcaltsimpwrap = new KopernicusSimplexWrapper(lc.altitudeBlend, lc.altitudeOctaves, lc.altitudePersistance, lc.altitudeFrequency);
                                lcaltsimpwrap.seed = lc.altitudeSeed;
                                WriteObjectToConfigNode("altitudeSimplex", ref modNode, new VertexPlanet.SimplexLoader(lcaltsimpwrap));
                            }
                            if (lc.latitudeSimplex != null)
                            {
                                KopernicusSimplexWrapper lclatsimpwrap = new KopernicusSimplexWrapper(lc.latitudeBlend, lc.latitudeOctaves, lc.latitudePersistance, lc.latitudeFrequency);
                                lclatsimpwrap.seed = lc.latitudeSeed;
                                WriteObjectToConfigNode("latitudeSimplex", ref modNode, new VertexPlanet.SimplexLoader(lclatsimpwrap));
                            }
                            if (lc.longitudeSimplex != null)
                            {
                                KopernicusSimplexWrapper lclongsimpwrap = new KopernicusSimplexWrapper(lc.longitudeBlend, lc.longitudeOctaves, lc.longitudePersistance, lc.longitudeFrequency);
                                lclongsimpwrap.seed = lc.longitudeSeed;
                                WriteObjectToConfigNode("longitudeSimplex", ref modNode, new VertexPlanet.SimplexLoader(lclongsimpwrap));
                            }
                            if (lc.landClasses != null)
                            {
                                ConfigNode landClasses = modNode.AddNode("landClasses");
                                foreach (PQSLandControl.LandClass landClass in lc.landClasses)
                                {
                                    ConfigNode lcNode = WriteObjectToConfigNode("Class", ref landClasses, new LandControl.LandClassLoader(landClass));
                                    WriteObjectToConfigNode("altitudeRange", ref lcNode, new LandControl.LerpRangeLoader(landClass.altitudeRange));
                                    KopernicusSimplexWrapper lccovsimpwrap = new KopernicusSimplexWrapper(landClass.coverageBlend, landClass.coverageOctaves, landClass.coveragePersistance, landClass.coverageFrequency);
                                    lccovsimpwrap.seed = landClass.coverageSeed;
                                    WriteObjectToConfigNode("coverageSimplex", ref lcNode, new VertexPlanet.SimplexLoader(lccovsimpwrap));
                                    WriteObjectToConfigNode("latitudeDoubleRange", ref lcNode, new LandControl.LerpRangeLoader(landClass.latitudeDoubleRange));
                                    WriteObjectToConfigNode("latitudeRange", ref lcNode, new LandControl.LerpRangeLoader(landClass.latitudeRange));
                                    WriteObjectToConfigNode("longitudeRange", ref lcNode, new LandControl.LerpRangeLoader(landClass.longitudeRange));
                                    KopernicusSimplexWrapper lcnoisesimpwrap = new KopernicusSimplexWrapper(landClass.noiseBlend, landClass.noiseOctaves, landClass.noisePersistance, landClass.noiseFrequency);
                                    lcnoisesimpwrap.seed = landClass.noiseSeed;
                                    WriteObjectToConfigNode("noiseSimplex", ref lcNode, new VertexPlanet.SimplexLoader(lcnoisesimpwrap));
                                    if (landClass.scatter != null)
                                    {
                                        ConfigNode amount = lcNode.AddNode("scatters");
                                        foreach (PQSLandControl.LandClassScatterAmount scatterAmount in landClass.scatter)
                                        {
                                            WriteObjectToConfigNode("Scatter", ref amount, new LandControl.LandClassScatterAmountLoader(scatterAmount));
                                        }
                                    }
                                }
                            }
                            if (lc.scatters != null)
                            {
                                ConfigNode scatters = modNode.AddNode("scatters");
                                foreach (PQSLandControl.LandClassScatter scatter in lc.scatters)
                                {
                                    LandControl.LandClassScatterLoader classLoader = new LandControl.LandClassScatterLoader(scatter);
                                    if (scatter.material.shader == new NormalDiffuse().shader)
                                    {
                                        classLoader.customMaterial = new NormalDiffuseLoader(scatter.material);
                                    }
                                    else if (scatter.material.shader == new NormalBumped().shader)
                                    {
                                        classLoader.customMaterial = new NormalBumpedLoader(scatter.material);
                                    }
                                    else if (scatter.material.shader == new NormalDiffuseDetail().shader)
                                    {
                                        classLoader.customMaterial = new NormalDiffuseDetailLoader(scatter.material);
                                    }
                                    else if (scatter.material.shader == new DiffuseWrapLoader().shader)
                                    {
                                        classLoader.customMaterial = new DiffuseWrapLoader(scatter.material);
                                    }
                                    else if (scatter.material.shader == new AlphaTestDiffuse().shader)
                                    {
                                        classLoader.customMaterial = new AlphaTestDiffuseLoader(scatter.material);
                                    }
                                    else if (scatter.material.shader == new AerialTransCutout().shader)
                                    {
                                        classLoader.customMaterial = new AerialTransCutoutLoader(scatter.material);
                                    }
                                    ConfigNode scatterNode = WriteObjectToConfigNode("Scatter", ref scatters, classLoader);
                                    WriteObjectToConfigNode("Material", ref scatterNode, classLoader.customMaterial);
                                    scatterNode.AddNode("Experiment");
                                }
                            }
                        }
                        if (mod is PQSMod_VertexPlanet)
                        {
                            PQSMod_VertexPlanet vp = mod as PQSMod_VertexPlanet;
                            WriteObjectToConfigNode("ContinentalSimplex", ref modNode, new PQSMod_VertexPlanet.SimplexWrapper(vp.continental));
                            WriteObjectToConfigNode("RuggednessSimplex", ref modNode, new PQSMod_VertexPlanet.SimplexWrapper(vp.continentalRuggedness));
                            WriteObjectToConfigNode("SharpnessNoise", ref modNode, new PQSMod_VertexPlanet.NoiseModWrapper(vp.continentalSharpness));
                            WriteObjectToConfigNode("SharpnessSimplexMap", ref modNode, new PQSMod_VertexPlanet.SimplexWrapper(vp.continentalSharpnessMap));
                            WriteObjectToConfigNode("TerrainTypeSimplex", ref modNode, new PQSMod_VertexPlanet.SimplexWrapper(vp.terrainType));
                            if (vp.landClasses != null)
                            {
                                ConfigNode landClasses = modNode.AddNode("LandClasses");
                                foreach (PQSMod_VertexPlanet.LandClass landClass in vp.landClasses)
                                {
                                    ConfigNode classNode = WriteObjectToConfigNode("Class", ref landClasses, new VertexPlanet.LandClassLoader(landClass));
                                    WriteObjectToConfigNode("SimplexNoiseMap", ref classNode, new PQSMod_VertexPlanet.SimplexWrapper(landClass.colorNoiseMap));
                                }
                            }
                        }
                        if (!(mod is PQSMod_OceanFX))
                        {
                            continue;
                        }
                        List <Texture2DParser> wm        = (loader as OceanFX).watermain;
                        ConfigNode             watermain = modNode.AddNode("Watermain");
                        foreach (Texture2DParser texture in wm)
                        {
                            watermain.AddValue("waterTex-" + wm.ToList().IndexOf(texture), texture.Value.name);
                        }
                    }
                }
            }