Add deconstruct time multiplier
This commit is contained in:
@@ -8,9 +8,11 @@ using GameCustomization;
|
|||||||
using Gameplay.Buildings;
|
using Gameplay.Buildings;
|
||||||
using Gameplay.GameResources;
|
using Gameplay.GameResources;
|
||||||
using Gameplay.InGameResources;
|
using Gameplay.InGameResources;
|
||||||
|
using Gameplay.Rebuilding;
|
||||||
using Gameplay.Scavenge;
|
using Gameplay.Scavenge;
|
||||||
using Gameplay.Units.Icons;
|
using Gameplay.Units.Icons;
|
||||||
using Gameplay.Units.Movements;
|
using Gameplay.Units.Movements;
|
||||||
|
using Gameplay.Units.Player.Workers.WorkSystem;
|
||||||
using Gameplay.Units.Workers.WorkSystem.Works;
|
using Gameplay.Units.Workers.WorkSystem.Works;
|
||||||
using Gameplay.Vehicles;
|
using Gameplay.Vehicles;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
@@ -43,7 +45,7 @@ namespace InfectionFreeZone {
|
|||||||
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
|
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
|
||||||
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
||||||
public static ConfigEntry<float> vehicleTrunkCapacityMultiplier;
|
public static ConfigEntry<float> vehicleTrunkCapacityMultiplier;
|
||||||
// public static ConfigEntry<float> workSpeedMultiplier;
|
public static ConfigEntry<float> deconstructionTimeMultiplier;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
debug = Config.Bind("General", "Debug", false);
|
debug = Config.Bind("General", "Debug", false);
|
||||||
@@ -57,7 +59,7 @@ namespace InfectionFreeZone {
|
|||||||
Config.Bind("General", "Building Deconstruction Resources Multiplier", 1f);
|
Config.Bind("General", "Building Deconstruction Resources Multiplier", 1f);
|
||||||
humanMovementSpeedMultiplier = Config.Bind("General", "Human Movement Speed Multiplier", 1f);
|
humanMovementSpeedMultiplier = Config.Bind("General", "Human Movement Speed Multiplier", 1f);
|
||||||
vehicleTrunkCapacityMultiplier = Config.Bind("General", "Vehicle Trunk Capacity 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");
|
Logger.LogInfo("Cyka mod loaded");
|
||||||
HarmonyFileLog.Enabled = true;
|
HarmonyFileLog.Enabled = true;
|
||||||
@@ -210,5 +212,25 @@ namespace InfectionFreeZone {
|
|||||||
if (Main.debug.Value)
|
if (Main.debug.Value)
|
||||||
Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}");
|
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}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user