Add construct time multiplier
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
|
using Controllers;
|
||||||
using Controllers.Weather;
|
using Controllers.Weather;
|
||||||
using GameCustomization;
|
using GameCustomization;
|
||||||
using Gameplay.Buildings;
|
using Gameplay.Buildings;
|
||||||
@@ -12,7 +13,6 @@ 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;
|
||||||
@@ -46,6 +46,7 @@ namespace InfectionFreeZone {
|
|||||||
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
||||||
public static ConfigEntry<float> vehicleTrunkCapacityMultiplier;
|
public static ConfigEntry<float> vehicleTrunkCapacityMultiplier;
|
||||||
public static ConfigEntry<float> deconstructionTimeMultiplier;
|
public static ConfigEntry<float> deconstructionTimeMultiplier;
|
||||||
|
public static ConfigEntry<float> constructionTimeMultiplier;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
debug = Config.Bind("General", "Debug", false);
|
debug = Config.Bind("General", "Debug", false);
|
||||||
@@ -60,6 +61,7 @@ namespace InfectionFreeZone {
|
|||||||
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);
|
||||||
deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f);
|
deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f);
|
||||||
|
constructionTimeMultiplier = Config.Bind("General", "Construction Time Multiplier", 1f);
|
||||||
|
|
||||||
Logger.LogInfo("Cyka mod loaded");
|
Logger.LogInfo("Cyka mod loaded");
|
||||||
HarmonyFileLog.Enabled = true;
|
HarmonyFileLog.Enabled = true;
|
||||||
@@ -213,8 +215,6 @@ namespace InfectionFreeZone {
|
|||||||
Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}");
|
Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeconstructWork
|
|
||||||
// ConstructableWork
|
|
||||||
// GatherResourcesWork
|
// GatherResourcesWork
|
||||||
// ResearchWork
|
// ResearchWork
|
||||||
// AreaWork
|
// AreaWork
|
||||||
@@ -222,7 +222,7 @@ namespace InfectionFreeZone {
|
|||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor,
|
[HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor,
|
||||||
typeof(Structure), typeof(float), typeof(int), typeof(ResourcesController), typeof(SignalBus))]
|
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)
|
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -232,5 +232,21 @@ namespace InfectionFreeZone {
|
|||||||
if (Main.debug.Value)
|
if (Main.debug.Value)
|
||||||
Console.WriteLine($"Deconstruction time modified to {timeToDeconstruct}");
|
Console.WriteLine($"Deconstruction time modified to {timeToDeconstruct}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(ConstructableWork), MethodType.Constructor,
|
||||||
|
typeof(Structure), typeof(Dictionary<ResourceID, int>), typeof(float), typeof(StockroomsController),
|
||||||
|
typeof(SignalBus))]
|
||||||
|
public static void PrefixConstructWork(Structure structure, Dictionary<ResourceID, int> 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}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user