More shipyard cargo

This commit is contained in:
2024-05-31 20:15:03 +02:00
parent 9e923c4c87
commit 0619976965
2 changed files with 541 additions and 521 deletions

View File

@@ -1,73 +1,75 @@
using BepInEx; using BepInEx;
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using HarmonyLib.Tools; using HarmonyLib.Tools;
// TODO: Make shield and repair bigger // TODO: Make shield and repair bigger
// TODO: Maybe make props faster, thrusters work fine // TODO: Maybe make props faster, thrusters work fine
namespace CaptainOfIndustry { namespace CaptainOfIndustry {
[BepInPlugin(pluginGuid, pluginName, pluginVersion)] [BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class Main : BaseUnityPlugin { public class Main : BaseUnityPlugin {
private const string pluginGuid = "CykaMod"; private const string pluginGuid = "CykaMod";
private const string pluginName = "CykaMod"; private const string pluginName = "CykaMod";
private const string pluginVersion = "1.0.0"; private const string pluginVersion = "1.0.0";
public static ConfigEntry<int> excavatorCapacityMultiplier; public static ConfigEntry<int> excavatorCapacityMultiplier;
public static ConfigEntry<int> truckCapacityMultiplier; public static ConfigEntry<int> truckCapacityMultiplier;
public static ConfigEntry<int> cargoShipCapacityMultiplier; public static ConfigEntry<int> cargoShipCapacityMultiplier;
public static ConfigEntry<float> excavatorMiningAreaMultiplier; public static ConfigEntry<float> excavatorMiningAreaMultiplier;
public static ConfigEntry<float> excavatorMinReachMultiplier; public static ConfigEntry<float> excavatorMinReachMultiplier;
public static ConfigEntry<float> excavatorMaxReachMultiplier; public static ConfigEntry<float> excavatorMaxReachMultiplier;
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 static ConfigEntry<float> worldMineSpeedMultiplier;
public static ConfigEntry<float> housingCapacityMultiplier; public static ConfigEntry<float> housingCapacityMultiplier;
public static ConfigEntry<float> dumpDelayMultiplier; public static ConfigEntry<float> dumpDelayMultiplier;
public static ConfigEntry<float> transportSpeedMultiplier; public static ConfigEntry<float> transportSpeedMultiplier;
public static ConfigEntry<float> shipyardCargoMultiplier;
public void Awake() {
excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1, new ConfigDescription("Excavator Capacity Multiplier")); public void Awake() {
truckCapacityMultiplier = Config.Bind("General", "Truck Capacity Multiplier", 1, new ConfigDescription("Truck Capacity Multiplier")); excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1, new ConfigDescription("Excavator Capacity Multiplier"));
cargoShipCapacityMultiplier = Config.Bind("General", "Cargo Ship Capacity Multiplier", 1, new ConfigDescription("Cargo Ship Capacity Multiplier")); truckCapacityMultiplier = Config.Bind("General", "Truck Capacity Multiplier", 1, new ConfigDescription("Truck Capacity Multiplier"));
excavatorMiningAreaMultiplier = Config.Bind("General", "Excavator Mining Area Multiplier", 1f, new ConfigDescription("Excavator Mining Area Multiplier")); cargoShipCapacityMultiplier = Config.Bind("General", "Cargo Ship Capacity Multiplier", 1, new ConfigDescription("Cargo Ship Capacity Multiplier"));
excavatorMinReachMultiplier = Config.Bind("General", "Excavator Min Reach Multiplier", 1f, new ConfigDescription("Excavator Min Reach Multiplier")); excavatorMiningAreaMultiplier = Config.Bind("General", "Excavator Mining Area Multiplier", 1f, new ConfigDescription("Excavator Mining Area Multiplier"));
excavatorMaxReachMultiplier = Config.Bind("General", "Excavator Max Reach Multiplier", 1f, new ConfigDescription("Excavator Max Reach Multiplier")); excavatorMinReachMultiplier = Config.Bind("General", "Excavator Min Reach Multiplier", 1f, new ConfigDescription("Excavator Min Reach Multiplier"));
bufferCapacityMultiplier = Config.Bind("General", "Buffer Capacity Multiplier", 1f, new ConfigDescription("Buffer Capacity Multiplier")); excavatorMaxReachMultiplier = Config.Bind("General", "Excavator Max Reach Multiplier", 1f, new ConfigDescription("Excavator Max Reach Multiplier"));
storageCapacityMultiplier = Config.Bind("General", "Storage Capacity Multiplier", 1f, new ConfigDescription("Storage Capacity Multiplier")); bufferCapacityMultiplier = Config.Bind("General", "Buffer Capacity Multiplier", 1f, new ConfigDescription("Buffer Capacity Multiplier"));
unityGenerationMultiplier = Config.Bind("General", "Unity Generation Multiplier", 1f, new ConfigDescription("Unity Generation Multiplier")); storageCapacityMultiplier = Config.Bind("General", "Storage Capacity Multiplier", 1f, new ConfigDescription("Storage Capacity Multiplier"));
depotTransferSpeedMultiplier = Config.Bind("General", "Depot Transfer Speed Multiplier", 1f, new ConfigDescription("Depot Transfer Speed Multiplier")); unityGenerationMultiplier = Config.Bind("General", "Unity Generation Multiplier", 1f, new ConfigDescription("Unity Generation Multiplier"));
worldMineSpeedMultiplier = Config.Bind("General", "World Mine Speed Multiplier", 1f, new ConfigDescription("World Mine Speed Multiplier")); depotTransferSpeedMultiplier = Config.Bind("General", "Depot Transfer Speed Multiplier", 1f, new ConfigDescription("Depot Transfer Speed Multiplier"));
housingCapacityMultiplier = Config.Bind("General", "Housing Capacity Multiplier", 1f, new ConfigDescription("Housing Capacity Multiplier")); worldMineSpeedMultiplier = Config.Bind("General", "World Mine Speed Multiplier", 1f, new ConfigDescription("World Mine Speed Multiplier"));
dumpDelayMultiplier = Config.Bind("General", "Dump Delay Multiplier", 1f, new ConfigDescription("Dump Delay Multiplier")); housingCapacityMultiplier = Config.Bind("General", "Housing Capacity Multiplier", 1f, new ConfigDescription("Housing Capacity Multiplier"));
transportSpeedMultiplier = Config.Bind("General", "Transport Speed Multiplier", 1f, new ConfigDescription("Transport Speed 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(); shipyardCargoMultiplier = Config.Bind("General", "Shipyard Cargo Multiplier", 1f, new ConfigDescription("Shipyard Cargo Multiplier"));
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
// magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch(); // shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
// magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch(); // energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
// beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch(); // magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
// beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch(); // magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
// fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch(); // beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
// fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch(); // beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
// wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch(); // fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
// wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch(); // fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
// jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch(); // wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
// minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch(); // wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
// minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch(); // jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch();
// wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); // minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
// wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); // minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
// wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); // wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
// wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
Logger.LogInfo("Cyka mod loaded"); // wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
HarmonyFileLog.Enabled = true;
Harmony harmony = new Harmony(pluginGuid); Logger.LogInfo("Cyka mod loaded");
harmony.PatchAll(); HarmonyFileLog.Enabled = true;
var originalMethods = harmony.GetPatchedMethods(); Harmony harmony = new Harmony(pluginGuid);
// Logger.LogInfo("Patched " + originalMethods.Count() + " methods"); harmony.PatchAll();
} var originalMethods = harmony.GetPatchedMethods();
// Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
public static ConfigEntry<float> storageCapacityMultiplier; }
}
} public static ConfigEntry<float> storageCapacityMultiplier;
}
}

View File

@@ -1,448 +1,466 @@
using System; using System;
using System.Collections; 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;
using HarmonyLib; using HarmonyLib;
using Mafi; using Mafi;
using Mafi.Collections.ImmutableCollections; using Mafi.Collections.ImmutableCollections;
using Mafi.Core; using Mafi.Core;
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.Settlements; using Mafi.Core.Buildings.Settlements;
using Mafi.Core.Buildings.Storages; using Mafi.Core.Buildings.Shipyard;
using Mafi.Core.Entities; using Mafi.Core.Buildings.Storages;
using Mafi.Core.Entities.Dynamic; using Mafi.Core.Entities;
using Mafi.Core.Entities.Static; using Mafi.Core.Entities.Dynamic;
using Mafi.Core.Entities.Static.Layout; using Mafi.Core.Entities.Static;
using Mafi.Core.Factory.Machines; using Mafi.Core.Entities.Static.Layout;
using Mafi.Core.Factory.Transports; using Mafi.Core.Factory.Machines;
using Mafi.Core.Population; using Mafi.Core.Factory.Transports;
using Mafi.Core.Ports.Io; using Mafi.Core.Population;
using Mafi.Core.Products; using Mafi.Core.Ports.Io;
using Mafi.Core.Prototypes; using Mafi.Core.Products;
using Mafi.Core.Terrain; using Mafi.Core.Prototypes;
using Mafi.Core.World.Entities; using Mafi.Core.Terrain;
using Mafi.Core.World.Entities;
namespace CaptainOfIndustry {
[HarmonyPatch] namespace CaptainOfIndustry {
public class Patches { [HarmonyPatch]
[HarmonyPrefix] public class Patches {
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetCapacity")] [HarmonyPrefix]
static void excavatorCapacityMultiplier(ref int quantity) { [HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetCapacity")]
// Console.WriteLine("IndustrialCyka: Old excavator capacity: {0}", quantity); static void excavatorCapacityMultiplier(ref int quantity) {
quantity *= Main.excavatorCapacityMultiplier.Value; // Console.WriteLine("IndustrialCyka: Old excavator capacity: {0}", quantity);
// Console.WriteLine("IndustrialCyka: Old excavator capacity: {0}", quantity); quantity *= Main.excavatorCapacityMultiplier.Value;
} // Console.WriteLine("IndustrialCyka: Old excavator capacity: {0}", quantity);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMinedThicknessByDistanceMeters")] [HarmonyPrefix]
static void excavatorMiningAreaMultiplier(ref float[] thicknessMeters) { [HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMinedThicknessByDistanceMeters")]
for (int i = 0; i < thicknessMeters.Length; i++) { static void excavatorMiningAreaMultiplier(ref float[] thicknessMeters) {
// Console.WriteLine("IndustrialCyka: Old mining area: {0}", thicknessMeters[i]); for (int i = 0; i < thicknessMeters.Length; i++) {
thicknessMeters[i] *= Main.excavatorMiningAreaMultiplier.Value; // Console.WriteLine("IndustrialCyka: Old mining area: {0}", thicknessMeters[i]);
// Console.WriteLine("IndustrialCyka: New mining area: {0}", thicknessMeters[i]); thicknessMeters[i] *= Main.excavatorMiningAreaMultiplier.Value;
} // Console.WriteLine("IndustrialCyka: New mining area: {0}", thicknessMeters[i]);
} }
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMaxMiningDistance")] [HarmonyPrefix]
static void excavatorReachMultiplier(ref RelTile1i minMiningDistance, ref RelTile1i maxMiningDistance) { [HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMaxMiningDistance")]
Console.WriteLine("Min distance: {0}, max distance: {1}", minMiningDistance, maxMiningDistance); static void excavatorReachMultiplier(ref RelTile1i minMiningDistance, ref RelTile1i maxMiningDistance) {
minMiningDistance = new RelTile1i((int)(minMiningDistance.Value * Main.excavatorMinReachMultiplier.Value)); Console.WriteLine("Min distance: {0}, max distance: {1}", minMiningDistance, maxMiningDistance);
maxMiningDistance = new RelTile1i((int)(maxMiningDistance.Value * Main.excavatorMaxReachMultiplier.Value)); minMiningDistance = new RelTile1i((int)(minMiningDistance.Value * Main.excavatorMinReachMultiplier.Value));
Console.WriteLine("Min distance: {0}, max distance: {1}", minMiningDistance, maxMiningDistance); maxMiningDistance = new RelTile1i((int)(maxMiningDistance.Value * Main.excavatorMaxReachMultiplier.Value));
} Console.WriteLine("Min distance: {0}, max distance: {1}", minMiningDistance, maxMiningDistance);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TruckProtoBuilder.TruckProtoBuilderState), "SetCapacity")] [HarmonyPrefix]
static void truckCapacityMultiplier(ref int quantity) { [HarmonyPatch(typeof(TruckProtoBuilder.TruckProtoBuilderState), "SetCapacity")]
// Console.WriteLine("IndustrialCyka: Old truck capacity: {0}", quantity); static void truckCapacityMultiplier(ref int quantity) {
quantity *= Main.truckCapacityMultiplier.Value; // Console.WriteLine("IndustrialCyka: Old truck capacity: {0}", quantity);
// Console.WriteLine("IndustrialCyka: New truck capacity: {0}", quantity); quantity *= Main.truckCapacityMultiplier.Value;
} // Console.WriteLine("IndustrialCyka: New truck capacity: {0}", quantity);
}
// [HarmonyPrefix]
// [HarmonyPatch(typeof(StorageProtoBuilder.State), "SetCapacity")] // [HarmonyPrefix]
// static void storageCapacityMultiplier(ref int capacity) { // [HarmonyPatch(typeof(StorageProtoBuilder.State), "SetCapacity")]
// // Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", capacity); // static void storageCapacityMultiplier(ref int capacity) {
// capacity = (int)(capacity * Main.storageCapacityMultiplier.Value); // // Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", capacity);
// // Console.WriteLine("IndustrialCyka: New storage capacity: {0}", capacity); // capacity = (int)(capacity * Main.storageCapacityMultiplier.Value);
// } // // Console.WriteLine("IndustrialCyka: New storage capacity: {0}", capacity);
// }
[HarmonyPostfix]
[HarmonyPatch(typeof(CargoShipModuleProto), MethodType.Constructor, [HarmonyPostfix]
new[] { [HarmonyPatch(typeof(CargoShipModuleProto), MethodType.Constructor,
typeof(Proto.ID), typeof(Proto.Str), typeof(ProductType), typeof(Quantity), new[] {
typeof(CargoShipModuleProto.Gfx) typeof(Proto.ID), typeof(Proto.Str), typeof(ProductType), typeof(Quantity),
})] typeof(CargoShipModuleProto.Gfx)
static void cargoShipCapacityMultiplier(CargoShipModuleProto __instance) { })]
// Console.WriteLine("IndustrialCyka: Old ship capacity: {0}", __instance.Capacity.Value); static void cargoShipCapacityMultiplier(CargoShipModuleProto __instance) {
__instance.Capacity = new Quantity(__instance.Capacity.Value * Main.cargoShipCapacityMultiplier.Value); // Console.WriteLine("IndustrialCyka: Old ship capacity: {0}", __instance.Capacity.Value);
// Console.WriteLine("IndustrialCyka: New ship capacity: {0}", __instance.Capacity.Value); __instance.Capacity = new Quantity(__instance.Capacity.Value * Main.cargoShipCapacityMultiplier.Value);
} // Console.WriteLine("IndustrialCyka: New ship capacity: {0}", __instance.Capacity.Value);
}
// No workey... idk how it's supposed to work, speed is always 1 or 100%
// [HarmonyPrefix] // No workey... idk how it's supposed to work, speed is always 1 or 100%
// [HarmonyPatch(typeof(DrivingEntity), "SetSpeedFactor")] // [HarmonyPrefix]
// static void vehicleSpeedMultiplier(ref Percent speedFactor) { // [HarmonyPatch(typeof(DrivingEntity), "SetSpeedFactor")]
// // Console.WriteLine("IndustrialCyka: Old speed: {0}", speedFactor.ToString()); // static void vehicleSpeedMultiplier(ref Percent speedFactor) {
// // typeof(Percent) // // Console.WriteLine("IndustrialCyka: Old speed: {0}", speedFactor.ToString());
// // .GetField("RawValue",BindingFlags.Instance|BindingFlags.NonPublic) // // typeof(Percent)
// // .SetValue(speedFactor,speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value); // // .GetField("RawValue",BindingFlags.Instance|BindingFlags.NonPublic)
// Percent newSpeedFactor = Percent.FromFloat(speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value); // // .SetValue(speedFactor,speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value);
// speedFactor = newSpeedFactor; // Percent newSpeedFactor = Percent.FromFloat(speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value);
// // Console.WriteLine("IndustrialCyka: New speed: {1}", newSpeedFactor.RawValue.ToString()); // speedFactor = newSpeedFactor;
// } // // Console.WriteLine("IndustrialCyka: New speed: {1}", newSpeedFactor.RawValue.ToString());
// }
// [HarmonyPostfix]
// [HarmonyPatch(typeof(SmoothDriver), "SetSpeedFactor")] // [HarmonyPostfix]
// static void vehicleSpeedMultiplier(SmoothDriver __instance) { // [HarmonyPatch(typeof(SmoothDriver), "SetSpeedFactor")]
// Fix32 speedMulti = Fix32.FromFloat(Main.vehicleSpeedMultiplier.Value); // static void vehicleSpeedMultiplier(SmoothDriver __instance) {
// // Fix32 speedMulti = Fix32.FromFloat(Main.vehicleSpeedMultiplier.Value);
// Traverse traverse = Traverse.Create(__instance); //
// Traverse maxForwardsSpeedField = traverse.Field("m_maxForwardsSpeed"); // Traverse traverse = Traverse.Create(__instance);
// Traverse maxBackwardsSpeedField = traverse.Field("m_maxBackwardsSpeed"); // Traverse maxForwardsSpeedField = traverse.Field("m_maxForwardsSpeed");
// Traverse maxAccelerationField = traverse.Field("m_maxAcceleration"); // Traverse maxBackwardsSpeedField = traverse.Field("m_maxBackwardsSpeed");
// // Traverse maxAccelerationField = traverse.Field("m_maxAcceleration");
// // Console.WriteLine("IndustrialCyka: Old speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(), //
// // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue()); // // Console.WriteLine("IndustrialCyka: Old speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(),
// // // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue());
// maxForwardsSpeedField.SetValue((Fix32)maxForwardsSpeedField.GetValue() * speedMulti); //
// maxBackwardsSpeedField.SetValue((Fix32)maxBackwardsSpeedField.GetValue() * speedMulti); // maxForwardsSpeedField.SetValue((Fix32)maxForwardsSpeedField.GetValue() * speedMulti);
// maxAccelerationField.SetValue((Fix32)maxAccelerationField.GetValue() * speedMulti); // maxBackwardsSpeedField.SetValue((Fix32)maxBackwardsSpeedField.GetValue() * speedMulti);
// // maxAccelerationField.SetValue((Fix32)maxAccelerationField.GetValue() * speedMulti);
// // Console.WriteLine("IndustrialCyka: New speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(), //
// // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue()); // // Console.WriteLine("IndustrialCyka: New speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(),
// } // // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue());
// }
[HarmonyPostfix]
[HarmonyPatch(typeof(StorageBaseProto), MethodType.Constructor, [HarmonyPostfix]
new[] { [HarmonyPatch(typeof(StorageBaseProto), MethodType.Constructor,
typeof(StaticEntityProto.ID), new[] {
typeof(Proto.Str), typeof(StaticEntityProto.ID),
typeof(EntityLayout), typeof(Proto.Str),
typeof(Quantity), typeof(EntityLayout),
typeof(EntityCosts), typeof(Quantity),
typeof(LayoutEntityProto.Gfx), typeof(EntityCosts),
typeof(Quantity), typeof(LayoutEntityProto.Gfx),
typeof(Duration), typeof(Quantity),
typeof(IEnumerable<Tag>) typeof(Duration),
})] typeof(IEnumerable<Tag>)
static void storageCapacityMultiplier(StorageProto __instance) { })]
// Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", __instance.Capacity.Value); static void storageCapacityMultiplier(StorageProto __instance) {
// Console.WriteLine("IndustrialCyka: Old storage transfer limit: {0}", __instance.TransferLimit.Value); // Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", __instance.Capacity.Value);
Traverse traverse = Traverse.Create(__instance); // Console.WriteLine("IndustrialCyka: Old storage transfer limit: {0}", __instance.TransferLimit.Value);
Traverse traverse = Traverse.Create(__instance);
traverse.Field("Capacity")
.SetValue(new Quantity((int)(__instance.Capacity.Value * Main.storageCapacityMultiplier.Value))); traverse.Field("Capacity")
traverse.Field("TransferLimit").SetValue(new Quantity(10000)); .SetValue(new Quantity((int)(__instance.Capacity.Value * Main.storageCapacityMultiplier.Value)));
traverse.Field("TransferLimitDuration").SetValue(Duration.FromTicks(1)); traverse.Field("TransferLimit").SetValue(new Quantity(10000));
traverse.Field("TransferLimitDuration").SetValue(Duration.FromTicks(1));
// Console.WriteLine("IndustrialCyka: New storage capacity: {0}", __instance.Capacity.Value);
// Console.WriteLine("IndustrialCyka: New storage transfer limit: {0}", __instance.TransferLimit.Value); // Console.WriteLine("IndustrialCyka: New storage capacity: {0}", __instance.Capacity.Value);
} // Console.WriteLine("IndustrialCyka: New storage transfer limit: {0}", __instance.TransferLimit.Value);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UpointsManager), "GenerateUnity")] [HarmonyPrefix]
static void unityGenerationMultiplier(Proto.ID categoryId, ref Upoints generated) { [HarmonyPatch(typeof(UpointsManager), "GenerateUnity")]
// Console.WriteLine("IndustrialCyka: Old generated {0} unity", generated.Value); static void unityGenerationMultiplier(Proto.ID categoryId, ref Upoints generated) {
Fix32 multi = Fix32.FromFloat(Main.unityGenerationMultiplier.Value); // Console.WriteLine("IndustrialCyka: Old generated {0} unity", generated.Value);
generated = new Upoints(generated.Value * multi); Fix32 multi = Fix32.FromFloat(Main.unityGenerationMultiplier.Value);
// Console.WriteLine("IndustrialCyka: New generated {0} unity", generated.Value); generated = new Upoints(generated.Value * multi);
} // Console.WriteLine("IndustrialCyka: New generated {0} unity", generated.Value);
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(Machine), "updateWorkOnRecipes")] [HarmonyTranspiler]
static IEnumerable<CodeInstruction> unityBooster(IEnumerable<CodeInstruction> instructions) { [HarmonyPatch(typeof(Machine), "updateWorkOnRecipes")]
Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>(); static IEnumerable<CodeInstruction> unityBooster(IEnumerable<CodeInstruction> instructions) {
matchTable[0] = OpCodes.Ldsfld; Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>();
matchTable[1] = OpCodes.Br; matchTable[0] = OpCodes.Ldsfld;
matchTable[2] = OpCodes.Ldc_I4_2; matchTable[1] = OpCodes.Br;
int matches = 0; matchTable[2] = OpCodes.Ldc_I4_2;
int totalMatch = matchTable.Count; int matches = 0;
int totalMatch = matchTable.Count;
var codes = new List<CodeInstruction>(instructions);
for (int i = 0; i < codes.Count; i++) { var codes = new List<CodeInstruction>(instructions);
if (matches >= totalMatch) { for (int i = 0; i < codes.Count; i++) {
break; if (matches >= totalMatch) {
} break;
}
if (codes[i].opcode.Equals(matchTable[matches])) {
if (matches == totalMatch - 1) { if (codes[i].opcode.Equals(matchTable[matches])) {
codes[i].opcode = OpCodes.Ldc_I4_6; if (matches == totalMatch - 1) {
} codes[i].opcode = OpCodes.Ldc_I4_6;
}
matches++;
} matches++;
} }
}
// for (int i = 0; i < codes.Count; i++) {
// Console.WriteLine(codes[i].ToString()); // for (int i = 0; i < codes.Count; i++) {
// } // Console.WriteLine(codes[i].ToString());
// }
return codes.AsEnumerable();
} return codes.AsEnumerable();
}
// Could not make this work either... idk why... Doesn't make sense...
// [HarmonyPostfix] // Could not make this work either... idk why... Doesn't make sense...
// [HarmonyPatch(typeof(SimpleVirtualResource), "MineResourceAt")] // [HarmonyPostfix]
// static void infiniteGroundResources(SimpleVirtualResource __instance) { // [HarmonyPatch(typeof(SimpleVirtualResource), "MineResourceAt")]
// // Console.WriteLine("IndustrialCyka: Patching ground resources (Capacity)"); // static void infiniteGroundResources(SimpleVirtualResource __instance) {
// Traverse traverse = Traverse.Create(__instance); // // Console.WriteLine("IndustrialCyka: Patching ground resources (Capacity)");
// Traverse capacityField = traverse.Field("Capacity"); // Traverse traverse = Traverse.Create(__instance);
// capacityField.SetValue(1000000000); // Traverse capacityField = traverse.Field("Capacity");
// Traverse quantityField = traverse.Field("Quantity"); // capacityField.SetValue(1000000000);
// quantityField.SetValue(1000000000); // Traverse quantityField = traverse.Field("Quantity");
// } // quantityField.SetValue(1000000000);
// }
[HarmonyPrefix]
[HarmonyPatch(typeof(ProductBuffer), "ForceNewCapacityTo")] [HarmonyPrefix]
static void bufferCapacityMultiplier(ref Quantity newCapacity) { [HarmonyPatch(typeof(ProductBuffer), "ForceNewCapacityTo")]
if (newCapacity.Value <= 0) { static void bufferCapacityMultiplier(ref Quantity newCapacity) {
return; if (newCapacity.Value <= 0) {
} return;
}
Quantity newNewCapacity = new Quantity((int)(newCapacity.Value * Main.bufferCapacityMultiplier.Value));
newCapacity = newNewCapacity; Quantity newNewCapacity = new Quantity((int)(newCapacity.Value * Main.bufferCapacityMultiplier.Value));
} newCapacity = newNewCapacity;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CargoDepotModuleProto), MethodType.Constructor, [HarmonyPostfix]
new[] { [HarmonyPatch(typeof(CargoDepotModuleProto), MethodType.Constructor,
typeof(CargoDepotModuleProto.ID), new[] {
typeof(Proto.Str), typeof(CargoDepotModuleProto.ID),
typeof(EntityLayout), typeof(Proto.Str),
typeof(ProductType), typeof(EntityLayout),
typeof(Option<CargoDepotModuleProto>), typeof(ProductType),
typeof(Quantity), typeof(Option<CargoDepotModuleProto>),
typeof(Quantity), typeof(Quantity),
typeof(Duration), typeof(Quantity),
typeof(Electricity), typeof(Duration),
typeof(bool), typeof(Electricity),
typeof(Percent), typeof(bool),
typeof(EntityCosts), typeof(Percent),
typeof(CargoDepotModuleProto.Gfx), typeof(EntityCosts),
typeof(IEnumerable<Tag>), typeof(CargoDepotModuleProto.Gfx),
})] typeof(IEnumerable<Tag>),
static void depotTransferSpeedMultiplier(CargoDepotModuleProto __instance) { })]
// Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", __instance.Capacity.Value); static void depotTransferSpeedMultiplier(CargoDepotModuleProto __instance) {
Traverse traverse = Traverse.Create(__instance); // Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", __instance.Capacity.Value);
Traverse traverse = Traverse.Create(__instance);
traverse.Field("QuantityPerExchange")
.SetValue(new Quantity((int)(__instance.QuantityPerExchange.Value * traverse.Field("QuantityPerExchange")
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, [HarmonyPostfix]
new[] { [HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
typeof(EntityProto.ID), new[] {
typeof(Proto.Str), typeof(EntityProto.ID),
typeof(ProductQuantity), typeof(Proto.Str),
typeof(Duration), typeof(ProductQuantity),
typeof(Upoints), typeof(Duration),
typeof(UpointsCategoryProto), typeof(Upoints),
typeof(EntityCosts), typeof(UpointsCategoryProto),
typeof(Func<int, EntityCosts>), typeof(EntityCosts),
typeof(int), typeof(Func<int, EntityCosts>),
typeof(Quantity), typeof(int),
typeof(WorldMapEntityProto.Gfx), typeof(Quantity),
typeof(int), typeof(WorldMapEntityProto.Gfx),
typeof(int), typeof(int),
typeof(IEnumerable<Tag>), typeof(int),
})] typeof(IEnumerable<Tag>),
static void worldMineSpeedMultiplier(WorldMapMineProto __instance) { })]
// Console.WriteLine("Before: {0}", __instance.ProducedProductPerStep.Quantity.Value); static void worldMineSpeedMultiplier(WorldMapMineProto __instance) {
ProductQuantity newProductQuantity = new ProductQuantity(__instance.ProducedProductPerStep.Product, // Console.WriteLine("Before: {0}", __instance.ProducedProductPerStep.Quantity.Value);
new Quantity((int)(__instance.ProducedProductPerStep.Quantity.Value * ProductQuantity newProductQuantity = new ProductQuantity(__instance.ProducedProductPerStep.Product,
Main.worldMineSpeedMultiplier.Value))); new Quantity((int)(__instance.ProducedProductPerStep.Quantity.Value *
Main.worldMineSpeedMultiplier.Value)));
Traverse.Create(__instance)
.Field("ProducedProductPerStep") Traverse.Create(__instance)
.SetValue(newProductQuantity); .Field("ProducedProductPerStep")
// Console.WriteLine("After: {0}", __instance.ProducedProductPerStep.Quantity.Value); .SetValue(newProductQuantity);
} // Console.WriteLine("After: {0}", __instance.ProducedProductPerStep.Quantity.Value);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor, [HarmonyPostfix]
new[] { [HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
typeof(EntityProto.ID), new[] {
typeof(Proto.Str), typeof(EntityProto.ID),
typeof(ProductQuantity), typeof(Proto.Str),
typeof(Duration), typeof(ProductQuantity),
typeof(Upoints), typeof(Duration),
typeof(UpointsCategoryProto), typeof(Upoints),
typeof(EntityCosts), typeof(UpointsCategoryProto),
typeof(Func<int, EntityCosts>), typeof(EntityCosts),
typeof(int), typeof(Func<int, EntityCosts>),
typeof(Quantity), typeof(int),
typeof(WorldMapEntityProto.Gfx), typeof(Quantity),
typeof(int), typeof(WorldMapEntityProto.Gfx),
typeof(int), typeof(int),
typeof(IEnumerable<Tag>), typeof(int),
})] typeof(IEnumerable<Tag>),
static void worldMineLevelIncrementMultiplier(WorldMapMineProto __instance) { })]
Traverse traverse = Traverse.Create(__instance); static void worldMineLevelIncrementMultiplier(WorldMapMineProto __instance) {
Traverse traverse = Traverse.Create(__instance);
// int level = traverse.Field("Level").GetValue<int>();
int maxLevel = traverse.Field("MaxLevel").GetValue<int>(); // int level = traverse.Field("Level").GetValue<int>();
// int levelsPerUpgrade = traverse.Field("LevelsPerUpgrade").GetValue<int>(); int maxLevel = traverse.Field("MaxLevel").GetValue<int>();
// int levelsPerUpgrade = traverse.Field("LevelsPerUpgrade").GetValue<int>();
int newLevelsPerUpgrade = 10;
int newMaxLevel = (int)Math.Ceiling((double)maxLevel / newLevelsPerUpgrade) * newLevelsPerUpgrade; int newLevelsPerUpgrade = 10;
int newMaxLevel = (int)Math.Ceiling((double)maxLevel / newLevelsPerUpgrade) * newLevelsPerUpgrade;
// Console.WriteLine("Level: {0}, MaxLevel: {1}, LevelsPerUpgrade: {2}", level, maxLevel, levelsPerUpgrade);
// Console.WriteLine("NewMaxLevel: {0}", newMaxLevel); // Console.WriteLine("Level: {0}, MaxLevel: {1}, LevelsPerUpgrade: {2}", level, maxLevel, levelsPerUpgrade);
// Console.WriteLine("NewMaxLevel: {0}", newMaxLevel);
traverse.Field("MaxLevel").SetValue(newMaxLevel);
traverse.Field("LevelsPerUpgrade").SetValue(newLevelsPerUpgrade); traverse.Field("MaxLevel").SetValue(newMaxLevel);
} traverse.Field("LevelsPerUpgrade").SetValue(newLevelsPerUpgrade);
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor, [HarmonyTranspiler]
new[] { [HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
typeof(EntityProto.ID), new[] {
typeof(Proto.Str), typeof(EntityProto.ID),
typeof(ProductQuantity), typeof(Proto.Str),
typeof(Duration), typeof(ProductQuantity),
typeof(Upoints), typeof(Duration),
typeof(UpointsCategoryProto), typeof(Upoints),
typeof(EntityCosts), typeof(UpointsCategoryProto),
typeof(Func<int, EntityCosts>), typeof(EntityCosts),
typeof(int), typeof(Func<int, EntityCosts>),
typeof(Quantity), typeof(int),
typeof(WorldMapEntityProto.Gfx), typeof(Quantity),
typeof(int), typeof(WorldMapEntityProto.Gfx),
typeof(int), typeof(int),
typeof(IEnumerable<Tag>), typeof(int),
})] typeof(IEnumerable<Tag>),
static IEnumerable<CodeInstruction> cookWorldMineLevelIncrementMultiplier( })]
IEnumerable<CodeInstruction> instructions) { static IEnumerable<CodeInstruction> cookWorldMineLevelIncrementMultiplier(
Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>(); IEnumerable<CodeInstruction> instructions) {
matchTable[0] = OpCodes.Rem; Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>();
matchTable[1] = OpCodes.Ldfld; matchTable[0] = OpCodes.Rem;
matchTable[2] = OpCodes.Ldarg_0; matchTable[1] = OpCodes.Ldfld;
matchTable[3] = OpCodes.Ldfld; matchTable[2] = OpCodes.Ldarg_0;
matchTable[4] = OpCodes.Ldarg_0; matchTable[3] = OpCodes.Ldfld;
int matches = 0; matchTable[4] = OpCodes.Ldarg_0;
int totalMatch = matchTable.Count; int matches = 0;
int totalMatch = matchTable.Count;
var codes = new List<CodeInstruction>(instructions);
for (int i = codes.Count - 1; i >= 0; i--) { var codes = new List<CodeInstruction>(instructions);
if (matches >= totalMatch) { for (int i = codes.Count - 1; i >= 0; i--) {
break; if (matches >= totalMatch) {
} break;
}
if (codes[i].opcode.Equals(matchTable[matches])) {
if (matches == totalMatch - 1) { if (codes[i].opcode.Equals(matchTable[matches])) {
codes[i + 4].opcode = OpCodes.Add; if (matches == totalMatch - 1) {
codes[i + 5].opcode = OpCodes.Brtrue_S; codes[i + 4].opcode = OpCodes.Add;
break; codes[i + 5].opcode = OpCodes.Brtrue_S;
} break;
}
matches++;
} matches++;
else { }
matches = 0; else {
} matches = 0;
} }
}
return codes.AsEnumerable();
} return codes.AsEnumerable();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SettlementHousingModuleProto), MethodType.Constructor, new[] { [HarmonyPostfix]
typeof(StaticEntityProto.ID), [HarmonyPatch(typeof(SettlementHousingModuleProto), MethodType.Constructor, new[] {
typeof(Proto.Str), typeof(StaticEntityProto.ID),
typeof(EntityLayout), typeof(Proto.Str),
typeof(EntityCosts), typeof(EntityLayout),
typeof(int), typeof(EntityCosts),
typeof(Upoints), typeof(int),
typeof(ImmutableArray<KeyValuePair<ImmutableArray<PopNeedProto>, Percent>>), typeof(Upoints),
typeof(IReadOnlyDictionary<PopNeedProto, Percent>), typeof(ImmutableArray<KeyValuePair<ImmutableArray<PopNeedProto>, Percent>>),
typeof(Option<SettlementHousingModuleProto>), typeof(IReadOnlyDictionary<PopNeedProto, Percent>),
typeof(SettlementHousingModuleProto.Gfx), typeof(Option<SettlementHousingModuleProto>),
})] typeof(SettlementHousingModuleProto.Gfx),
static void housingCapacityMultiplier(SettlementHousingModuleProto __instance) { })]
Traverse.Create(__instance).Field<int>("Capacity").Value = static void housingCapacityMultiplier(SettlementHousingModuleProto __instance) {
(int)(__instance.Capacity * Main.housingCapacityMultiplier.Value); Traverse.Create(__instance).Field<int>("Capacity").Value =
} (int)(__instance.Capacity * Main.housingCapacityMultiplier.Value);
}
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(StackerProto), MethodType.Constructor, new[] { [HarmonyPatch(typeof(StackerProto), MethodType.Constructor, new[] {
typeof(StaticEntityProto.ID), typeof(StaticEntityProto.ID),
typeof(Proto.Str), typeof(Proto.Str),
typeof(EntityLayout), typeof(EntityLayout),
typeof(EntityCosts), typeof(EntityCosts),
typeof(Electricity), typeof(Electricity),
typeof(ThicknessTilesI), typeof(ThicknessTilesI),
typeof(RelTile3i), typeof(RelTile3i),
typeof(Duration), typeof(Duration),
typeof(Duration), typeof(Duration),
typeof(StackerProto.Gfx), typeof(StackerProto.Gfx),
typeof(ThicknessTilesI), typeof(ThicknessTilesI),
typeof(IEnumerable<Tag>), typeof(IEnumerable<Tag>),
})] })]
static void dumpDelayMultiplier(StackerProto __instance) { static void dumpDelayMultiplier(StackerProto __instance) {
Duration newDelay = Duration newDelay =
new Duration(Math.Max((int)(__instance.DumpDelay.Ticks * Main.dumpDelayMultiplier.Value), 1)); new Duration(Math.Max((int)(__instance.DumpDelay.Ticks * Main.dumpDelayMultiplier.Value), 1));
Traverse.Create(__instance).Field("DumpDelay").SetValue(newDelay); Traverse.Create(__instance).Field("DumpDelay").SetValue(newDelay);
} }
[HarmonyPrefix]
[HarmonyPrefix] [HarmonyPatch(typeof(TransportProto), MethodType.Constructor, new[] {
[HarmonyPatch(typeof(TransportProto), MethodType.Constructor, new[] { typeof(StaticEntityProto.ID),
typeof(StaticEntityProto.ID), typeof(Proto.Str),
typeof(Proto.Str), typeof(ThicknessTilesF),
typeof(ThicknessTilesF), typeof(Quantity),
typeof(Quantity), typeof(RelTile1f),
typeof(RelTile1f), typeof(RelTile1f),
typeof(RelTile1f), typeof(RelTile1i),
typeof(RelTile1i), typeof(bool),
typeof(bool), typeof(bool),
typeof(bool), typeof(Option<TerrainTileSurfaceProto>),
typeof(Option<TerrainTileSurfaceProto>), typeof(RelTile1i),
typeof(RelTile1i), typeof(IoPortShapeProto),
typeof(IoPortShapeProto), typeof(Electricity),
typeof(Electricity), typeof(Percent),
typeof(Percent), typeof(bool),
typeof(bool), typeof(bool),
typeof(bool), typeof(EntityCosts),
typeof(EntityCosts), typeof(RelTile1i),
typeof(RelTile1i), typeof(Duration),
typeof(Duration), typeof(Option<TransportProto>),
typeof(Option<TransportProto>), typeof(VirtualProductProto),
typeof(VirtualProductProto), typeof(Quantity),
typeof(Quantity), typeof(TransportProto.Gfx),
typeof(TransportProto.Gfx), })]
})] static void transportSpeedMultiplier(ref StaticEntityProto.ID id, ref Proto.Str strings,
static void transportSpeedMultiplier(ref StaticEntityProto.ID id, ref Proto.Str strings, ref ThicknessTilesF surfaceRelativeHeight, ref Quantity maxQuantityPerTransportedProduct,
ref ThicknessTilesF surfaceRelativeHeight, ref Quantity maxQuantityPerTransportedProduct, ref RelTile1f transportedProductsSpacing, ref RelTile1f speedPerTick, ref RelTile1i zStepLength,
ref RelTile1f transportedProductsSpacing, ref RelTile1f speedPerTick, ref RelTile1i zStepLength, ref bool needsPillarsAtGround, ref bool canBeBuried,
ref bool needsPillarsAtGround, ref bool canBeBuried, ref Option<TerrainTileSurfaceProto> tileSurfaceWhenOnGround, ref RelTile1i maxPillarSupportRadius,
ref Option<TerrainTileSurfaceProto> tileSurfaceWhenOnGround, ref RelTile1i maxPillarSupportRadius, ref IoPortShapeProto portsShape, ref Electricity baseElectricityCost, ref Percent cornersSharpnessPercent,
ref IoPortShapeProto portsShape, ref Electricity baseElectricityCost, ref Percent cornersSharpnessPercent, ref bool allowMixedProducts, ref bool isBuildable, ref EntityCosts costs, ref RelTile1i lengthPerCost,
ref bool allowMixedProducts, ref bool isBuildable, ref EntityCosts costs, ref RelTile1i lengthPerCost, ref Duration constructionDurationPerProduct, ref Option<TransportProto> nextTier,
ref Duration constructionDurationPerProduct, ref Option<TransportProto> nextTier, ref VirtualProductProto maintenanceProduct, Quantity maintenancePerTile, ref TransportProto.Gfx graphics) {
ref VirtualProductProto maintenanceProduct, Quantity maintenancePerTile, ref TransportProto.Gfx graphics) { if (TransportPillarProto.MAX_PILLAR_HEIGHT.Value < 25)
if (TransportPillarProto.MAX_PILLAR_HEIGHT.Value < 25) typeof(TransportPillarProto).GetField("MAX_PILLAR_HEIGHT").SetValue(null, new ThicknessTilesI(25));
typeof(TransportPillarProto).GetField("MAX_PILLAR_HEIGHT").SetValue(null, new ThicknessTilesI(25)); if (IoPort.MAX_TRANSFER_PER_TICK.Value < 10000)
if (IoPort.MAX_TRANSFER_PER_TICK.Value < 10000) typeof(IoPort).GetField("MAX_TRANSFER_PER_TICK").SetValue(null, new Quantity(10000));
typeof(IoPort).GetField("MAX_TRANSFER_PER_TICK").SetValue(null, new Quantity(10000));
maxQuantityPerTransportedProduct *= 1000;
maxQuantityPerTransportedProduct *= 1000; maxQuantityPerTransportedProduct = maxQuantityPerTransportedProduct.Min(new Quantity(10000));
maxQuantityPerTransportedProduct = maxQuantityPerTransportedProduct.Min(new Quantity(10000)); Console.WriteLine("maxQuantityPerTransportedProduct {0}", maxQuantityPerTransportedProduct);
Console.WriteLine("maxQuantityPerTransportedProduct {0}", maxQuantityPerTransportedProduct);
speedPerTick *= 10;
speedPerTick *= 10; transportedProductsSpacing = speedPerTick;
transportedProductsSpacing = speedPerTick; zStepLength = RelTile1i.One;
zStepLength = RelTile1i.One; canBeBuried = true;
canBeBuried = true; maxPillarSupportRadius = new RelTile1i(8);
maxPillarSupportRadius = new RelTile1i(8); }
}
} [HarmonyPostfix]
} [HarmonyPatch(typeof(ShipyardProto), MethodType.Constructor, new[] {
typeof(StaticEntityProto.ID),
typeof(Proto.Str),
typeof(EntityLayout),
typeof(EntityCosts),
typeof(bool),
typeof(Quantity),
typeof(Option<ShipyardProto>),
typeof(ImmutableArray<ImmutableArray<RectangleTerrainArea2iRelative>>),
typeof(StackerProto.Gfx),
typeof(ImmutableArray<String>),
typeof(bool),
})]
static void shipyardCargoMultiplier(ShipyardProto __instance) {
Traverse.Create(__instance).Field("CargoCapacity").SetValue(new Quantity(
(int)(__instance.CargoCapacity.Value * Main.shipyardCargoMultiplier.Value)));
}
}
}