Browse Source

[2.0.4.6] Better Interface

Zariteis 4 years ago
parent
commit
ac09f6eead
3 changed files with 9 additions and 58 deletions
  1. 8 0
      API/StorageSizeInterface.cs
  2. 0 57
      Patches/RePatch_GameScript_Update.cs
  3. 1 1
      StorageExpansion.cs

+ 8 - 0
API/StorageSizeInterface.cs

@@ -0,0 +1,8 @@
+namespace StorageExpansion.API
+{
+  public static class StorageSizeInterface
+  {
+    public static int Pages => Core.settingAmountActualPages;
+    public static int Slots => Core.settingAmountActualSlots;
+  }
+}

+ 0 - 57
Patches/RePatch_GameScript_Update.cs

@@ -1,57 +0,0 @@
-using GadgetCore.API;
-using GadgetCore.Util;
-using HarmonyLib;
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Reflection.Emit;
-using UnityEngine;
-
-namespace StorageExpansion.Patches
-{
-
-  [HarmonyPatch()]
-  [HarmonyGadget("StorageExpansion")]
-  public static class RePatch_GameScript_Update
-  {
-
-    [HarmonyPrepare]
-    static bool Prepare()
-    {
-      foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
-      {
-        if (a.FullName.StartsWith("QuickStack,"))
-        {
-          return true;
-        }
-      }
-      return false;
-    }
-
-    [HarmonyTargetMethods]
-    static IEnumerable<MethodBase> TargetMethods()
-    {
-      foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
-      {
-        if (a.FullName.StartsWith("QuickStack,"))
-        {
-          yield return AccessTools.Method(a.GetType("QuickStack.Patches.Patch_GameScript_Update"), "Prefix");
-        }
-      }
-      yield break;
-    }
-
-    [HarmonyTranspiler]
-    public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator gen)
-    {
-      var p = TranspilerHelper.CreateProcessor(instructions, gen);
-      var ilRefs = p.FindAllRefsByInsn(new CodeInstruction(OpCodes.Ldc_I4_S, 30));
-      MethodInfo getValue = typeof(SlotsPerPageGetter).GetProperty("SlotsPerPage").GetGetMethod();
-      foreach (var ilRef in ilRefs)
-      {
-        p.InjectInsn(ilRef, new CodeInstruction(OpCodes.Call, getValue), false);
-      }
-      return p.Insns;
-    }
-  }
-}

+ 1 - 1
StorageExpansion.cs

@@ -8,7 +8,7 @@ namespace StorageExpansion
   [Gadget("StorageExpansion", RequiredOnClients: false, LoadBefore: new string[] { "QuickStack" })]
   public class StorageExpansion : Gadget<StorageExpansion>
   {
-    public const string MOD_VERSION = "1.1"; // Set this to the version of your mod.
+    public const string MOD_VERSION = "1.2"; // Set this to the version of your mod.
     public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
 
     protected override void LoadConfig()