From 0de9f3c06a04e48b36505ec216be8ca7cf5260dd Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Tue, 12 Nov 2024 16:01:42 +0800 Subject: [PATCH] UXAssist release 1.2.8 --- UXAssist/CHANGELOG.md | 30 ++++++++++----- UXAssist/Patches/FactoryPatch.cs | 66 ++++++++++++++++++++++++-------- UXAssist/README.md | 6 +++ UXAssist/UXAssist.csproj | 2 +- UXAssist/package/manifest.json | 2 +- 5 files changed, 78 insertions(+), 28 deletions(-) diff --git a/UXAssist/CHANGELOG.md b/UXAssist/CHANGELOG.md index 80fe6fb..013b8a9 100644 --- a/UXAssist/CHANGELOG.md +++ b/UXAssist/CHANGELOG.md @@ -1,6 +1,12 @@ ## Changlog * 1.2.8 + + New feature: `Fast fill in to and take out from tanks` + - You can set multiplier for tanks' operation speed + - This affects manually fill in to and/or take out from tanks, as well as transfer from upper to lower level. + + Fixes to `Append mod profile name to game window title`: + - Fix a bug that window title is not set correctly when multiple instance is launched. + - Fix a bug that window title is not set correctly if BepInEx debug console is enabled. + `Real-time logistic stations info panel`: Fix a bug that item status bar appears unexpectedly. * 1.2.7 + Fix some minor issues @@ -12,6 +18,10 @@ + New feature: `Set process priority` + New feature: `Set enabled CPU threads` + `Drag building power poles in maximum connection range`: Add a new config option `Build Tesla Tower and Wireless Power Tower alternately` + +
+Older versions + * 1.2.4 + `Sunlight at night`: - Fix flickering issue while mecha is sailing. @@ -35,7 +45,7 @@ - This will change game running speed, down to 0.1x slower and up to 10x faster. - A pair of shortcut keys (`-` and `+`) to change the logical frame rate by -0.5x and +0.5x. - Note: - - High logical frame rate is not guaranteed to be stable, especially when factories are under heavy load. + - High logical frame rate is not guaranteed to be stable, especially when factories are under heavy load. - This will not affect some game animations. - When set game speed in mod `Auxilaryfunction`, this feature will be disabled. - When mod `BulletTime` is installed, this feature will be hidden, but patch `BulletTime`'s speed control, to make its maximum speed 10x. @@ -43,10 +53,6 @@ + `Real-time logistic stations info panel`: Fix a crash issue. + `Dyson Sphere "Auto Fast Build"`: Fix possible wrong production records. + Codes refactored, for better maintainability. - -
-Older versions - * 1.1.6 + New feature: `Scale up mouse cursor` - Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load. @@ -211,6 +217,12 @@ ## 更新日志 * 1.2.8 + + 新功能:`储液罐快速注入和抽取液体` + - 你可以设置储液罐操作速度的倍率 + - 影响手动注入和抽取,以及从储液罐上层传输到下层的速度 + + 在游戏窗口标题中追加mod配置档案名的修复: + - 修复了多实例启动时窗口标题未正确设置的问题 + - 修复了启用BepInEx调试控制台时窗口标题未正确设置的问题 + `物流运输站实时信息面板`:修复了一个物品状态条意外显示的问题 * 1.2.7 + 修复了一些小问题 @@ -222,6 +234,10 @@ + 新功能:`设置进程优先级` + 新功能:`设置使用的CPU线程` + `拖动建造电线杆时自动使用最大连接距离间隔`:添加一个新的设置项`交替建造电力感应塔和无线输电塔` + +
+更早的版本 + * 1.2.4 + `夜间日光灯`: - 修复了航行时闪烁的问题 @@ -253,10 +269,6 @@ + `物流运输站实时信息面板`:修复了一个崩溃问题 + `戴森球自动快速建造`:修复了可能出现的错误生产记录 + 代码重构,以获得更好的可维护性 - -
-更早的版本 - * 1.1.6 + 新功能:`放大鼠标指针` - 注意:这将启用软件指针模式,可能会在CPU负载较重时导致鼠标移动延迟 diff --git a/UXAssist/Patches/FactoryPatch.cs b/UXAssist/Patches/FactoryPatch.cs index 1709c51..3c20aa5 100644 --- a/UXAssist/Patches/FactoryPatch.cs +++ b/UXAssist/Patches/FactoryPatch.cs @@ -1203,7 +1203,7 @@ public class FactoryPatch : PatchImpl break; } - if (__instance.productCount > 0 && __instance.insertTarget > 0 && __instance.productId > 0) + if (__instance is { productCount: > 0, insertTarget: > 0, productId: > 0 }) { var multiplier = 36000000.0 / __instance.period * miningSpeed; if (__instance.type == EMinerType.Vein) @@ -1220,7 +1220,7 @@ public class FactoryPatch : PatchImpl var stack = __instance.productCount < count ? __instance.productCount : count; var outputCount = factory.InsertInto(__instance.insertTarget, 0, __instance.productId, (byte)stack, 0, out _); __instance.productCount -= outputCount; - if (__instance.productCount == 0 && __instance.type == EMinerType.Vein) + if (__instance is { productCount: 0, type: EMinerType.Vein }) { __instance.productId = 0; } @@ -1775,16 +1775,12 @@ public class FactoryPatch : PatchImpl private class TankFastFillInAndTakeOut : PatchImpl { - private static int GetRealCount() - { - return _tankFastFillInAndTakeOutMultiplierRealValue; - } - - private static int MultiplierWithCountCheck(int count) - { - return Math.Min(count, _tankFastFillInAndTakeOutMultiplierRealValue); - } - + private static readonly CodeInstruction[] MultiplierWithCountCheck = [ + new(OpCodes.Ldsfld, AccessTools.Field(typeof(FactoryPatch), nameof(_tankFastFillInAndTakeOutMultiplierRealValue))), + new(OpCodes.Call, AccessTools.Method(typeof(Math), nameof(Math.Min), [typeof(int), typeof(int)])) + ]; + private static readonly CodeInstruction GetRealCount = new(OpCodes.Ldsfld, AccessTools.Field(typeof(FactoryPatch), nameof(_tankFastFillInAndTakeOutMultiplierRealValue))); + [HarmonyTranspiler] [HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastFillIn))] private static IEnumerable PlanetFactory_EntityFastFillIn_Transpiler(IEnumerable instructions, ILGenerator generator) @@ -1794,14 +1790,14 @@ public class FactoryPatch : PatchImpl new CodeMatch(ci => ci.IsStloc()), new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(ci => ci.IsStloc()) - ).Advance(1).RemoveInstruction().InsertAndAdvance(Transpilers.EmitDelegate(GetRealCount)).MatchForward(false, + ).Advance(1).RemoveInstruction().InsertAndAdvance(GetRealCount).MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(ci => ci.Branches(out _)), new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(ci => ci.Branches(out _)), new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(ci => ci.IsStloc()) - ).RemoveInstructions(5).Insert(Transpilers.EmitDelegate(MultiplierWithCountCheck)); + ).RemoveInstructions(5).Insert(MultiplierWithCountCheck); return matcher.InstructionEnumeration(); } @@ -1815,14 +1811,14 @@ public class FactoryPatch : PatchImpl new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(OpCodes.Ldc_I4_0), new CodeMatch(ci => ci.opcode == OpCodes.Ldloca || ci.opcode == OpCodes.Ldloca_S) - ).Advance(1).RemoveInstruction().InsertAndAdvance(Transpilers.EmitDelegate(GetRealCount)).MatchForward(false, + ).Advance(1).RemoveInstruction().InsertAndAdvance(GetRealCount).MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(ci => ci.opcode == OpCodes.Bgt || ci.opcode == OpCodes.Bgt_S), new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(ci => ci.opcode == OpCodes.Br || ci.opcode == OpCodes.Br_S), new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(ci => ci.IsLdloc()) - ).RemoveInstructions(5).Insert(Transpilers.EmitDelegate(MultiplierWithCountCheck)); + ).RemoveInstructions(5).Insert(MultiplierWithCountCheck); return matcher.InstructionEnumeration(); } @@ -1839,8 +1835,44 @@ public class FactoryPatch : PatchImpl new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(ci => ci.IsStloc()) ); - matcher.Repeat(m => m.RemoveInstructions(5).InsertAndAdvance(Transpilers.EmitDelegate(MultiplierWithCountCheck))); + matcher.Repeat(m => m.RemoveInstructions(5).InsertAndAdvance(MultiplierWithCountCheck)); return matcher.InstructionEnumeration(); } + + [HarmonyPrefix] + [HarmonyPatch(typeof(TankComponent), nameof(TankComponent.TickOutput))] + private static bool TankComponent_TickOutput_Prefix(ref TankComponent __instance, PlanetFactory factory) + { + if (!__instance.outputSwitch || __instance.fluidCount <= 0) + return false; + var lastTankId = __instance.lastTankId; + if (lastTankId <= 0) + return false; + var factoryStorage = factory.factoryStorage; + ref var tankComponent = ref factoryStorage.tankPool[lastTankId]; + if (!tankComponent.inputSwitch || (tankComponent.fluidId > 0 && tankComponent.fluidId != __instance.fluidId)) + return false; + var left = tankComponent.fluidCapacity - tankComponent.fluidCount; + if (left <= 0) + return false; + if (tankComponent.fluidId == 0) + tankComponent.fluidId = __instance.fluidId; + var takeOut = Math.Min(left, _tankFastFillInAndTakeOutMultiplierRealValue); + if (takeOut >= __instance.fluidCount) + { + tankComponent.fluidCount += __instance.fluidCount; + tankComponent.fluidInc += __instance.fluidInc; + __instance.fluidId = 0; + __instance.fluidCount = 0; + __instance.fluidInc = 0; + } + else + { + var takeInc = __instance.split_inc(ref __instance.fluidCount, ref __instance.fluidInc, takeOut); + tankComponent.fluidCount += takeOut; + tankComponent.fluidInc += takeInc; + } + return false; + } } } \ No newline at end of file diff --git a/UXAssist/README.md b/UXAssist/README.md index c8b251a..da3344b 100644 --- a/UXAssist/README.md +++ b/UXAssist/README.md @@ -50,6 +50,9 @@ - Logistic storage limits are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity. - You can use arrow keys to adjust logistic storage limits gracefully. - Quick build and dismantle stacking labs/storages/tanks + - Fast fill in to and take out from tanks + - You can set multiplier for tanks' operation speed + - This affects manually fill in to and/or take out from tanks, as well as transfer from upper to lower level. - Protect veins from exhaustion - By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file. - When reach the protection value, veins/oils steeps will not be mined/extracted any longer. @@ -164,6 +167,9 @@ - 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。 - 你可以使用方向键微调物流塔存储限制 - 快速建造和拆除堆叠研究站/储物仓/储液罐 + - 储液罐快速注入和抽取液体 + - 你可以设置储液罐操作速度的倍率 + - 影响手动注入和抽取,以及从储液罐上层传输到下层的速度 - 保护矿脉不会耗尽 - 默认矿脉数量保护在100,采油速保护在1.0/s,你可以在配置文件中自行设置。 - 当达到保护值时,矿脉和油井将不再被开采。 diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj index 746b5de..bdb1bcb 100644 --- a/UXAssist/UXAssist.csproj +++ b/UXAssist/UXAssist.csproj @@ -4,7 +4,7 @@ net472 org.soardev.uxassist DSP MOD - UXAssist - 1.2.7 + 1.2.8 true latest UXAssist diff --git a/UXAssist/package/manifest.json b/UXAssist/package/manifest.json index 3ee3637..e2a15bc 100644 --- a/UXAssist/package/manifest.json +++ b/UXAssist/package/manifest.json @@ -1,6 +1,6 @@ { "name": "UXAssist", - "version_number": "1.2.7", + "version_number": "1.2.8", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist", "description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁", "dependencies": [