Add building deconstruct resource multiplier
This commit is contained in:
@@ -4,7 +4,9 @@ using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using GameCustomization;
|
||||
using Gameplay.Buildings;
|
||||
using Gameplay.GameResources;
|
||||
using Gameplay.InGameResources;
|
||||
using Gameplay.Scavenge;
|
||||
using Gameplay.Units.Workers.WorkSystem.Works;
|
||||
using HarmonyLib;
|
||||
@@ -32,6 +34,7 @@ namespace InfectionFreeZone {
|
||||
public static ConfigEntry<float> resourceScavengingMultiplier;
|
||||
public static ConfigEntry<float> buildingStorageCapacityMultiplier;
|
||||
public static ConfigEntry<float> buildingQuartersCapacityMultiplier;
|
||||
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
|
||||
// public static ConfigEntry<float> workSpeedMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
@@ -42,6 +45,7 @@ namespace InfectionFreeZone {
|
||||
resourceScavengingMultiplier = Config.Bind("General", "ResourceScavengingMultiplier", 1f);
|
||||
buildingStorageCapacityMultiplier = Config.Bind("General", "BuildingStorageCapacityMultiplier", 1f);
|
||||
buildingQuartersCapacityMultiplier = Config.Bind("General", "BuildingQuartersCapacityMultiplier", 1f);
|
||||
buildingDeconstructionResourcesMultiplier = Config.Bind("General", "BuildingDeconstructionResourcesMultiplier", 1f);
|
||||
// workSpeedMultiplier = Config.Bind("General", "WorkSpeedMultiplier", 1f);
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
@@ -118,7 +122,7 @@ namespace InfectionFreeZone {
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity")]
|
||||
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity", typeof(float), typeof(float))]
|
||||
public static void PostfixGetCapacity(ref int __result) {
|
||||
if (Main.buildingStorageCapacityMultiplier.Value <= 0)
|
||||
return;
|
||||
@@ -142,6 +146,28 @@ namespace InfectionFreeZone {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Building capacity modified to {__result}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Building), "DeconstructionResources", MethodType.Getter)]
|
||||
public static void PostfixDeconstructionResources(ref ResourceQuantity[] __result) {
|
||||
if (Main.buildingDeconstructionResourcesMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Deconstruction resources is {__result}");
|
||||
|
||||
for (int i = 0; i < __result.Length; i++) {
|
||||
var resourceQuantity = __result[i];
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Resource quantity is {resourceQuantity}");
|
||||
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Resource quantity value is {resourceQuantity.value}");
|
||||
resourceQuantity.value *= Main.buildingDeconstructionResourcesMultiplier.Value;
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Resource quantity value modified to {resourceQuantity.value}");
|
||||
}
|
||||
}
|
||||
// private void InstantiateResources()
|
||||
// {
|
||||
// foreach (KeyValuePair<ResourceID, int> generatedResource in this._resourcesToDrop)
|
||||
|
Reference in New Issue
Block a user