diff --git a/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs b/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs index ac63720..879749f 100644 --- a/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs +++ b/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using BepInEx; using BepInEx.Configuration; +using Controllers; using Controllers.Weather; using GameCustomization; using Gameplay.Buildings; @@ -12,7 +13,6 @@ using Gameplay.Rebuilding; using Gameplay.Scavenge; using Gameplay.Units.Icons; using Gameplay.Units.Movements; -using Gameplay.Units.Player.Workers.WorkSystem; using Gameplay.Units.Workers.WorkSystem.Works; using Gameplay.Vehicles; using HarmonyLib; @@ -46,6 +46,7 @@ namespace InfectionFreeZone { public static ConfigEntry humanMovementSpeedMultiplier; public static ConfigEntry vehicleTrunkCapacityMultiplier; public static ConfigEntry deconstructionTimeMultiplier; + public static ConfigEntry constructionTimeMultiplier; public void Awake() { debug = Config.Bind("General", "Debug", false); @@ -60,6 +61,7 @@ namespace InfectionFreeZone { humanMovementSpeedMultiplier = Config.Bind("General", "Human Movement Speed Multiplier", 1f); vehicleTrunkCapacityMultiplier = Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f); deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f); + constructionTimeMultiplier = Config.Bind("General", "Construction Time Multiplier", 1f); Logger.LogInfo("Cyka mod loaded"); HarmonyFileLog.Enabled = true; @@ -213,8 +215,6 @@ namespace InfectionFreeZone { Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}"); } - // DeconstructWork - // ConstructableWork // GatherResourcesWork // ResearchWork // AreaWork @@ -222,7 +222,7 @@ namespace InfectionFreeZone { [HarmonyPrefix] [HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor, typeof(Structure), typeof(float), typeof(int), typeof(ResourcesController), typeof(SignalBus))] - public static void PrefixWorkBaseSetProgress(Structure structure, ref float timeToDeconstruct) { + public static void PrefixDisassembleWork(Structure structure, ref float timeToDeconstruct) { if (Main.deconstructionTimeMultiplier.Value <= 0) return; @@ -232,5 +232,21 @@ namespace InfectionFreeZone { if (Main.debug.Value) Console.WriteLine($"Deconstruction time modified to {timeToDeconstruct}"); } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ConstructableWork), MethodType.Constructor, + typeof(Structure), typeof(Dictionary), typeof(float), typeof(StockroomsController), + typeof(SignalBus))] + public static void PrefixConstructWork(Structure structure, Dictionary cost, + ref float timeToConstruct) { + if (Main.deconstructionTimeMultiplier.Value <= 0) + return; + + if (Main.debug.Value) + Console.WriteLine($"Construction time is {timeToConstruct}"); + timeToConstruct *= Main.constructionTimeMultiplier.Value; + if (Main.debug.Value) + Console.WriteLine($"Construction time modified to {timeToConstruct}"); + } } } \ No newline at end of file