diff --git a/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs b/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs index 9bd7ee3..ac63720 100644 --- a/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs +++ b/Projects/InfectionFreeZone/InfectionFreeZone/InfectionFreeZone.cs @@ -8,9 +8,11 @@ using GameCustomization; using Gameplay.Buildings; using Gameplay.GameResources; using Gameplay.InGameResources; +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; @@ -43,7 +45,7 @@ namespace InfectionFreeZone { public static ConfigEntry buildingDeconstructionResourcesMultiplier; public static ConfigEntry humanMovementSpeedMultiplier; public static ConfigEntry vehicleTrunkCapacityMultiplier; - // public static ConfigEntry workSpeedMultiplier; + public static ConfigEntry deconstructionTimeMultiplier; public void Awake() { debug = Config.Bind("General", "Debug", false); @@ -57,7 +59,7 @@ namespace InfectionFreeZone { Config.Bind("General", "Building Deconstruction Resources Multiplier", 1f); humanMovementSpeedMultiplier = Config.Bind("General", "Human Movement Speed Multiplier", 1f); vehicleTrunkCapacityMultiplier = Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f); - // workSpeedMultiplier = Config.Bind("General", "WorkSpeedMultiplier", 1f); + deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f); Logger.LogInfo("Cyka mod loaded"); HarmonyFileLog.Enabled = true; @@ -210,5 +212,25 @@ namespace InfectionFreeZone { if (Main.debug.Value) Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}"); } + + // DeconstructWork + // ConstructableWork + // GatherResourcesWork + // ResearchWork + // AreaWork + // ProductionWork + [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) { + if (Main.deconstructionTimeMultiplier.Value <= 0) + return; + + if (Main.debug.Value) + Console.WriteLine($"Deconstruction time is {timeToDeconstruct}"); + timeToDeconstruct *= Main.deconstructionTimeMultiplier.Value; + if (Main.debug.Value) + Console.WriteLine($"Deconstruction time modified to {timeToDeconstruct}"); + } } } \ No newline at end of file