diff --git a/ProjectGenesis.csproj b/ProjectGenesis.csproj
index 849cce3..f51c18b 100644
--- a/ProjectGenesis.csproj
+++ b/ProjectGenesis.csproj
@@ -97,6 +97,7 @@
+
@@ -111,6 +112,7 @@
+
diff --git a/ProjectGenesis.sln.DotSettings b/ProjectGenesis.sln.DotSettings
new file mode 100644
index 0000000..37b3613
--- /dev/null
+++ b/ProjectGenesis.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ LDB
\ No newline at end of file
diff --git a/README.md b/README.md
index 4dfc6f0..eaebe35 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,12 @@ Reconstruct "Real Universe". Then leave a "GenesisBook".
### 最近更新介绍 | Recent update
+- v2.2.10
+ + 修复了复制未建成建筑时偶尔出现的报错
+
+ + Fixed the error that occasionally occurred when copying the uncompleted building
+
+
- v2.2.9
+ 下调了量子芯片的科技需求
+ 调整了蓄电器和能量枢纽的输出功率与蓄电量
@@ -29,12 +35,6 @@ Reconstruct "Real Universe". Then leave a "GenesisBook".
correctly
+ Fixed the problem that the highlight color was displayed incorrectly when selecting the conveyor belt
-
-- v2.2.8
- + 修改了部分配方的时间和产出(总产出不变)
-
- + Changed the time and output of some recipes (No change in total output)
-
----
@@ -114,6 +114,10 @@ Reconstruct "Real Universe". Then leave a "GenesisBook".
展开查看
+- v2.2.10
+ + 修复了复制未建成建筑时偶尔出现的报错
+
+
- v2.2.9
+ 下调了量子芯片的科技需求
+ 调整了蓄电器和能量枢纽的输出功率与蓄电量
@@ -327,6 +331,10 @@ free to communicate with us.
Details
+- v2.2.10
+ + Fixed the error that occasionally occurred when copying the uncompleted building
+
+
- v2.2.9
+ Adjusted the technology requirements of quantum chips
+ Adjusted the output power and storage capacity of capacitors and energy hubs
diff --git a/src/Patches/InitnalTechPatches.cs b/src/Patches/InitnalTechPatches.cs
new file mode 100644
index 0000000..6a7028f
--- /dev/null
+++ b/src/Patches/InitnalTechPatches.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection.Emit;
+using HarmonyLib;
+
+// ReSharper disable InconsistentNaming
+
+namespace ProjectGenesis.Patches
+{
+ public static class InitnalTechPatches
+ {
+ private static readonly List InitnalTechs = new List()
+ {
+ 1,
+ 1001,
+ 1901,
+ 1902,
+ 1903,
+ 1904,
+ 1905
+ };
+
+ [HarmonyPatch(typeof(GameData), "SetForNewGame")]
+ [HarmonyPostfix]
+ public static void SetForNewGame(GameData __instance)
+ {
+ foreach (var tech in InitnalTechs) __instance.history.UnlockTech(tech);
+ }
+
+ [HarmonyPatch(typeof(UITechNode), "DoBuyoutTech")]
+ [HarmonyPatch(typeof(UITechNode), "DoStartTech")]
+ [HarmonyPatch(typeof(UITechNode), "OnPointerEnter")]
+ [HarmonyPatch(typeof(UITechNode), "OnPointerExit")]
+ [HarmonyPatch(typeof(UITechNode), "OnPointerDown")]
+ [HarmonyPatch(typeof(UITechNode), "OnOtherIconClick")]
+ [HarmonyTranspiler]
+ public static IEnumerable UITechNode_Transpiler(IEnumerable instructions)
+ {
+ var matcher = new CodeMatcher(instructions);
+ matcher.MatchForward(true, new CodeMatch(OpCodes.Ldarg_0),
+ new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UITechNode), nameof(UITechNode.techProto))),
+ new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(Proto), nameof(Proto.ID))), new CodeMatch(OpCodes.Ldc_I4_1));
+
+ matcher.SetInstructionAndAdvance(Transpilers.EmitDelegate>(id => InitnalTechs.Contains(id)));
+ matcher.SetOpcodeAndAdvance(OpCodes.Brfalse_S);
+ return matcher.InstructionEnumeration();
+ }
+ }
+}
diff --git a/src/ProjectGenesis.cs b/src/ProjectGenesis.cs
index abd23a4..b5ccc9c 100644
--- a/src/ProjectGenesis.cs
+++ b/src/ProjectGenesis.cs
@@ -37,13 +37,16 @@ public class ProjectGenesis : BaseUnityPlugin, IModCanSave, IMultiplayerModWithS
{
public const string MODGUID = "org.LoShin.GenesisBook";
internal const string MODNAME = "GenesisBook";
- internal const string VERSION = "2.2.9";
+ internal const string VERSION = "2.2.10";
// ReSharper disable once MemberCanBePrivate.Global
internal static ManualLogSource logger;
//无限堆叠开关(私货)
private readonly bool StackSizeButton = false;
+
+ //清除LDB缓存
+ private readonly bool DebugMode = true;
private int[] TableID;
@@ -83,6 +86,8 @@ public void Awake()
foreach (var type in executingAssembly.GetTypes()) Harmony.PatchAll(type);
+ if (DebugMode) LDBToolCacheUtils.Clear();
+
LDBTool.PreAddDataAction += PreAddDataAction;
LDBTool.PostAddDataAction += PostAddDataAction;
}
diff --git a/src/Utils/LDBToolCacheUtils.cs b/src/Utils/LDBToolCacheUtils.cs
new file mode 100644
index 0000000..817c13e
--- /dev/null
+++ b/src/Utils/LDBToolCacheUtils.cs
@@ -0,0 +1,20 @@
+using BepInEx.Configuration;
+using HarmonyLib;
+using xiaoye97;
+
+namespace ProjectGenesis.Utils
+{
+ internal static class LDBToolCacheUtils
+ {
+ internal static void Clear()
+ {
+ ClearConfigFile("CustomID");
+ ClearConfigFile("CustomGridIndex");
+ ClearConfigFile("CustomStringZHCN");
+ ClearConfigFile("CustomStringENUS");
+ ClearConfigFile("CustomStringFRFR");
+ }
+
+ private static void ClearConfigFile(string name) => AccessTools.StaticFieldRefAccess(typeof(LDBTool), name).Clear();
+ }
+}