Add world mine production patch
This commit is contained in:
@@ -21,6 +21,7 @@ namespace CaptainOfIndustry {
|
|||||||
public static ConfigEntry<float> bufferCapacityMultiplier;
|
public static ConfigEntry<float> bufferCapacityMultiplier;
|
||||||
public static ConfigEntry<float> unityGenerationMultiplier;
|
public static ConfigEntry<float> unityGenerationMultiplier;
|
||||||
public static ConfigEntry<float> depotTransferSpeedMultiplier;
|
public static ConfigEntry<float> depotTransferSpeedMultiplier;
|
||||||
|
public static ConfigEntry<float> worldMineSpeedMultiplier;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1, new ConfigDescription("Excavator Capacity Multiplier"));
|
excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1, new ConfigDescription("Excavator Capacity Multiplier"));
|
||||||
@@ -31,6 +32,7 @@ namespace CaptainOfIndustry {
|
|||||||
storageCapacityMultiplier = Config.Bind("General", "Storage Capacity Multiplier", 1f, new ConfigDescription("Storage Capacity Multiplier"));
|
storageCapacityMultiplier = Config.Bind("General", "Storage Capacity Multiplier", 1f, new ConfigDescription("Storage Capacity Multiplier"));
|
||||||
unityGenerationMultiplier = Config.Bind("General", "Unity Generation Multiplier", 1f, new ConfigDescription("Unity Generation Multiplier"));
|
unityGenerationMultiplier = Config.Bind("General", "Unity Generation Multiplier", 1f, new ConfigDescription("Unity Generation Multiplier"));
|
||||||
depotTransferSpeedMultiplier = Config.Bind("General", "Depot Transfer Speed Multiplier", 1f, new ConfigDescription("Depot Transfer Speed Multiplier"));
|
depotTransferSpeedMultiplier = Config.Bind("General", "Depot Transfer Speed Multiplier", 1f, new ConfigDescription("Depot Transfer Speed Multiplier"));
|
||||||
|
worldMineSpeedMultiplier = Config.Bind("General", "World Mine Speed Multiplier", 1f, new ConfigDescription("World Mine Speed Multiplier"));
|
||||||
|
|
||||||
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
|
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
|
||||||
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
|
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
|
||||||
|
@@ -5,10 +5,12 @@ using System.Reflection;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Mafi;
|
using Mafi;
|
||||||
|
using Mafi.Core;
|
||||||
using Mafi.Core.Buildings.Cargo;
|
using Mafi.Core.Buildings.Cargo;
|
||||||
using Mafi.Core.Buildings.Cargo.Modules;
|
using Mafi.Core.Buildings.Cargo.Modules;
|
||||||
using Mafi.Core.Buildings.Cargo.Ships.Modules;
|
using Mafi.Core.Buildings.Cargo.Ships.Modules;
|
||||||
using Mafi.Core.Buildings.Storages;
|
using Mafi.Core.Buildings.Storages;
|
||||||
|
using Mafi.Core.Entities;
|
||||||
using Mafi.Core.Entities.Dynamic;
|
using Mafi.Core.Entities.Dynamic;
|
||||||
using Mafi.Core.Entities.Static;
|
using Mafi.Core.Entities.Static;
|
||||||
using Mafi.Core.Entities.Static.Layout;
|
using Mafi.Core.Entities.Static.Layout;
|
||||||
@@ -17,6 +19,7 @@ using Mafi.Core.Map;
|
|||||||
using Mafi.Core.Population;
|
using Mafi.Core.Population;
|
||||||
using Mafi.Core.Products;
|
using Mafi.Core.Products;
|
||||||
using Mafi.Core.Prototypes;
|
using Mafi.Core.Prototypes;
|
||||||
|
using Mafi.Core.World.Entities;
|
||||||
|
|
||||||
namespace CaptainOfIndustry {
|
namespace CaptainOfIndustry {
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
@@ -231,9 +234,40 @@ namespace CaptainOfIndustry {
|
|||||||
Traverse traverse = Traverse.Create(__instance);
|
Traverse traverse = Traverse.Create(__instance);
|
||||||
|
|
||||||
traverse.Field("QuantityPerExchange")
|
traverse.Field("QuantityPerExchange")
|
||||||
.SetValue(new Quantity((int)(__instance.QuantityPerExchange.Value * Main.depotTransferSpeedMultiplier.Value)));
|
.SetValue(new Quantity((int)(__instance.QuantityPerExchange.Value *
|
||||||
|
Main.depotTransferSpeedMultiplier.Value)));
|
||||||
|
|
||||||
// Console.WriteLine("IndustrialCyka: New storage capacity: {0}", __instance.Capacity.Value);
|
// Console.WriteLine("IndustrialCyka: New storage capacity: {0}", __instance.Capacity.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||||
|
new[] {
|
||||||
|
typeof(EntityProto.ID),
|
||||||
|
typeof(Proto.Str),
|
||||||
|
typeof(ProductQuantity),
|
||||||
|
typeof(Duration),
|
||||||
|
typeof(Upoints),
|
||||||
|
typeof(UpointsCategoryProto),
|
||||||
|
typeof(EntityCosts),
|
||||||
|
typeof(Func<int, EntityCosts>),
|
||||||
|
typeof(int),
|
||||||
|
typeof(Quantity),
|
||||||
|
typeof(WorldMapEntityProto.Gfx),
|
||||||
|
typeof(int),
|
||||||
|
typeof(int),
|
||||||
|
typeof(IEnumerable<Tag>),
|
||||||
|
})]
|
||||||
|
static void worldMineSpeedMultiplier(WorldMapMineProto __instance) {
|
||||||
|
// Console.WriteLine("Before: {0}", __instance.ProducedProductPerStep.Quantity.Value);
|
||||||
|
ProductQuantity newProductQuantity = new ProductQuantity(__instance.ProducedProductPerStep.Product,
|
||||||
|
new Quantity((int)(__instance.ProducedProductPerStep.Quantity.Value *
|
||||||
|
Main.worldMineSpeedMultiplier.Value)));
|
||||||
|
|
||||||
|
Traverse.Create(__instance)
|
||||||
|
.Field("ProducedProductPerStep")
|
||||||
|
.SetValue(newProductQuantity);
|
||||||
|
// Console.WriteLine("After: {0}", __instance.ProducedProductPerStep.Quantity.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user