mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
feat(uxassist): add a shortcut to reverse conveyor belts
- Add a Factory toggle and a configurable Alt+R shortcut for the built belt under the cursor. - Reuse native reversal while preserving the belt inspector context and native limits. - Add English and Chinese settings labels, usage notes, and changelog entries.
This commit is contained in:
1 parent
4c0ad9c27f
commit
9fb75f70b8
8 files changed
+71
No files matched your search
@@ -4,6 +4,7 @@
|
||||
## Changlog
|
||||
|
||||
* 1.6.4
|
||||
* `Reverse conveyor belt`: Enable it on the Factory tab and press `Alt+R` over a built belt to reverse it without opening its panel. The shortcut can be changed in the system options.
|
||||
* `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save.
|
||||
* `Auto-cruise`: Fix the mecha diving back into the ground right after taking off from a moon that is close to its gas giant.
|
||||
* 1.6.3
|
||||
@@ -448,6 +449,7 @@
|
||||
## 更新日志
|
||||
|
||||
* 1.6.4
|
||||
* `反转传送带`:在「工厂」页启用后,将鼠标移到已建成的传送带上,按 `Alt+R` 直接反转,无需打开面板;可在系统选项中修改快捷键。
|
||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
||||
* `自动巡航`:修复从紧邻气态巨星的卫星上起飞后,机甲又扎回地面的问题。
|
||||
* 1.6.3
|
||||
|
||||
@@ -26,6 +26,7 @@ public static class FactoryConfigProvider
|
||||
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled => FactoryPatch.TankFastFillInAndTakeOutEnabled;
|
||||
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier => FactoryPatch.TankFastFillInAndTakeOutMultiplier;
|
||||
public static ConfigEntry<bool> CutConveyorBeltEnabled => FactoryPatch.CutConveyorBeltEnabled;
|
||||
public static ConfigEntry<bool> ReverseConveyorBeltEnabled => FactoryPatch.ReverseConveyorBeltEnabled;
|
||||
public static ConfigEntry<bool> TweakBuildingBufferEnabled => FactoryPatch.TweakBuildingBufferEnabled;
|
||||
public static ConfigEntry<int> AssemblerBufferTimeMultiplier => FactoryPatch.AssemblerBufferTimeMultiplier;
|
||||
public static ConfigEntry<int> AssemblerBufferMininumMultiplier => FactoryPatch.AssemblerBufferMininumMultiplier;
|
||||
|
||||
@@ -60,6 +60,7 @@ public static class I18NKeys
|
||||
public const string KEYToggleDoNotRenderEntities = "KEYToggleDoNotRenderEntities";
|
||||
public const string KEYOffgridForPaths = "KEYOffgridForPaths";
|
||||
public const string KEYCutConveyorBelt = "KEYCutConveyorBelt";
|
||||
public const string KEYReverseConveyorBelt = "KEYReverseConveyorBelt";
|
||||
public const string KEYDismantleBlueprintSelection = "KEYDismantleBlueprintSelection";
|
||||
public const string KEYSelectAllBuildingsInBlueprintCopy = "KEYSelectAllBuildingsInBlueprintCopy";
|
||||
public const string KEYUPSSpeedDown = "KEYUPSSpeedDown";
|
||||
@@ -111,6 +112,7 @@ public static class I18NKeys
|
||||
public const string FastFillInToAndTakeOutFromTanks = "Fast fill in to and take out from tanks";
|
||||
public const string SpeedRatio = "Speed Ratio";
|
||||
public const string CutConveyorBeltWithShortcutKey = "Cut conveyor belt (with shortcut key)";
|
||||
public const string ReverseConveyorBeltWithShortcutKey = "Reverse conveyor belt (with shortcut key)";
|
||||
public const string ProtectVeinsFromExhaustion = "Protect veins from exhaustion";
|
||||
public const string ProtectVeinsFromExhaustionTips = "Protect veins from exhaustion tips";
|
||||
public const string DoNotRenderFactoryEntities = "Do not render factory entities";
|
||||
@@ -301,6 +303,7 @@ public static class I18NKeys
|
||||
I18N.Add(KEYToggleDoNotRenderEntities, "[UXA] Toggle Do Not Render Factory Entities", "[UXA] 切换不渲染工厂建筑实体");
|
||||
I18N.Add(KEYOffgridForPaths, "[UXA] Build belts offgrid", "[UXA] 脱离网格建造传送带");
|
||||
I18N.Add(KEYCutConveyorBelt, "[UXA] Cut conveyor belt", "[UXA] 切割传送带");
|
||||
I18N.Add(KEYReverseConveyorBelt, "[UXA] Reverse conveyor belt", "[UXA] 反转传送带");
|
||||
I18N.Add(KEYDismantleBlueprintSelection, "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
||||
I18N.Add(KEYSelectAllBuildingsInBlueprintCopy, "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
|
||||
I18N.Add(KEYUPSSpeedDown, "[UXA] Decrease logical frame rate", "[UXA] 降低逻辑帧率");
|
||||
@@ -370,6 +373,7 @@ Hold Ctrl/Shift/Alt to change the count rapidly.
|
||||
I18N.Add(FastFillInToAndTakeOutFromTanks, "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
|
||||
I18N.Add(SpeedRatio, "Speed Ratio", "速度倍率");
|
||||
I18N.Add(CutConveyorBeltWithShortcutKey, "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
|
||||
I18N.Add(ReverseConveyorBeltWithShortcutKey, "Reverse conveyor belt (with shortcut key)", "反转传送带(使用快捷键)");
|
||||
I18N.Add(ProtectVeinsFromExhaustion, "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
||||
I18N.Add(ProtectVeinsFromExhaustionTips, """
|
||||
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.
|
||||
|
||||
@@ -24,6 +24,43 @@ public static class FactoryFunctions
|
||||
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
|
||||
}
|
||||
|
||||
public static void ReverseConveyorBelt(PlanetFactory factory, int beltId)
|
||||
{
|
||||
var traffic = factory?.cargoTraffic;
|
||||
var player = GameMain.mainPlayer;
|
||||
var window = UIRoot.instance?.uiGame?.beltWindow;
|
||||
if (traffic == null || player == null || window == null || beltId <= 0 || beltId >= traffic.beltPool.Length) return;
|
||||
|
||||
ref var belt = ref traffic.beltPool[beltId];
|
||||
if (belt.id != beltId) return;
|
||||
var path = traffic.GetCargoPath(belt.segPathId);
|
||||
// Match the native reverse button's limit of 2 to 1023 belts in one path.
|
||||
const int maxBeltCount = 1023;
|
||||
if (path == null || path.belts.Count < 2 || path.belts.Count > maxBeltCount) return;
|
||||
|
||||
var oldFactory = window.factory;
|
||||
var oldTraffic = window.traffic;
|
||||
var oldPlayer = window.player;
|
||||
var oldBeltId = window._beltId;
|
||||
try
|
||||
{
|
||||
window.factory = factory;
|
||||
window.traffic = traffic;
|
||||
window.player = player;
|
||||
// The beltId setter refreshes the visible inspector, so bind the backing field directly.
|
||||
window._beltId = beltId;
|
||||
// Nebula intercepts this native entry point to synchronize reversals.
|
||||
window.OnReverseButtonClick(0);
|
||||
}
|
||||
finally
|
||||
{
|
||||
window._beltId = oldBeltId;
|
||||
window.factory = oldFactory;
|
||||
window.traffic = oldTraffic;
|
||||
window.player = oldPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ObjectIsBeltOrInserter(PlanetFactory factory, int objId)
|
||||
{
|
||||
if (objId == 0) return false;
|
||||
|
||||
@@ -39,6 +39,7 @@ public static class FactoryPatch
|
||||
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled;
|
||||
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier;
|
||||
public static ConfigEntry<bool> CutConveyorBeltEnabled;
|
||||
public static ConfigEntry<bool> ReverseConveyorBeltEnabled;
|
||||
public static ConfigEntry<bool> TweakBuildingBufferEnabled;
|
||||
public static ConfigEntry<int> AssemblerBufferTimeMultiplier;
|
||||
public static ConfigEntry<int> AssemblerBufferMininumMultiplier;
|
||||
@@ -56,6 +57,7 @@ public static class FactoryPatch
|
||||
internal static PressKeyBind _doNotRenderEntitiesKey;
|
||||
internal static PressKeyBind _offgridfForPathsKey;
|
||||
internal static PressKeyBind _cutConveyorBeltKey;
|
||||
internal static PressKeyBind _reverseConveyorBeltKey;
|
||||
internal static PressKeyBind _dismantleBlueprintSelectionKey;
|
||||
internal static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
|
||||
|
||||
@@ -86,6 +88,14 @@ public static class FactoryPatch
|
||||
name = "CutConveyorBelt",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
_reverseConveyorBeltKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.R, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ReverseConveyorBelt",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
_dismantleBlueprintSelectionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
@@ -215,6 +225,13 @@ public static class FactoryPatch
|
||||
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
||||
}
|
||||
}
|
||||
if (ReverseConveyorBeltEnabled.Value && _reverseConveyorBeltKey.keyValue
|
||||
&& GameMain.isRunning && !GameMain.isPaused && !VFInput.onGUI)
|
||||
{
|
||||
var raycast = GameMain.mainPlayer?.controller?.cmd.raycast;
|
||||
if (raycast != null && raycast.castEntity.id > 0 && raycast.castEntity.beltId > 0)
|
||||
Functions.FactoryFunctions.ReverseConveyorBelt(raycast.planet?.factory, raycast.castEntity.beltId);
|
||||
}
|
||||
if (ShortcutKeysForBlueprintCopyEnabled.Value)
|
||||
{
|
||||
if (_dismantleBlueprintSelectionKey.keyValue)
|
||||
|
||||
@@ -60,6 +60,9 @@
|
||||
* Cut conveyor belt
|
||||
* Press shortcut key to cut conveyor belt under cursor.
|
||||
* The default shortcut key is Alt+X, you can set it in system options panel.
|
||||
* Reverse conveyor belt
|
||||
* Enable it on the Factory tab, hover over a built belt, and press `Alt+R` to reverse it without opening its panel.
|
||||
* Change the shortcut in the system options. Reversal follows the native button's scope and limits.
|
||||
* Treat stack items as single in monitor components
|
||||
* Quick build and dismantle stacking labs/storages/tanks
|
||||
* Fast fill in to and take out from tanks
|
||||
@@ -268,6 +271,9 @@
|
||||
* 切割传送带
|
||||
* 按快捷键切割光标位置的传送带
|
||||
* 默认快捷键是Alt+X,可以在系统选项面板中设置
|
||||
* 反转传送带
|
||||
* 在「工厂」页启用后,将鼠标移到已建成的传送带上,按 `Alt+R` 直接反转,无需打开面板。
|
||||
* 可在系统选项中修改快捷键,反转范围和限制与原版按钮一致。
|
||||
* 在流速计中将堆叠物品视为单个物品
|
||||
* 快速建造和拆除堆叠研究站/储物仓/储液罐
|
||||
* 储液罐快速注入和抽取液体
|
||||
|
||||
@@ -245,6 +245,8 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.CutConveyorBeltEnabled, I18NKeys.CutConveyorBeltWithShortcutKey);
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.ReverseConveyorBeltEnabled, I18NKeys.ReverseConveyorBeltWithShortcutKey);
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.TreatStackingAsSingleEnabled, I18NKeys.TreatStackItemsAsSingleInMonitorComponents);
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.QuickBuildAndDismantleLabsEnabled, I18NKeys.QuickBuildAndDismantleStackingLabs);
|
||||
|
||||
@@ -149,6 +149,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
FactoryPatch.TankFastFillInAndTakeOutMultiplier = Config.Bind("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks");
|
||||
FactoryPatch.CutConveyorBeltEnabled = Config.Bind("Factory", "CutConveyorBeltShortcut", false,
|
||||
"Cut conveyor belt (with shortcut key)");
|
||||
FactoryPatch.ReverseConveyorBeltEnabled = Config.Bind("Factory", "ReverseConveyorBeltShortcut", false,
|
||||
"Reverse conveyor belt (with shortcut key)");
|
||||
FactoryPatch.TweakBuildingBufferEnabled = Config.Bind("Factory", "TweakBuildingBuffer", false,
|
||||
"Tweak buffer count for assemblers and power generators");
|
||||
FactoryPatch.AssemblerBufferTimeMultiplier = Config.Bind("Factory", "AssemblerBufferTimeMultiplier", 4, new ConfigDescription("Assembler buffer time multiplier in seconds", new AcceptableValueRange<int>(2, 10)));
|
||||
|
||||
Reference in new issue
Block a user