From 51314305d154ddeb97a13f3d040b453b3530710d Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Fri, 29 Mar 2024 19:00:40 +0800 Subject: [PATCH] UXAssist and CheatEnabler new version --- CheatEnabler/CheatEnabler.csproj | 4 +- CheatEnabler/README.md | 2 + CheatEnabler/UIConfigWindow.cs | 2 +- CheatEnabler/package/manifest.json | 2 +- UXAssist/FactoryPatch.cs | 416 ++++++++++++++++++++++++++--- UXAssist/README.md | 22 ++ UXAssist/UI/MyConfigWindow.cs | 2 +- UXAssist/UIConfigWindow.cs | 7 + UXAssist/UXAssist.cs | 9 +- UXAssist/UXAssist.csproj | 4 +- UXAssist/package/manifest.json | 2 +- 11 files changed, 432 insertions(+), 40 deletions(-) diff --git a/CheatEnabler/CheatEnabler.csproj b/CheatEnabler/CheatEnabler.csproj index ee34ae0..30ba71d 100644 --- a/CheatEnabler/CheatEnabler.csproj +++ b/CheatEnabler/CheatEnabler.csproj @@ -5,7 +5,7 @@ net472 org.soardev.cheatenabler DSP MOD - CheatEnabler - 2.3.13 + 2.3.14 true latest CheatEnabler @@ -16,7 +16,7 @@ - + diff --git a/CheatEnabler/README.md b/CheatEnabler/README.md index 7d55dfc..5e3bba4 100644 --- a/CheatEnabler/README.md +++ b/CheatEnabler/README.md @@ -6,6 +6,7 @@ ## Changlog * 2.3.14 + Remove default shortcut key for `No condition build` and `No collision`, to avoid misoperation. You can still set them in system settings window manually if needed. + + Fix translation issue. * 2.3.13 + Fix a bug that shortcuts are not working and have display issue on settings window. * 2.3.12 @@ -135,6 +136,7 @@ ## 更新日志 * 2.3.14 + 移除了`无条件建造`和`无碰撞`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。 + + 修复了翻译问题。 * 2.3.13 + 修复了快捷键无效和设置窗口上的按键显示问题 * 2.3.12 diff --git a/CheatEnabler/UIConfigWindow.cs b/CheatEnabler/UIConfigWindow.cs index a634dce..e02ffeb 100644 --- a/CheatEnabler/UIConfigWindow.cs +++ b/CheatEnabler/UIConfigWindow.cs @@ -52,7 +52,7 @@ public static class UIConfigWindow I18N.Add("Eject anyway", "Eject anyway", "全球弹射"); I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)"); I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)"); - I18N.Add("Terraform without enough soil piless", "Terraform without enough soil piles", "沙土不够时依然可以整改地形"); + I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形"); I18N.Apply(); MyConfigWindow.OnUICreated += CreateUI; MyConfigWindow.OnUpdateUI += UpdateUI; diff --git a/CheatEnabler/package/manifest.json b/CheatEnabler/package/manifest.json index add246d..30b0f75 100644 --- a/CheatEnabler/package/manifest.json +++ b/CheatEnabler/package/manifest.json @@ -1,6 +1,6 @@ { "name": "CheatEnabler", - "version_number": "2.3.13", + "version_number": "2.3.14", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler", "description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测", "dependencies": [ diff --git a/UXAssist/FactoryPatch.cs b/UXAssist/FactoryPatch.cs index e4eaddb..7c402d7 100644 --- a/UXAssist/FactoryPatch.cs +++ b/UXAssist/FactoryPatch.cs @@ -19,7 +19,8 @@ public static class FactoryPatch public static ConfigEntry OffGridBuildingEnabled; public static ConfigEntry LogisticsCapacityTweaksEnabled; public static ConfigEntry TreatStackingAsSingleEnabled; - public static ConfigEntry QuickBuildAndDismantleLabEnabled; + public static ConfigEntry QuickBuildAndDismantleLabsEnabled; + public static ConfigEntry ProtectVeinsFromExhaustionEnabled; private static Harmony _factoryPatch; @@ -34,7 +35,8 @@ public static class FactoryPatch OffGridBuildingEnabled.SettingChanged += (_, _) => OffGridBuilding.Enable(OffGridBuildingEnabled.Value); LogisticsCapacityTweaksEnabled.SettingChanged += (_, _) => LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value); TreatStackingAsSingleEnabled.SettingChanged += (_, _) => TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value); - QuickBuildAndDismantleLabEnabled.SettingChanged += (_, _) => QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabEnabled.Value); + QuickBuildAndDismantleLabsEnabled.SettingChanged += (_, _) => QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value); + ProtectVeinsFromExhaustionEnabled.SettingChanged += (_, _) => ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value); UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value); RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value); NightLight.Enable(NightLightEnabled.Value); @@ -44,7 +46,8 @@ public static class FactoryPatch OffGridBuilding.Enable(OffGridBuildingEnabled.Value); LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value); TreatStackingAsSingle.Enable(TreatStackingAsSingleEnabled.Value); - QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabEnabled.Value); + QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value); + ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value); _factoryPatch ??= Harmony.CreateAndPatchAll(typeof(FactoryPatch)); } @@ -61,6 +64,7 @@ public static class FactoryPatch LogisticsCapacityTweaks.Enable(false); TreatStackingAsSingle.Enable(false); QuickBuildAndDismantleLab.Enable(false); + ProtectVeinsFromExhaustion.Enable(false); _factoryPatch?.UnpatchSelf(); _factoryPatch = null; @@ -413,7 +417,7 @@ public static class FactoryPatch private static class RemoveBuildRangeLimit { private static Harmony _patch; - + public static void Enable(bool enable) { if (enable) @@ -555,6 +559,7 @@ public static class FactoryPatch } private static bool _initialized; + [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnOpen")] public static void UIRoot__OnOpen_Postfix() { @@ -577,7 +582,7 @@ public static class FactoryPatch y = latitudeRad / latitudeRadPerGrid; z = (pos.magnitude - planet.realRadius - 0.2f) / 1.3333333f; } - + private static string FormatOffsetFloat(float f) { return f.ToString("0.0000").TrimEnd('0').TrimEnd('.'); @@ -604,6 +609,7 @@ public static class FactoryPatch ? $"{FormatOffsetFloat(x)},{FormatOffsetFloat(y)}" : $"{FormatOffsetFloat(x)},{FormatOffsetFloat(y)},{FormatOffsetFloat(z)}"; } + __instance.actionBuild.model.cursorText = $"({_lastOffsetText})\n" + __instance.actionBuild.model.cursorText; } @@ -631,6 +637,7 @@ public static class FactoryPatch _lastPos = entity.pos; _lastOffsetText = $"{FormatOffsetFloat(x)},{FormatOffsetFloat(y)},{FormatOffsetFloat(z)}"; } + entityBriefInfo.entityNameText.text += $" ({_lastOffsetText})"; } ) @@ -805,6 +812,7 @@ public static class FactoryPatch { _lastKey = KeyCode.None; } + if (!VFInput.noModifier) return; int delta; if (UpdateKeyPressed(KeyCode.LeftArrow)) @@ -850,18 +858,20 @@ public static class FactoryPatch { itemCountMax = modelProto.prefabDesc.stationMaxItemCount; } + itemCountMax += station.isStellar ? GameMain.history.remoteStationExtraStorage : GameMain.history.localStationExtraStorage; if (newMax > itemCountMax) { newMax = itemCountMax; } } + storage.max = newMax; _skipNextEvent = oldMax / 100 != newMax / 100; break; } } - + [HarmonyPrefix] [HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnMaxSliderValueChange))] private static bool UIStationStorage_OnMaxSliderValueChange_Prefix() @@ -897,6 +907,7 @@ public static class FactoryPatch storage[j].max = Mathf.RoundToInt((float)(storage[j].max * ratio / 50.0)) * 50; } } + break; } case 31: @@ -919,9 +930,11 @@ public static class FactoryPatch storage[j].max = Mathf.RoundToInt((float)(storage[j].max * ratio / 100.0)) * 100; } } + break; } } + return false; } } @@ -941,7 +954,7 @@ public static class FactoryPatch _patch?.UnpatchSelf(); _patch = null; } - + [HarmonyTranspiler] [HarmonyPatch(typeof(MonitorComponent), nameof(MonitorComponent.InternalUpdate))] private static IEnumerable MonitorComponent_InternalUpdate_Transpiler(IEnumerable instructions, ILGenerator generator) @@ -964,7 +977,7 @@ public static class FactoryPatch private static class QuickBuildAndDismantleLab { private static Harmony _patch; - + public static void Enable(bool enable) { if (enable) @@ -972,11 +985,12 @@ public static class FactoryPatch _patch ??= Harmony.CreateAndPatchAll(typeof(QuickBuildAndDismantleLab)); return; } + _patch?.UnpatchSelf(); _patch = null; } - private static bool DetermineMoreLabs(BuildTool_Dismantle dismantle, int id) + private static bool DetermineMoreLabsForDismantle(BuildTool dismantle, int id) { if (!VFInput._chainReaction) return true; var factory = dismantle.factory; @@ -986,28 +1000,32 @@ public static class FactoryPatch ref var lab = ref factory.factorySystem.labPool[entity.labId]; if (lab.id != entity.labId) return true; factory.ReadObjectConn(id, 14, out _, out var nextId, out _); - if (nextId == 0) return true; - while (true) + /* We keep last lab if selected lab is not the ground one */ + if (nextId > 0) { - factory.ReadObjectConn(nextId, 14, out _, out var nextNextId, out _); - if (nextNextId <= 0) break; - var pose = dismantle.GetObjectPose(nextId); - var desc = dismantle.GetPrefabDesc(nextId); - var preview = new BuildPreview + while (true) { - item = dismantle.GetItemProto(nextId), - desc = desc, - lpos = pose.position, - lrot = pose.rotation, - lpos2 = pose.position, - lrot2 = pose.rotation, - objId = nextId, - needModel = desc.lodCount > 0 && desc.lodMeshes[0] != null, - isConnNode = true - }; - dismantle.buildPreviews.Add(preview); - nextId = nextNextId; + factory.ReadObjectConn(nextId, 14, out _, out var nextNextId, out _); + if (nextNextId <= 0) break; + var pose = dismantle.GetObjectPose(nextId); + var desc = dismantle.GetPrefabDesc(nextId); + var preview = new BuildPreview + { + item = dismantle.GetItemProto(nextId), + desc = desc, + lpos = pose.position, + lrot = pose.rotation, + lpos2 = pose.position, + lrot2 = pose.rotation, + objId = nextId, + needModel = desc.lodCount > 0 && desc.lodMeshes[0] != null, + isConnNode = true + }; + dismantle.buildPreviews.Add(preview); + nextId = nextNextId; + } } + nextId = id; while (true) { @@ -1029,9 +1047,37 @@ public static class FactoryPatch }; dismantle.buildPreviews.Add(preview); } + return false; } - + + private static void BuildLabsToTop(BuildTool_Click click) + { + if (!click.multiLevelCovering || !VFInput._chainReaction) return; + var prefDesc = click.GetPrefabDesc(click.castObjectId); + if (!prefDesc.isLab) return; + while (true) + { + click.UpdateRaycast(); + click.DeterminePreviews(); + click.UpdateCollidersForCursor(); + click.UpdateCollidersForGiantBp(); + var model = click.actionBuild.model; + click.UpdatePreviewModels(model); + var flag = click.CheckBuildConditions(); + if (!flag) + { + model.ClearAllPreviewsModels(); + model.EarlyGameTickIgnoreActive(); + return; + } + + click.UpdatePreviewModelConditions(model); + click.UpdateGizmos(model); + click.CreatePrebuilds(); + } + } + [HarmonyTranspiler] [HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))] private static IEnumerable BuildTool_Dismantle_DeterminePreviews_Transpiler(IEnumerable instructions, ILGenerator generator) @@ -1047,10 +1093,320 @@ public static class FactoryPatch new CodeInstruction(OpCodes.Ldarg_0), new CodeInstruction(OpCodes.Ldloc_3), new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.objId))), - new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(QuickBuildAndDismantleLab), nameof(DetermineMoreLabs))), + new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(QuickBuildAndDismantleLab), nameof(DetermineMoreLabsForDismantle))), new CodeInstruction(OpCodes.And) ); return matcher.InstructionEnumeration(); } + + [HarmonyTranspiler] + [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click._OnTick))] + private static IEnumerable BuildTool_Click__OnTick_Transpiler(IEnumerable instructions, ILGenerator generator) + { + var matcher = new CodeMatcher(instructions, generator); + matcher.MatchForward(false, + new CodeMatch(OpCodes.Ldarg_0), + new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(BuildTool_Click), nameof(BuildTool_Click.CreatePrebuilds))) + ).Advance(2); + matcher.InsertAndAdvance( + new CodeInstruction(OpCodes.Ldarg_0), + new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(QuickBuildAndDismantleLab), nameof(BuildLabsToTop))) + ); + return matcher.InstructionEnumeration(); + } + } + + public static class ProtectVeinsFromExhaustion + { + public static int KeepVeinAmount = 100; + public static float KeepOilSpeed = 1f; + private static int _keepOilAmount = Math.Max((int)(KeepOilSpeed / 0.00004f + 0.5f), 2500); + + private static Harmony _patch; + + public static void Enable(bool enable) + { + if (enable) + { + _patch ??= Harmony.CreateAndPatchAll(typeof(ProtectVeinsFromExhaustion)); + return; + } + + _patch?.UnpatchSelf(); + _patch = null; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(MinerComponent), nameof(MinerComponent.InternalUpdate))] + private static bool MinerComponent_InternalUpdate_Prefix(PlanetFactory factory, VeinData[] veinPool, float power, float miningRate, float miningSpeed, int[] productRegister, + ref MinerComponent __instance, out uint __result) + { + if (power < 0.1f) + { + __result = 0U; + return false; + } + + var consumeCount = 0U; + int veinId; + int times; + switch (__instance.type) + { + case EMinerType.Vein: + if (__instance.veinCount <= 0) + break; + + if (__instance.time <= __instance.period) + { + __instance.time += (int)(power * __instance.speedDamper * __instance.speed * miningSpeed * __instance.veinCount); + consumeCount = 1U; + } + + if (__instance.time < __instance.period) + { + break; + } + + veinId = __instance.veins[__instance.currentVeinIndex]; + lock (veinPool) + { + if (veinPool[veinId].id == 0) + { + __instance.RemoveVeinFromArray(__instance.currentVeinIndex); + __instance.GetMinimumVeinAmount(factory, veinPool); + if (__instance.veinCount > 1) + { + __instance.currentVeinIndex %= __instance.veinCount; + } + else + { + __instance.currentVeinIndex = 0; + } + + __instance.time += (int)(power * __instance.speedDamper * __instance.speed * miningSpeed * __instance.veinCount); + __result = 0U; + return false; + } + + if (__instance.productCount < 50 && (__instance.productId == 0 || __instance.productId == veinPool[veinId].productId)) + { + __instance.productId = veinPool[veinId].productId; + times = __instance.time / __instance.period; + var outputCount = 0; + var amount = veinPool[veinId].amount; + if (amount > KeepVeinAmount) + { + if (miningRate > 0f) + { + var usedCount = 0; + var maxAllowed = amount - KeepVeinAmount; + if (miningRate < 0.99999f) + { + for (var i = 0; i < times; i++) + { + __instance.seed = (uint)((__instance.seed % 2147483646U + 1U) * 48271UL % 2147483647UL) - 1U; + usedCount += __instance.seed / 2147483646.0 < miningRate ? 1 : 0; + outputCount++; + if (usedCount == maxAllowed) + { + break; + } + } + } + else + { + outputCount = times > maxAllowed ? maxAllowed : times; + usedCount = outputCount; + } + + if (usedCount > 0) + { + var groupIndex = (int)veinPool[veinId].groupIndex; + amount = veinPool[veinId].amount -= usedCount; + if (amount < __instance.minimumVeinAmount) + { + __instance.minimumVeinAmount = amount; + } + + var veinGroups = factory.veinGroups; + veinGroups[groupIndex].amount -= usedCount; + factory.veinAnimPool[veinId].time = amount >= 20000 ? 0f : 1f - 0.00005f; + if (amount <= 0) + { + var venType = (int)veinPool[veinId].type; + var pos = veinPool[veinId].pos; + factory.RemoveVeinWithComponents(veinId); + factory.RecalculateVeinGroup(groupIndex); + factory.NotifyVeinExhausted(venType, pos); + __instance.RemoveVeinFromArray(__instance.currentVeinIndex); + __instance.GetMinimumVeinAmount(factory, veinPool); + } + else + { + __instance.currentVeinIndex++; + } + } + } + else + { + outputCount = times; + } + + __instance.productCount += outputCount; + lock (productRegister) + { + productRegister[__instance.productId] += outputCount; + factory.AddMiningFlagUnsafe(veinPool[veinId].type); + factory.AddVeinMiningFlagUnsafe(veinPool[veinId].type); + } + } + else if (amount <= 0) + { + __instance.RemoveVeinFromArray(__instance.currentVeinIndex); + __instance.GetMinimumVeinAmount(factory, veinPool); + } + else + { + __instance.currentVeinIndex++; + } + + __instance.time -= __instance.period * outputCount; + if (__instance.veinCount > 1) + { + __instance.currentVeinIndex %= __instance.veinCount; + } + else + { + __instance.currentVeinIndex = 0; + } + } + } + + break; + case EMinerType.Oil: + if (__instance.veinCount <= 0) + break; + + veinId = __instance.veins[0]; + lock (veinPool) + { + var amount = veinPool[veinId].amount; + var workCount = amount * VeinData.oilSpeedMultiplier; + if (__instance.time < __instance.period) + { + __instance.time += (int)(power * __instance.speedDamper * __instance.speed * miningSpeed * workCount + 0.5f); + consumeCount = 1U; + } + + if (__instance.time >= __instance.period && __instance.productCount < 50) + { + __instance.productId = veinPool[veinId].productId; + times = __instance.time / __instance.period; + var outputCount = 0; + if (miningRate > 0f && amount > _keepOilAmount) + { + var usedCount = 0; + var maxAllowed = amount - _keepOilAmount; + for (var j = 0; j < times; j++) + { + __instance.seed = (uint)((__instance.seed % 2147483646U + 1U) * 48271UL % 2147483647UL) - 1U; + usedCount += __instance.seed / 2147483646.0 < miningRate ? 1 : 0; + outputCount++; + } + + if (usedCount > 0) + { + if (usedCount > maxAllowed) + { + usedCount = maxAllowed; + } + + amount = veinPool[veinId].amount -= usedCount; + var veinGroups = factory.veinGroups; + var groupIndex = veinPool[veinId].groupIndex; + veinGroups[groupIndex].amount -= usedCount; + factory.veinAnimPool[veinId].time = amount >= 25000 ? 0f : 1f - amount * VeinData.oilSpeedMultiplier; + if (amount <= 2500) + { + factory.NotifyVeinExhausted((int)veinPool[veinId].type, veinPool[veinId].pos); + } + } + } + else if (_keepOilAmount <= 2500) + { + outputCount = times; + } + + if (outputCount > 0) + { + __instance.productCount += outputCount; + lock (productRegister) + { + productRegister[__instance.productId] += outputCount; + } + + __instance.time -= __instance.period * outputCount; + } + } + } + + break; + + case EMinerType.Water: + if (__instance.time < __instance.period) + { + __instance.time += (int)(power * __instance.speedDamper * __instance.speed * miningSpeed); + consumeCount = 1U; + } + + if (__instance.time < __instance.period) break; + times = __instance.time / __instance.period; + if (__instance.productCount >= 50) break; + __instance.productId = factory.planet.waterItemId; + do + { + if (__instance.productId > 0) + { + __instance.productCount += times; + lock (productRegister) + { + productRegister[__instance.productId] += times; + break; + } + } + + __instance.productId = 0; + } while (false); + + __instance.time -= __instance.period * times; + break; + } + + if (__instance.productCount > 0 && __instance.insertTarget > 0 && __instance.productId > 0) + { + var multiplier = 36000000.0 / __instance.period * miningSpeed; + if (__instance.type == EMinerType.Vein) + { + multiplier *= __instance.veinCount; + } + else if (__instance.type == EMinerType.Oil) + { + multiplier *= veinPool[__instance.veins[0]].amount * VeinData.oilSpeedMultiplier; + } + + var count = (int)(multiplier - 0.01) / 1800 + 1; + count = count < 4 ? count < 1 ? 1 : count : 4; + 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) + { + __instance.productId = 0; + } + } + + __result = consumeCount; + return false; + } } } \ No newline at end of file diff --git a/UXAssist/README.md b/UXAssist/README.md index 9f8a2b6..0f33dee 100644 --- a/UXAssist/README.md +++ b/UXAssist/README.md @@ -5,6 +5,12 @@ ## Changlog * 1.0.19 + + New functions: + - `Quick build and dismantle stacking labs` + - `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. + - Close this function to resume mining and pumping, usually when you have enough level on `Veins Utilization` + Remove default shortcut key for `Auto-cruise`, to avoid misoperation. Please set it in the system options window manually if needed. * 1.0.18 + Fix crash while coursing to a dark-fog hive. @@ -115,6 +121,11 @@ - 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. - Enhanced count control for hand-make + - Quick build and dismantle stacking labs + - 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. + - Close this function to resume mining and pumping, usually when you have enough level on `Veins Utilization` - Re-intialize planet (without reseting veins) - Quick dismantle all buildings (without drops) - Quick build Orbital Collectors @@ -138,6 +149,12 @@ ## 更新日志 * 1.0.19 + + 新功能: + - `快速建造和拆除堆叠研究站` + - `保护矿脉不会耗尽` + - 默认矿脉数量保护在100,采油速保护在1.0/s,你可以在配置文件中自行设置。 + - 当达到保护值时,矿脉和油井将不再被开采。 + - 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。 + 移除了`自动巡航`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。 * 1.0.18 + 修复了以黑雾巢穴为目标时导致崩溃的问题 @@ -250,6 +267,11 @@ - 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。 - 你可以使用方向键微调物流塔存储限制 - 手动制造物品的数量控制改进 + - 快速建造和拆除堆叠研究站 + - 保护矿脉不会耗尽 + - 默认矿脉数量保护在100,采油速保护在1.0/s,你可以在配置文件中自行设置。 + - 当达到保护值时,矿脉和油井将不再被开采。 + - 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。 - 初始化本行星(不重置矿脉) - 快速拆除所有建筑(不掉落) - 快速建造轨道采集器 diff --git a/UXAssist/UI/MyConfigWindow.cs b/UXAssist/UI/MyConfigWindow.cs index b388ec5..e5e5e04 100644 --- a/UXAssist/UI/MyConfigWindow.cs +++ b/UXAssist/UI/MyConfigWindow.cs @@ -18,7 +18,7 @@ public class MyConfigWindow : MyWindowWithTabs public override void _OnCreate() { _windowTrans = GetComponent(); - _windowTrans.sizeDelta = new Vector2(810f, 512f); + _windowTrans.sizeDelta = new Vector2(810f, 584f); OnUICreated?.Invoke(this, _windowTrans); SetCurrentTab(0); diff --git a/UXAssist/UIConfigWindow.cs b/UXAssist/UIConfigWindow.cs index e5cca12..c150de9 100644 --- a/UXAssist/UIConfigWindow.cs +++ b/UXAssist/UIConfigWindow.cs @@ -37,6 +37,8 @@ public static class UIConfigWindow I18N.Add("Enhance control for logistic storage limits tips", "Logistic storage limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity.\nUse arrow keys to adjust logistic storage limits:\n \u2190/\u2192: -/+10 \u2193\u2191: -/+100", "当升级'运输机舱扩容'时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。\n你可以使用方向键微调物流塔存储限制:\n \u2190\u2192: -/+10 \u2193\u2191: -/+100"); I18N.Add("Enhanced count control for hand-make", "Enhanced count control for hand-make", "手动制造物品的数量控制改进"); I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量"); + I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs(hold shift)", "快速建造和拆除堆叠研究站(按住shift)"); + I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽"); I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航"); I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航"); I18N.Add("Distance to use warp", "Distance to use warp (AU)", "使用曲速的距离(AU)"); @@ -113,6 +115,11 @@ public static class UIConfigWindow x = 270f; y += 6f; MyWindow.AddTipsButton(x, y, tab2, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips"); + x = 0f; + y += 30f; + MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs"); + y += 36f; + MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion"); x = 350f; y -= 108f; MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings"); diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index ba4a0b3..d6aef27 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Reflection.Emit; using BepInEx; +using BepInEx.Configuration; using CommonAPI; using CommonAPI.Systems; using HarmonyLib; @@ -67,8 +68,12 @@ public class UXAssist : BaseUnityPlugin "Logistics capacity related tweaks"); FactoryPatch.TreatStackingAsSingleEnabled = Config.Bind("Factory", "TreatStackingAsSingle", false, "Treat stack items as single in monitor components"); - FactoryPatch.QuickBuildAndDismantleLabEnabled = Config.Bind("Factory", "QuickBuildAndDismantleLab", true, - "Quick build and dismantle labs"); + FactoryPatch.QuickBuildAndDismantleLabsEnabled = Config.Bind("Factory", "QuickBuildAndDismantleLab", false, + "Quick build and dismantle stacking labs"); + FactoryPatch.ProtectVeinsFromExhaustionEnabled = Config.Bind("Factory", "ProtectVeinsFromExhaustion", false, + "Protect veins from exhaustion"); + FactoryPatch.ProtectVeinsFromExhaustion.KeepVeinAmount = Config.Bind("Factory", "KeepVeinAmount", 100, new ConfigDescription("Keep veins amount (0 to disable)", new AcceptableValueRange(0, 1000))).Value; + FactoryPatch.ProtectVeinsFromExhaustion.KeepOilSpeed = Config.Bind("Factory", "KeepOilSpeed", 1.0f, new ConfigDescription("Keep minimal oil speed (< 0.1 to disable)", new AcceptableValueRange(0.0f, 1.0f))).Value; PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible"); PlayerPatch.HideTipsForSandsChangesEnabled = Config.Bind("Player", "HideTipsForGettingSands", false, "Hide tips for getting soil piles"); diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj index ceedfde..0126c9f 100644 --- a/UXAssist/UXAssist.csproj +++ b/UXAssist/UXAssist.csproj @@ -4,7 +4,7 @@ net472 org.soardev.uxassist DSP MOD - UXAssist - 1.0.18 + 1.0.19 true latest UXAssist @@ -15,7 +15,7 @@ - + diff --git a/UXAssist/package/manifest.json b/UXAssist/package/manifest.json index 5192e53..2f17b0b 100644 --- a/UXAssist/package/manifest.json +++ b/UXAssist/package/manifest.json @@ -1,6 +1,6 @@ { "name": "UXAssist", - "version_number": "1.0.18", + "version_number": "1.0.19", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist", "description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁", "dependencies": [