diff --git a/Projects/Zompiercer/Zompiercer/Class1.cs b/Projects/Zompiercer/Zompiercer/Class1.cs index 766b1f7..8678975 100644 --- a/Projects/Zompiercer/Zompiercer/Class1.cs +++ b/Projects/Zompiercer/Zompiercer/Class1.cs @@ -15,9 +15,11 @@ namespace Zompiercer { private const string PluginVersion = "1.0.0"; public static ConfigEntry debug; + public static ConfigEntry weightMultiplier; public void Awake() { debug = Config.Bind("General", "Debug", false); + weightMultiplier = Config.Bind("General", "Weight Multiplier", 1.0f, "Multiplier for the weight of the tank"); Logger.LogInfo("Cyka mod loaded"); HarmonyFileLog.Enabled = true; diff --git a/Projects/Zompiercer/Zompiercer/Patches.cs b/Projects/Zompiercer/Zompiercer/Patches.cs index 0e89f8f..c51c51c 100644 --- a/Projects/Zompiercer/Zompiercer/Patches.cs +++ b/Projects/Zompiercer/Zompiercer/Patches.cs @@ -1,13 +1,24 @@ -using HarmonyLib; +using System; +using HarmonyLib; namespace Zompiercer { [HarmonyPatch] public class Patches { - //[HarmonyPrefix] - //[HarmonyPatch(typeof(ManLicenses), "AddXP")] - //static void XpMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) { - // xp = (int)(xp * Main.xpMultiplier.Value); - //} + [HarmonyPostfix] + [HarmonyPatch(typeof(InventoryItem), "GetWeight")] + static void GetWeight(ref float __result) { + if (Main.debug.Value) + Console.WriteLine("GetWeight: " + __result); + __result = __result * Main.weightMultiplier.Value; + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(InventoryItem), "GetWeightOfOneItem")] + static void GetWeightOfOneItem(ref float __result) { + if (Main.debug.Value) + Console.WriteLine("GetWeightOfOneItem: " + __result); + __result = __result * Main.weightMultiplier.Value; + } //[HarmonyPrefix] //[HarmonyPatch(typeof(ManPlayer), "AddMoney")]