Work speed no workey :(
This commit is contained in:
@@ -20,14 +20,14 @@ namespace InfectionFreeZone {
|
|||||||
|
|
||||||
public static ConfigEntry<float> resourceMultiplier;
|
public static ConfigEntry<float> resourceMultiplier;
|
||||||
public static ConfigEntry<float> resourceGatheringMultiplier;
|
public static ConfigEntry<float> resourceGatheringMultiplier;
|
||||||
public static ConfigEntry<float> workSpeedMultiplier;
|
// public static ConfigEntry<float> workSpeedMultiplier;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
debug = Config.Bind("General", "Debug", false);
|
debug = Config.Bind("General", "Debug", false);
|
||||||
|
|
||||||
resourceMultiplier = Config.Bind("General", "ResourceMultiplier", 1f);
|
resourceMultiplier = Config.Bind("General", "ResourceMultiplier", 1f);
|
||||||
resourceGatheringMultiplier = Config.Bind("General", "ResourceGatheringMultiplier", 1f);
|
resourceGatheringMultiplier = Config.Bind("General", "ResourceGatheringMultiplier", 1f);
|
||||||
workSpeedMultiplier = Config.Bind("General", "WorkSpeedMultiplier", 1f);
|
// workSpeedMultiplier = Config.Bind("General", "WorkSpeedMultiplier", 1f);
|
||||||
|
|
||||||
Logger.LogInfo("Cyka mod loaded");
|
Logger.LogInfo("Cyka mod loaded");
|
||||||
HarmonyFileLog.Enabled = true;
|
HarmonyFileLog.Enabled = true;
|
||||||
@@ -67,24 +67,26 @@ namespace InfectionFreeZone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
// [HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(WorkBase), "SetProgress")]
|
// [HarmonyPatch(typeof(WorkBase), "SetProgress")]
|
||||||
public static void PostfixSetProgress(WorkBase __instance, ref float progress) {
|
// public static void PostfixSetProgress(WorkBase __instance, ref float progress) {
|
||||||
if (Main.debug.Value)
|
// if (Main.debug.Value)
|
||||||
Console.WriteLine($"Progress is {progress}");
|
// Console.WriteLine($"Progress is {progress}");
|
||||||
if (progress > 0) {
|
// if (progress > 0) {
|
||||||
var traversed = Traverse.Create(__instance);
|
// var traversed = Traverse.Create(__instance);
|
||||||
var _previousProgress = traversed.Field<float>("_previousProgress");
|
// var _previousProgress = traversed.Field<float>("_previousProgress");
|
||||||
var delta = progress - _previousProgress.Value;
|
// if (Main.debug.Value)
|
||||||
|
// Console.WriteLine($"_previousProgress is {_previousProgress}");
|
||||||
if (Main.debug.Value)
|
//
|
||||||
Console.WriteLine($"Delta is {delta}");
|
// var delta = progress - _previousProgress.Value;
|
||||||
|
// if (Main.debug.Value)
|
||||||
progress += delta * Main.workSpeedMultiplier.Value;
|
// Console.WriteLine($"Delta is {delta}");
|
||||||
if (Main.debug.Value)
|
//
|
||||||
Console.WriteLine($"Progress modified to {progress}");
|
// progress += delta * Main.workSpeedMultiplier.Value;
|
||||||
}
|
// if (Main.debug.Value)
|
||||||
}
|
// Console.WriteLine($"Progress modified to {progress}");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// Maybe prefix this with __instance
|
// Maybe prefix this with __instance
|
||||||
// And then calculate the delta and update progress with progress+delta
|
// And then calculate the delta and update progress with progress+delta
|
||||||
|
Reference in New Issue
Block a user