diff --git a/CheatEnabler/CheatEnabler.csproj b/CheatEnabler/CheatEnabler.csproj
index b10f854..64c7cb6 100644
--- a/CheatEnabler/CheatEnabler.csproj
+++ b/CheatEnabler/CheatEnabler.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/CheatEnabler/Patches/DysonSpherePatch.cs b/CheatEnabler/Patches/DysonSpherePatch.cs
index 6a5c928..0290d9d 100644
--- a/CheatEnabler/Patches/DysonSpherePatch.cs
+++ b/CheatEnabler/Patches/DysonSpherePatch.cs
@@ -4,6 +4,7 @@ using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
namespace CheatEnabler.Patches;
diff --git a/CheatEnabler/Patches/FactoryPatch.cs b/CheatEnabler/Patches/FactoryPatch.cs
index b7bad51..5a54cfa 100644
--- a/CheatEnabler/Patches/FactoryPatch.cs
+++ b/CheatEnabler/Patches/FactoryPatch.cs
@@ -8,6 +8,7 @@ using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
namespace CheatEnabler.Patches;
diff --git a/Dustbin/Dustbin.csproj b/Dustbin/Dustbin.csproj
index 72c3d34..442f55f 100644
--- a/Dustbin/Dustbin.csproj
+++ b/Dustbin/Dustbin.csproj
@@ -16,7 +16,7 @@
-
+
@@ -28,7 +28,7 @@
-
+
GameAssembly\Assembly-CSharp.dll
diff --git a/DustbinPreloader/DustbinPreloader.csproj b/DustbinPreloader/DustbinPreloader.csproj
index 9761b93..fe8bc71 100644
--- a/DustbinPreloader/DustbinPreloader.csproj
+++ b/DustbinPreloader/DustbinPreloader.csproj
@@ -14,14 +14,14 @@
-
+
-
+
diff --git a/HideTips/HideTips.csproj b/HideTips/HideTips.csproj
index 55f6188..aba9158 100644
--- a/HideTips/HideTips.csproj
+++ b/HideTips/HideTips.csproj
@@ -15,14 +15,14 @@
-
+
-
+
-
+
diff --git a/LabOpt/LabOpt.csproj b/LabOpt/LabOpt.csproj
index 21129e0..196ecb7 100644
--- a/LabOpt/LabOpt.csproj
+++ b/LabOpt/LabOpt.csproj
@@ -15,10 +15,10 @@
-
+
-
+
diff --git a/LabOptPreloader/LabOptPreloader.csproj b/LabOptPreloader/LabOptPreloader.csproj
index bf40869..f3969ef 100644
--- a/LabOptPreloader/LabOptPreloader.csproj
+++ b/LabOptPreloader/LabOptPreloader.csproj
@@ -14,14 +14,14 @@
-
+
-
+
-
+
diff --git a/LogisticMiner/LogisticMiner.csproj b/LogisticMiner/LogisticMiner.csproj
index d1beb23..6a12f0e 100644
--- a/LogisticMiner/LogisticMiner.csproj
+++ b/LogisticMiner/LogisticMiner.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/MechaDronesTweaks/MechaDronesTweaks.csproj b/MechaDronesTweaks/MechaDronesTweaks.csproj
index 9ff8c51..461ae7f 100644
--- a/MechaDronesTweaks/MechaDronesTweaks.csproj
+++ b/MechaDronesTweaks/MechaDronesTweaks.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/OCBatchBuild/OCBatchBuild.csproj b/OCBatchBuild/OCBatchBuild.csproj
index e7101f7..711660f 100644
--- a/OCBatchBuild/OCBatchBuild.csproj
+++ b/OCBatchBuild/OCBatchBuild.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/OverclockEverything/OverclockEverything.csproj b/OverclockEverything/OverclockEverything.csproj
index 9c1a6f0..9899d31 100644
--- a/OverclockEverything/OverclockEverything.csproj
+++ b/OverclockEverything/OverclockEverything.csproj
@@ -16,15 +16,15 @@
-
+
-
+
-
+
diff --git a/PoolOpt/PoolOpt.csproj b/PoolOpt/PoolOpt.csproj
index 53c64c5..03e8a69 100644
--- a/PoolOpt/PoolOpt.csproj
+++ b/PoolOpt/PoolOpt.csproj
@@ -15,14 +15,14 @@
-
+
-
+
-
+
diff --git a/UXAssist/Functions/UIFunctions.cs b/UXAssist/Functions/UIFunctions.cs
index 9b8da23..881cdec 100644
--- a/UXAssist/Functions/UIFunctions.cs
+++ b/UXAssist/Functions/UIFunctions.cs
@@ -1,13 +1,14 @@
-namespace UXAssist.Functions;
-
-using UI;
-using Common;
using CommonAPI.Systems;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Linq;
using System.Collections.Generic;
+using UXAssist.UI;
+using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
+
+namespace UXAssist.Functions;
public static class UIFunctions
{
diff --git a/UXAssist/Patches/DysonSpherePatch.cs b/UXAssist/Patches/DysonSpherePatch.cs
index 181364e..21802fa 100644
--- a/UXAssist/Patches/DysonSpherePatch.cs
+++ b/UXAssist/Patches/DysonSpherePatch.cs
@@ -5,6 +5,7 @@ using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine.UI;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
diff --git a/UXAssist/Patches/FactoryPatch.cs b/UXAssist/Patches/FactoryPatch.cs
index 6ebca3b..b0cbc59 100644
--- a/UXAssist/Patches/FactoryPatch.cs
+++ b/UXAssist/Patches/FactoryPatch.cs
@@ -10,6 +10,7 @@ using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
@@ -445,12 +446,20 @@ public class FactoryPatch : PatchImpl
new CodeMatch(OpCodes.Ldloca_S),
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(Vector3), nameof(Vector3.magnitude)))
);
+ var ldlocOpr = matcher.InstructionAt(0).operand;
var jumpPos = matcher.InstructionAt(3).operand;
- var labels = matcher.Labels;
- matcher.Labels = [];
- /* Insert: br 2358 (1C12) ldloc.s V_8 (8)
+ /* Insert after btrue:
+ * Ldloc.s V_8 (8)
+ * ldfld class PrefabDesc BuildPreview::desc
+ * ldfld bool PrefabDesc::isPowerGen
+ * brtrue 2358 (1C12) ldloc.s V_8 (8)
*/
- matcher.Insert(new CodeInstruction(OpCodes.Br, jumpPos).WithLabels(labels));
+ matcher.Advance(4).InsertAndAdvance(
+ new CodeInstruction(OpCodes.Ldloc_S, ldlocOpr),
+ new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.desc))),
+ new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(PrefabDesc), nameof(PrefabDesc.isPowerGen))),
+ new CodeInstruction(OpCodes.Brtrue_S, jumpPos)
+ );
return matcher.InstructionEnumeration();
}
diff --git a/UXAssist/Patches/LogisticsPatch.cs b/UXAssist/Patches/LogisticsPatch.cs
index 53c61c1..609f223 100644
--- a/UXAssist/Patches/LogisticsPatch.cs
+++ b/UXAssist/Patches/LogisticsPatch.cs
@@ -9,6 +9,7 @@ using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using UnityEngine.UI;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
using Object = UnityEngine.Object;
namespace UXAssist.Patches;
diff --git a/UXAssist/Patches/TechPatch.cs b/UXAssist/Patches/TechPatch.cs
index 998c170..bba4a6a 100644
--- a/UXAssist/Patches/TechPatch.cs
+++ b/UXAssist/Patches/TechPatch.cs
@@ -5,6 +5,7 @@ using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine.UI;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs
index c315f5d..8372fea 100644
--- a/UXAssist/UXAssist.cs
+++ b/UXAssist/UXAssist.cs
@@ -14,6 +14,7 @@ using UXAssist.Functions;
using UXAssist.Patches;
using UXAssist.UI;
using Util = UXAssist.Common.Util;
+using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist;
diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj
index 6caf0d5..d040a3e 100644
--- a/UXAssist/UXAssist.csproj
+++ b/UXAssist/UXAssist.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/UniverseGenTweaks/BirthPlanetPatch.cs b/UniverseGenTweaks/BirthPlanetPatch.cs
index b102ec8..7e1a094 100644
--- a/UniverseGenTweaks/BirthPlanetPatch.cs
+++ b/UniverseGenTweaks/BirthPlanetPatch.cs
@@ -2,6 +2,7 @@
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
+using GameLogic = UXAssist.Common.GameLogic;
namespace UniverseGenTweaks;
public static class BirthPlanetPatch
diff --git a/UniverseGenTweaks/UniverseGenTweaks.csproj b/UniverseGenTweaks/UniverseGenTweaks.csproj
index 46433b8..bedb2fa 100644
--- a/UniverseGenTweaks/UniverseGenTweaks.csproj
+++ b/UniverseGenTweaks/UniverseGenTweaks.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/UserCloak/UserCloak.csproj b/UserCloak/UserCloak.csproj
index b64603b..ef948ce 100644
--- a/UserCloak/UserCloak.csproj
+++ b/UserCloak/UserCloak.csproj
@@ -15,10 +15,10 @@
-
+
-
+