Add faster dump patch

This commit is contained in:
2024-04-19 23:52:12 +02:00
parent 19b242e3cf
commit 4e842f4149
2 changed files with 27 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ namespace CaptainOfIndustry {
public static ConfigEntry<float> depotTransferSpeedMultiplier; public static ConfigEntry<float> depotTransferSpeedMultiplier;
public static ConfigEntry<float> worldMineSpeedMultiplier; public static ConfigEntry<float> worldMineSpeedMultiplier;
public static ConfigEntry<float> housingCapacityMultiplier; public static ConfigEntry<float> housingCapacityMultiplier;
public static ConfigEntry<float> dumpDelayMultiplier;
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"));
@@ -38,6 +39,7 @@ namespace CaptainOfIndustry {
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")); worldMineSpeedMultiplier = Config.Bind("General", "World Mine Speed Multiplier", 1f, new ConfigDescription("World Mine Speed Multiplier"));
housingCapacityMultiplier = Config.Bind("General", "Housing Capacity Multiplier", 1f, new ConfigDescription("Housing Capacity Multiplier")); housingCapacityMultiplier = Config.Bind("General", "Housing Capacity Multiplier", 1f, new ConfigDescription("Housing Capacity Multiplier"));
dumpDelayMultiplier = Config.Bind("General", "Dump Delay Multiplier", 1f, new ConfigDescription("Dump Delay 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();

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection.Emit; using System.Reflection.Emit;
@@ -15,6 +16,7 @@ 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;
using Mafi.Core.Factory.Machines; using Mafi.Core.Factory.Machines;
using Mafi.Core.Factory.Transports;
using Mafi.Core.Population; using Mafi.Core.Population;
using Mafi.Core.Products; using Mafi.Core.Products;
using Mafi.Core.Prototypes; using Mafi.Core.Prototypes;
@@ -366,5 +368,28 @@ namespace CaptainOfIndustry {
Traverse.Create(__instance).Field<int>("Capacity").Value = Traverse.Create(__instance).Field<int>("Capacity").Value =
(int)(__instance.Capacity * Main.housingCapacityMultiplier.Value); (int)(__instance.Capacity * Main.housingCapacityMultiplier.Value);
} }
// ublic StackerProto(StaticEntityProto.ID id, Proto.Str strings, EntityLayout layout, EntityCosts costs, Electricity consumedPowerPerTick, ThicknessTilesI minDumpOffset, RelTile3i dumpHeadRelPos, Duration dumpDelay, Duration dumpPeriod, StackerProto.Gfx graphics, ThicknessTilesI defaultDumpOffset, IEnumerable<Tag> tags = null)
[HarmonyPostfix]
[HarmonyPatch(typeof(StackerProto), MethodType.Constructor, new[] {
typeof(StaticEntityProto.ID),
typeof(Proto.Str),
typeof(EntityLayout),
typeof(EntityCosts),
typeof(Electricity),
typeof(ThicknessTilesI),
typeof(RelTile3i),
typeof(Duration),
typeof(Duration),
typeof(StackerProto.Gfx),
typeof(ThicknessTilesI),
typeof(IEnumerable<Tag>),
})]
static void dumpDelayMultiplier(StackerProto __instance) {
Duration newDelay =
new Duration(Math.Max((int)(__instance.DumpDelay.Ticks * Main.dumpDelayMultiplier.Value), 1));
Traverse.Create(__instance).Field("DumpDelay").SetValue(newDelay);
}
} }
} }