From 09cdaf3a12d0b91a335a6926baaaad4054956602 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Thu, 30 Oct 2025 16:02:45 +0800 Subject: [PATCH] balance tweaks --- LogisticHub/LogisticHub.cs | 20 +++++++++++--------- LogisticHub/Module/Miner.cs | 31 +++++++++++++++++++------------ 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/LogisticHub/LogisticHub.cs b/LogisticHub/LogisticHub.cs index 9d1293b..37110f5 100644 --- a/LogisticHub/LogisticHub.cs +++ b/LogisticHub/LogisticHub.cs @@ -19,19 +19,21 @@ public class LogisticHub : BaseUnityPlugin { Module.Miner.Enabled = Config.Bind("Miner", "Enabled", true, "enable/disable this plugin"); Module.Miner.OreEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForOre", 2000000L, - "Energy consumption for each ore vein group(in 0.5W)"); - Module.Miner.OilEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForOil", 3600000L, - "Energy consumption for each oil seep(in 0.5W)"); - Module.Miner.WaterEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForWater", 2000000L, - "Energy consumption for water slot(in kW)"); - Module.Miner.WaterSpeed = Config.Bind("Miner", "WaterMiningSpeed", 10, - "Water mining speed (count per second)"); - Module.Miner.MiningScale = Config.Bind("Miner", "MiningScale", 0, + "Energy consumption for each ore vein group(in W)"); + Module.Miner.OreMiningMultiplier = Config.Bind("Miner", "OreMiningMultiplier", 3, + new ConfigDescription("Mining multiplier for ore veins, multiplies to the number of veins in the group", new AcceptableValueRange(1, 100))); + Module.Miner.OreMiningScale = Config.Bind("Miner", "OreMiningScale", 100, """ - 0 for Auto(which means having researched makes mining scale 300, otherwise 100). + 0 for Auto(which means having researched advanced mining machine makes mining scale 300, otherwise 100). Mining scale(in percents) for slots below half of slot limits, and the scale reduces to 100% smoothly till reach full. Please note that the power consumption increases by the square of the scale which is the same as Advanced Mining Machine. """); + Module.Miner.OilEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForOil", 1800000L, + "Energy consumption for each oil seep(in W)"); + Module.Miner.WaterEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForWater", 2000000L, + "Energy consumption for water slot(in W)"); + Module.Miner.WaterSpeed = Config.Bind("Miner", "WaterMiningSpeed", 10, + "Water mining speed (count per second)"); Module.Miner.FuelIlsSlot = Config.Bind("Miner", "ILSFuelSlot", 4, new ConfigDescription("Fuel slot for ILS, set 0 to disable.", new AcceptableValueRange(0, 5))); Module.Miner.FuelPlsSlot = Config.Bind("Miner", "PLSFuelSlot", 4, diff --git a/LogisticHub/Module/Miner.cs b/LogisticHub/Module/Miner.cs index 364160f..741969c 100644 --- a/LogisticHub/Module/Miner.cs +++ b/LogisticHub/Module/Miner.cs @@ -11,10 +11,11 @@ public class Miner : PatchImpl { public static ConfigEntry Enabled; public static ConfigEntry OreEnergyConsume; + public static ConfigEntry OreMiningScale; + public static ConfigEntry OreMiningMultiplier; public static ConfigEntry OilEnergyConsume; public static ConfigEntry WaterEnergyConsume; public static ConfigEntry WaterSpeed; - public static ConfigEntry MiningScale; public static ConfigEntry FuelIlsSlot; public static ConfigEntry FuelPlsSlot; @@ -23,6 +24,8 @@ public class Miner : PatchImpl private static long _miningFrames; private static long _miningSpeedScaleLong; private static bool _advancedMiningMachineUnlocked; + private static int _miningMultiplier = 3; + private static int _miningScale = 100; private static uint _miningCostBarrier; private static uint _miningCostBarrierOil; private static int[] _mineIndex; @@ -90,6 +93,15 @@ public class Miner : PatchImpl private static void CheckRecipes() { _advancedMiningMachineUnlocked = GameMain.history.recipeUnlocked.Contains(119); + _miningMultiplier = OreMiningMultiplier.Value; + if (OreMiningScale.Value == 0) + { + _miningScale = _advancedMiningMachineUnlocked ? 300 : 100; + } + else + { + _miningScale = OreMiningScale.Value; + } } private static void UpdateMiningCostRate() @@ -163,11 +175,7 @@ public class Miner : PatchImpl if (storage.count >= storage.max) continue; int amount; long energyConsume; - var miningScale = MiningScale.Value; - if (miningScale == 0) - { - miningScale = _advancedMiningMachineUnlocked ? 300 : 100; - } + var miningScale = _miningScale; if (miningScale > 100 && storage.count * 2 > storage.max) { miningScale = 100 + ((miningScale - 100) * (storage.max - storage.count) * 2 + storage.max - 1) / storage.max; @@ -175,7 +183,7 @@ public class Miner : PatchImpl if (itemIndex > 0) { - (amount, energyConsume) = Mine(factory, veins, itemId, miningScale, (int)frameCounter, station.energy); + (amount, energyConsume) = Mine(factory, veins, itemId, miningScale, (int)frameCounter, _miningMultiplier, station.energy); if (amount < 0) continue; } else @@ -242,7 +250,7 @@ public class Miner : PatchImpl } } - private static (int, long) Mine(PlanetFactory factory, ProductVeinData[] allVeins, int productId, int percent, int counter, long energyMax) + private static (int, long) Mine(PlanetFactory factory, ProductVeinData[] allVeins, int productId, int percent, int counter, int multiplier, long energyMax) { var veins = allVeins[productId - 1000]; if (veins == null) @@ -257,7 +265,7 @@ public class Miner : PatchImpl /* if is Oil */ if (productId == 1007) { - energy = (OilEnergyConsume.Value * length * percent * percent + 9999L) / 10000L; + energy = OilEnergyConsume.Value * length; if (energy > energyMax) return (-1, -1L); var countf = 0f; @@ -266,8 +274,7 @@ public class Miner : PatchImpl { countf += veinsPool[veinIndices[i]].amount * 4 * VeinData.oilSpeedMultiplier; } - - count = ((int)countf * counter * percent + 99) / 100; + count = (int)(countf * (counter * percent) / 100f); if (count == 0) return (-1, -1L); barrier = _miningCostBarrierOil; @@ -275,7 +282,7 @@ public class Miner : PatchImpl } else { - count = (length * counter * percent + 99) / 100; + count = (length * multiplier * counter * percent + 99) / 100; if (count == 0) return (-1, -1L); energy = (OreEnergyConsume.Value * veins.GroupCount * percent * percent + 9999L) / 10000L;