Skip to content

Commit

Permalink
Seems that we have to hack again
Browse files Browse the repository at this point in the history
StollD committed Aug 10, 2018
1 parent ca22b4e commit 24235e6
Showing 4 changed files with 21 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/Kopernicus.Components/Kopernicus.Components.csproj
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@
<Compile Include="ModularScatter\ScatterExperiment.cs" />
<Compile Include="NameChanger.cs" />
<Compile Include="OrbitRendererUpdater.cs" />
<Compile Include="PatchedMods\PQSLandControlPatched.cs" />
<Compile Include="PQSLandControlFixer.cs" />
<Compile Include="PQS\KopernicusSimplexWrapper.cs" />
<Compile Include="Ring.cs" />
<Compile Include="RingSystem\DebrisField.cs" />
Original file line number Diff line number Diff line change
@@ -24,32 +24,21 @@
*/

using System;
using System.Linq;
using System.Reflection;

namespace Kopernicus
{
namespace Components
{
namespace PatchedMods
public class PQSLandControlFixer : PQSMod
{
public class PQSLandControlPatched : PQSLandControl
// I have no idea what Squad did to LandControl but it worked just fine before
public override void OnSetup()
{
// Where is the point in having variables if they are set to true automatically anyway?
public Boolean reallyCreateColors = true;
public Boolean reallyCreateScatter = true;

public override void OnVertexBuild(PQS.VertexBuildData data)
{
createColors = reallyCreateColors;

base.OnVertexBuild(data);
}

public override void OnQuadPreBuild(PQ quad)
{
createScatter = reallyCreateScatter;

base.OnQuadPreBuild(quad);
}
typeof(PQS).GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
.First(f => f.FieldType == typeof(PQSLandControl)).SetValue(sphere, null);
base.OnSetup();
}
}
}
15 changes: 6 additions & 9 deletions src/Kopernicus/Configuration/ModLoader/LandControl.cs
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@
using System;
using System.Linq;
using System.Reflection;
using Kopernicus.Components.PatchedMods;
using Kopernicus.UI;
using UnityEngine;

@@ -39,7 +38,7 @@ namespace Configuration
namespace ModLoader
{
[RequireConfigType(ConfigType.Node)]
public class LandControl : ModLoader<PQSLandControlPatched>
public class LandControl : ModLoader<PQSLandControl>
{
// Loader for a Ground Scatter
[RequireConfigType(ConfigType.Node)]
@@ -937,18 +936,16 @@ public NumericParser<Int32> altitudeSeed
[ParserTarget("createColors")]
public NumericParser<Boolean> createColors
{
// Yes, really do what we want!
get { return mod.reallyCreateColors; }
set { mod.reallyCreateColors = value; }
get { return mod.createColors; }
set { mod.createColors = value; }
}

// createScatter
[ParserTarget("createScatter")]
public NumericParser<Boolean> createScatter
{
// Yes, really do what we want!
get { return mod.reallyCreateScatter; }
set { mod.reallyCreateScatter = value; }
get { return mod.createScatter; }
set { mod.createScatter = value; }
}

// heightMap
@@ -1165,7 +1162,7 @@ public override void Create(PQS pqsVersion)
}

// Grabs a PQSMod of type T from a parameter with a given PQS
public override void Create(PQSLandControlPatched _mod, PQS pqsVersion)
public override void Create(PQSLandControl _mod, PQS pqsVersion)
{
base.Create(_mod, pqsVersion);

12 changes: 6 additions & 6 deletions src/Kopernicus/Configuration/TemplateLoader.cs
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Kopernicus.Components.PatchedMods;
using Kopernicus.Components;
using UnityEngine;

namespace Kopernicus
@@ -289,11 +289,11 @@ void IParserEventSubscriber.PostApply(ConfigNode node)

Logger.Active.Log("Patching PQSLandControl");

foreach (PQSLandControl landControl in body.pqsVersion.GetComponentsInChildren<PQSLandControl>())
{
Utility.CopyObjectFields(landControl, landControl.gameObject.AddComponent<PQSLandControlPatched>(), false);
UnityEngine.Object.Destroy(landControl);
}
GameObject modObj = new GameObject("LandControlFixer");
PQSLandControlFixer fixer = modObj.AddComponent<PQSLandControlFixer>();
fixer.modEnabled = true;
fixer.order = 0;
modObj.transform.parent = body.pqsVersion.transform;
}

// Should we remove the progress tree

0 comments on commit 24235e6

Please sign in to comment.