1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 14:53:30 +08:00

WIP for UXAssist 1.2.16

This commit is contained in:
2025-03-17 17:37:41 +08:00
parent 043e7a8e70
commit 087ceac1e3
8 changed files with 67 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
## Changlog
* 1.2.16
+ New feature: `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.
* 1.2.15
+ `Off-grid building and stepped rotation`: Fix compatibility with DSP 0.10.32.25682. (#57)
+ `Enhanced control for logistic storage limits`: Try to fix possible crash. (#54)
@@ -239,6 +243,10 @@
## 更新日志
* 1.2.16
+ 新功能:`切割传送带`
- 按快捷键切割光标位置的传送带
- 默认快捷键是Alt+X可以在系统选项面板中设置
* 1.2.15
+ `脱离网格建造和小角度旋转`修复了与0.10.32.25682的兼容性 (#57)
+ `物流塔存储数量限制控制改进`:修复了可能导致崩溃的问题 (#54)

View File

@@ -0,0 +1,13 @@
namespace UXAssist.Functions;
public static class FactoryFunctions
{
public static void CutConveyorBelt(CargoTraffic cargoTraffic, int beltId)
{
ref var belt = ref cargoTraffic.beltPool[beltId];
if (belt.id != beltId || belt.outputId <= 0) return;
var (i0, i1, i2) = (belt.rightInputId, belt.backInputId, belt.leftInputId);
cargoTraffic._arrInputs(ref i0, ref i1, ref i2);
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
}
}

View File

@@ -33,8 +33,10 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
public static ConfigEntry<bool> BeltSignalsForBuyOutEnabled;
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled;
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier;
public static ConfigEntry<bool> CutConveyorBeltEnabled;
private static PressKeyBind _doNotRenderEntitiesKey;
private static PressKeyBind _offgridfForPathsKey;
private static PressKeyBind _cutConveyorBeltKey;
private static int _tankFastFillInAndTakeOutMultiplierRealValue = 2;
@@ -51,13 +53,21 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
I18N.Add("KEYToggleDoNotRenderEntities", "Toggle Do Not Render Factory Entities", "切换不渲染工厂建筑实体");
_offgridfForPathsKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey(0, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "OffgridForPaths",
canOverride = true
}
);
I18N.Add("KEYOffgridForPaths", "Build belts offgrid", "脱离网格建造传送带");
_cutConveyorBeltKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.X, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
name = "CutConveyorBelt",
canOverride = true
}
);
I18N.Add("KEYCutConveyorBelt", "Cut conveyor belt", "切割传送带");
BeltSignalsForBuyOut.InitPersist();
ProtectVeinsFromExhaustion.InitConfig();
@@ -79,6 +89,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
BeltSignalsForBuyOutEnabled.SettingChanged += (_, _) => BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
TankFastFillInAndTakeOutEnabled.SettingChanged += (_, _) => TankFastFillInAndTakeOut.Enable(TankFastFillInAndTakeOutEnabled.Value);
TankFastFillInAndTakeOutMultiplier.SettingChanged += (_, _) => { UpdateTankFastFillInAndTakeOutMultiplierRealValue(); };
CutConveyorBeltEnabled.SettingChanged += (_, _) => CutConveyorBelt.Enable(CutConveyorBeltEnabled.Value);
}
public static void Start()
@@ -97,6 +108,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
TankFastFillInAndTakeOut.Enable(TankFastFillInAndTakeOutEnabled.Value);
CutConveyorBelt.Enable(CutConveyorBeltEnabled.Value);
Enable(true);
UpdateTankFastFillInAndTakeOutMultiplierRealValue();
@@ -106,6 +118,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
{
Enable(false);
CutConveyorBelt.Enable(false);
TankFastFillInAndTakeOut.Enable(false);
BeltSignalsForBuyOut.Enable(false);
DragBuildPowerPoles.Enable(false);
@@ -1928,4 +1941,23 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
return false;
}
}
private class CutConveyorBelt : PatchImpl<CutConveyorBelt>
{
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))]
private static void PlayerController_GameTick_Postfix(PlayerController __instance)
{
if (DSPGame.IsMenuDemo) return;
if (!_cutConveyorBeltKey.keyValue) return;
var raycast = __instance.cmd.raycast;
if (raycast == null) return;
if (raycast.castEntity.id <= 0) return;
int beltId;
if ((beltId = raycast.castEntity.beltId) <= 0) return;
var cargoTraffic = raycast.planet.factory.cargoTraffic;
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
}
}
}

View File

@@ -45,6 +45,9 @@
- Larger area for upgrade and dismantle(30x30 at max)
- Larger area for terraform(30x30 at max)
- Off-grid building and stepped rotation
- 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.
- Treat stack items as single in monitor components
- Enhanced control for logistic storage limits
- Logistic storage limits are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity.
@@ -162,6 +165,9 @@
- 范围升级和拆除的最大区域扩大(最大30x30)
- 范围铺设地基的最大区域扩大(最大30x30)
- 脱离网格建造以及小角度旋转
- 切割传送带
- 按快捷键切割光标位置的传送带
- 默认快捷键是Alt+X可以在系统选项面板中设置
- 在流速计中将堆叠物品视为单个物品
- 物流塔存储数量限制控制改进
- 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。

View File

@@ -70,6 +70,7 @@ public static class UIConfigWindow
I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs/storages/tanks(hold shift)", "快速建造和拆除堆叠研究站/储物仓/储液罐(按住shift)");
I18N.Add("Fast fill in to and take out from tanks", "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
I18N.Add("Speed Ratio", "Speed Ratio", "速度倍率");
I18N.Add("Cut conveyor belt (with shortcut key)", "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽");
I18N.Add("Protect veins from exhaustion tips",
"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.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`",
@@ -239,6 +240,8 @@ public static class UIConfigWindow
y += 36f;
wnd.AddCheckBox(x, y, tab2, FactoryPatch.OffGridBuildingEnabled, "Off-grid building and stepped rotation");
y += 36f;
wnd.AddCheckBox(x, y, tab2, FactoryPatch.CutConveyorBeltEnabled, "Cut conveyor belt (with shortcut key)");
y += 36f;
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
y += 36f;
wnd.AddCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs");

View File

@@ -134,6 +134,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
FactoryPatch.TankFastFillInAndTakeOutEnabled = Config.Bind("Factory", "TankFastFillInAndTakeOut", false,
"Fast fill in to and take out from tanks");
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)");
LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
"Logistics capacity related tweaks");
LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,

View File

@@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
<Description>DSP MOD - UXAssist</Description>
<Version>1.2.15</Version>
<Version>1.2.16</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>UXAssist</PackageId>

View File

@@ -1,6 +1,6 @@
{
"name": "UXAssist",
"version_number": "1.2.15",
"version_number": "1.2.16",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [