Make pipe throughput speedifier

This commit is contained in:
2024-04-30 16:45:47 +02:00
parent c7ce35f675
commit 6b325ff7db
2 changed files with 56 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ namespace CaptainOfIndustry {
public static ConfigEntry<float> worldMineSpeedMultiplier;
public static ConfigEntry<float> housingCapacityMultiplier;
public static ConfigEntry<float> dumpDelayMultiplier;
public static ConfigEntry<float> transportSpeedMultiplier;
public void Awake() {
excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1, new ConfigDescription("Excavator Capacity Multiplier"));
@@ -40,6 +41,7 @@ namespace CaptainOfIndustry {
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"));
dumpDelayMultiplier = Config.Bind("General", "Dump Delay Multiplier", 1f, new ConfigDescription("Dump Delay Multiplier"));
transportSpeedMultiplier = Config.Bind("General", "Transport Speed Multiplier", 1f, new ConfigDescription("Transport Speed Multiplier"));
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();

View File

@@ -18,8 +18,10 @@ using Mafi.Core.Entities.Static.Layout;
using Mafi.Core.Factory.Machines;
using Mafi.Core.Factory.Transports;
using Mafi.Core.Population;
using Mafi.Core.Ports.Io;
using Mafi.Core.Products;
using Mafi.Core.Prototypes;
using Mafi.Core.Terrain;
using Mafi.Core.World.Entities;
namespace CaptainOfIndustry {
@@ -369,7 +371,6 @@ namespace CaptainOfIndustry {
(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[] {
@@ -391,5 +392,57 @@ namespace CaptainOfIndustry {
new Duration(Math.Max((int)(__instance.DumpDelay.Ticks * Main.dumpDelayMultiplier.Value), 1));
Traverse.Create(__instance).Field("DumpDelay").SetValue(newDelay);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TransportProto), MethodType.Constructor, new[] {
typeof(StaticEntityProto.ID),
typeof(Proto.Str),
typeof(ThicknessTilesF),
typeof(Quantity),
typeof(RelTile1f),
typeof(RelTile1f),
typeof(RelTile1i),
typeof(bool),
typeof(bool),
typeof(Option<TerrainTileSurfaceProto>),
typeof(RelTile1i),
typeof(IoPortShapeProto),
typeof(Electricity),
typeof(Percent),
typeof(bool),
typeof(bool),
typeof(EntityCosts),
typeof(RelTile1i),
typeof(Duration),
typeof(Option<TransportProto>),
typeof(VirtualProductProto),
typeof(Quantity),
typeof(TransportProto.Gfx),
})]
static void transportSpeedMultiplier(ref StaticEntityProto.ID id, ref Proto.Str strings,
ref ThicknessTilesF surfaceRelativeHeight, ref Quantity maxQuantityPerTransportedProduct,
ref RelTile1f transportedProductsSpacing, ref RelTile1f speedPerTick, ref RelTile1i zStepLength,
ref bool needsPillarsAtGround, ref bool canBeBuried,
ref Option<TerrainTileSurfaceProto> tileSurfaceWhenOnGround, ref RelTile1i maxPillarSupportRadius,
ref IoPortShapeProto portsShape, ref Electricity baseElectricityCost, ref Percent cornersSharpnessPercent,
ref bool allowMixedProducts, ref bool isBuildable, ref EntityCosts costs, ref RelTile1i lengthPerCost,
ref Duration constructionDurationPerProduct, ref Option<TransportProto> nextTier,
ref VirtualProductProto maintenanceProduct, Quantity maintenancePerTile, ref TransportProto.Gfx graphics) {
if (TransportPillarProto.MAX_PILLAR_HEIGHT.Value < 25)
typeof(TransportPillarProto).GetField("MAX_PILLAR_HEIGHT").SetValue(null, new ThicknessTilesI(25));
if (IoPort.MAX_TRANSFER_PER_TICK.Value < 10000)
typeof(IoPort).GetField("MAX_TRANSFER_PER_TICK").SetValue(null, new Quantity(10000));
maxQuantityPerTransportedProduct *= 1000;
maxQuantityPerTransportedProduct = maxQuantityPerTransportedProduct.Min(new Quantity(10000));
Console.WriteLine("maxQuantityPerTransportedProduct {0}", maxQuantityPerTransportedProduct);
speedPerTick *= 10;
transportedProductsSpacing = speedPerTick;
zStepLength = RelTile1i.One;
canBeBuried = true;
maxPillarSupportRadius = new RelTile1i(8);
}
}
}