1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 03:33:29 +08:00

UXAssist: new feature for 1.2.20

This commit is contained in:
2025-04-19 22:39:47 +08:00
parent 8d7f8e8c8a
commit 3c8f258a1b
8 changed files with 113 additions and 4 deletions

View File

@@ -1,5 +1,10 @@
## Changlog ## Changlog
* 1.2.20
+ New feature: `Dismantle blueprint selected buildings`
- Press shortcut key in blueprint copy mode to dismantle selected buildings.
- The default shortcut key is Ctrl+X, you can set it in system options panel.
+ `Night Sunlight`: Fix bugs that sunlight angle is not updated as expected again.
* 1.2.19 * 1.2.19
+ New feature: `Tweak building buffer` + New feature: `Tweak building buffer`
- Factory recipe buffer formula: take the larger value between `Assembler buffer time multiplier(in seconds) * items needed per second` and `Assembler buffer minimum multiplier * items needed per recipe` - Factory recipe buffer formula: take the larger value between `Assembler buffer time multiplier(in seconds) * items needed per second` and `Assembler buffer minimum multiplier * items needed per recipe`
@@ -265,6 +270,11 @@
## 更新日志 ## 更新日志
* 1.2.20
+ 新功能:`拆除蓝图选中的建筑`
- 在蓝图复制模式下按快捷键拆除选中的建筑
- 默认快捷键是Ctrl+X可以在系统选项面板中设置
+ `夜间日光灯`:再次修复了光照角度未正确更新的问题
* 1.2.19 * 1.2.19
+ 新功能:`调整建筑输入缓冲` + 新功能:`调整建筑输入缓冲`
- 工厂配方计算公式,在`工厂配方缓冲时间倍率秒数x每秒需要的原料数量``工厂配方缓冲最小倍率x每生产一次配方需要的原料数量`中取更大的那个值 - 工厂配方计算公式,在`工厂配方缓冲时间倍率秒数x每秒需要的原料数量``工厂配方缓冲最小倍率x每生产一次配方需要的原料数量`中取更大的那个值

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace UXAssist.Functions; namespace UXAssist.Functions;
public static class FactoryFunctions public static class FactoryFunctions
@@ -19,4 +21,76 @@ public static class FactoryFunctions
cargoTraffic._arrInputs(ref i0, ref i1, ref i2); cargoTraffic._arrInputs(ref i0, ref i1, ref i2);
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2); cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
} }
public static void DismantleBlueprintSelectedBuildings()
{
var player = GameMain.mainPlayer;
var build = player?.controller?.actionBuild;
if (build == null) return;
var blueprintCopyTool = build.blueprintCopyTool;
if (blueprintCopyTool == null || !blueprintCopyTool.active) return;
var factory = build.factory;
List<int> buildPreviewsToRemove = [];
foreach (var buildPreview in blueprintCopyTool.bpPool)
{
if (buildPreview?.item == null || buildPreview.objId <= 0) continue;
int index;
if ((index = buildPreviewsToRemove.BinarySearch(buildPreview.objId)) < 0)
buildPreviewsToRemove.Insert(~index, buildPreview.objId);
var isBelt = buildPreview.desc.isBelt;
var isInserter = buildPreview.desc.isInserter;
if (isInserter) continue;
var objId = buildPreview.objId;
if (isBelt)
{
var needCheck = false;
for (var j = 0; j < 2; j++)
{
factory.ReadObjectConn(objId, j, out _, out var connObjId, out _);
if (connObjId == 0 || factory.ObjectIsBelt(connObjId) || blueprintCopyTool.ObjectIsInserter(connObjId)) continue;
needCheck = true;
break;
}
if (needCheck)
{
for (var k = 0; k < 16; k++)
{
factory.ReadObjectConn(objId, k, out _, out var connObjId, out _);
if (connObjId != 0 && (index = buildPreviewsToRemove.BinarySearch(connObjId)) < 0 && (factory.ObjectIsBelt(connObjId) || blueprintCopyTool.ObjectIsInserter(connObjId)))
buildPreviewsToRemove.Insert(~index, connObjId);
}
}
for (var m = 0; m < 4; m++)
{
factory.ReadObjectConn(objId, m, out _, out var connObjId, out _);
if (connObjId == 0 || !factory.ObjectIsBelt(connObjId) || buildPreviewsToRemove.BinarySearch(connObjId) >= 0) continue;
for (var j = 0; j < 2; j++)
{
factory.ReadObjectConn(connObjId, j, out _, out var connObjId2, out _);
if (connObjId2 == 0 || (index = buildPreviewsToRemove.BinarySearch(connObjId2)) >= 0 || factory.ObjectIsBelt(connObjId2) || blueprintCopyTool.ObjectIsInserter(connObjId2)) continue;
buildPreviewsToRemove.Insert(~index, connObjId2);
break;
}
}
continue;
}
if (buildPreview.desc.addonType == EAddonType.Belt) continue;
for (var j = 0; j < 16; j++)
{
factory.ReadObjectConn(objId, j, out _, out var connObjId, out _);
if (connObjId != 0 && (index = buildPreviewsToRemove.BinarySearch(connObjId)) < 0 && (factory.ObjectIsBelt(connObjId) || blueprintCopyTool.ObjectIsInserter(connObjId)))
buildPreviewsToRemove.Insert(~index, connObjId);
}
}
foreach (var objId in buildPreviewsToRemove)
{
build.DoDismantleObject(objId);
}
buildPreviewsToRemove = null;
blueprintCopyTool.ClearSelection();
blueprintCopyTool.ClearPreSelection();
blueprintCopyTool.ResetBlueprint();
blueprintCopyTool.ResetBuildPreviews();
blueprintCopyTool.RefreshBlueprintData();
}
} }

View File

@@ -41,10 +41,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
public static ConfigEntry<int> LabBufferExtraCountForAdvancedAssemble; public static ConfigEntry<int> LabBufferExtraCountForAdvancedAssemble;
public static ConfigEntry<int> LabBufferMaxCountForResearch; public static ConfigEntry<int> LabBufferMaxCountForResearch;
public static ConfigEntry<int> ReceiverBufferCount; public static ConfigEntry<int> ReceiverBufferCount;
public static ConfigEntry<bool> DismantleBlueprintSelectionEnabled;
private static PressKeyBind _doNotRenderEntitiesKey; private static PressKeyBind _doNotRenderEntitiesKey;
private static PressKeyBind _offgridfForPathsKey; private static PressKeyBind _offgridfForPathsKey;
private static PressKeyBind _cutConveyorBeltKey; private static PressKeyBind _cutConveyorBeltKey;
private static PressKeyBind _dismantleBlueprintSelectionKey;
private static int _tankFastFillInAndTakeOutMultiplierRealValue = 2; private static int _tankFastFillInAndTakeOutMultiplierRealValue = 2;
@@ -53,7 +55,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
_doNotRenderEntitiesKey = KeyBindings.RegisterKeyBinding(new BuiltinKey _doNotRenderEntitiesKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{ {
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true), key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND, conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "ToggleDoNotRenderEntities", name = "ToggleDoNotRenderEntities",
canOverride = true canOverride = true
} }
@@ -62,7 +64,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
_offgridfForPathsKey = KeyBindings.RegisterKeyBinding(new BuiltinKey _offgridfForPathsKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{ {
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true), key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND, conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "OffgridForPaths", name = "OffgridForPaths",
canOverride = true canOverride = true
} }
@@ -77,6 +79,15 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
); );
I18N.Add("KEYCutConveyorBelt", "Cut conveyor belt", "切割传送带"); I18N.Add("KEYCutConveyorBelt", "Cut conveyor belt", "切割传送带");
_dismantleBlueprintSelectionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.X, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.KEYBOARD_KEYBIND,
name = "DismantleBlueprintSelection",
canOverride = true
}
);
I18N.Add("KEYDismantleBlueprintSelection", "Dismantle blueprint selected buildings", "拆除蓝图选中的建筑");
BeltSignalsForBuyOut.InitPersist(); BeltSignalsForBuyOut.InitPersist();
ProtectVeinsFromExhaustion.InitConfig(); ProtectVeinsFromExhaustion.InitConfig();
@@ -164,6 +175,8 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
{ {
if (_doNotRenderEntitiesKey.keyValue) if (_doNotRenderEntitiesKey.keyValue)
DoNotRenderEntitiesEnabled.Value = !DoNotRenderEntitiesEnabled.Value; DoNotRenderEntitiesEnabled.Value = !DoNotRenderEntitiesEnabled.Value;
if (DismantleBlueprintSelectionEnabled.Value && _dismantleBlueprintSelectionKey.keyValue)
Functions.FactoryFunctions.DismantleBlueprintSelectedBuildings();
} }
public static void Export(BinaryWriter w) public static void Export(BinaryWriter w)

View File

@@ -73,6 +73,9 @@
- Auto apply filter with item under mouse cursor while opening the panel - Auto apply filter with item under mouse cursor while opening the panel
- Quick-set item filter while right-clicking item icons in storage list on the panel - Quick-set item filter while right-clicking item icons in storage list on the panel
- Real-time logistic stations info panel - Real-time logistic stations info panel
- Dismantle blueprint selected buildings
- Press shortcut key in blueprint copy mode to dismantle selected buildings.
- The default shortcut key is Ctrl+X, you can set it in system options panel.
- Re-intialize planet (without reseting veins) - Re-intialize planet (without reseting veins)
- Quick dismantle all buildings (without drops) - Quick dismantle all buildings (without drops)
- Quick build Orbital Collectors - Quick build Orbital Collectors
@@ -208,6 +211,9 @@
- 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件 - 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件
- 物流运输站实时信息面板 - 物流运输站实时信息面板
- 注意:如果你启用了`Auxilaryfunction`中的`展示物流站信息`,此功能将被隐藏 - 注意:如果你启用了`Auxilaryfunction`中的`展示物流站信息`,此功能将被隐藏
- 拆除蓝图选中的建筑
- 在蓝图复制模式下按快捷键拆除选中的建筑
- 默认快捷键是Ctrl+X可以在系统选项面板中设置
- 初始化本行星(不重置矿脉) - 初始化本行星(不重置矿脉)
- 快速拆除所有建筑(不掉落) - 快速拆除所有建筑(不掉落)
- 快速建造轨道采集器 - 快速建造轨道采集器

View File

@@ -97,6 +97,7 @@ public static class UIConfigWindow
I18N.Add("Extra buffer count for Self-evolution Labs", "Extra buffer count for Self-evolution Labs", "自演化研究站矩阵额外缓冲数量"); I18N.Add("Extra buffer count for Self-evolution Labs", "Extra buffer count for Self-evolution Labs", "自演化研究站矩阵额外缓冲数量");
I18N.Add("Buffer count for researching in labs", "Buffer count for researching in labs", "研究站科研模式缓存数量"); I18N.Add("Buffer count for researching in labs", "Buffer count for researching in labs", "研究站科研模式缓存数量");
I18N.Add("Ray Receiver Graviton Lens buffer count", "Ray Receiver Graviton Lens buffer count", "射线接收器透镜缓冲数量"); I18N.Add("Ray Receiver Graviton Lens buffer count", "Ray Receiver Graviton Lens buffer count", "射线接收器透镜缓冲数量");
I18N.Add("Dismantle blueprint selected buildings", "Dismantle blueprint selected buildings", "拆除蓝图选中的建筑");
I18N.Add("Shortcut keys for showing stars' name", "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键"); I18N.Add("Shortcut keys for showing stars' name", "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键");
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航"); I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航"); I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
@@ -313,6 +314,9 @@ public static class UIConfigWindow
x = 400f; x = 400f;
y += 18f; y += 18f;
y += 36f;
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DismantleBlueprintSelectionEnabled, "Dismantle blueprint selected buildings");
{ {
y += 36f; y += 36f;
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range"); wnd.AddCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");

View File

@@ -146,6 +146,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
FactoryPatch.LabBufferExtraCountForAdvancedAssemble = Config.Bind("Factory", "LabBufferExtraCountForAdvancedAssemble", 3, new ConfigDescription("Extra buffer count for Self-evolution Labs", new AcceptableValueRange<int>(1, 10))); FactoryPatch.LabBufferExtraCountForAdvancedAssemble = Config.Bind("Factory", "LabBufferExtraCountForAdvancedAssemble", 3, new ConfigDescription("Extra buffer count for Self-evolution Labs", new AcceptableValueRange<int>(1, 10)));
FactoryPatch.LabBufferMaxCountForResearch = Config.Bind("Factory", "LabBufferMaxCountForResearch", 10, new ConfigDescription("Buffer count for researching in labs", new AcceptableValueRange<int>(2, 20))); FactoryPatch.LabBufferMaxCountForResearch = Config.Bind("Factory", "LabBufferMaxCountForResearch", 10, new ConfigDescription("Buffer count for researching in labs", new AcceptableValueRange<int>(2, 20)));
FactoryPatch.ReceiverBufferCount = Config.Bind("Factory", "ReceiverBufferCount", 1, new ConfigDescription("Ray Receiver Graviton Lens buffer count", new AcceptableValueRange<int>(1, 20))); FactoryPatch.ReceiverBufferCount = Config.Bind("Factory", "ReceiverBufferCount", 1, new ConfigDescription("Ray Receiver Graviton Lens buffer count", new AcceptableValueRange<int>(1, 20)));
FactoryPatch.DismantleBlueprintSelectionEnabled = Config.Bind("Factory", "DismantleBlueprintSelection", false,
"Dismantle blueprint selected buildings");
LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true, LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
"Logistics capacity related tweaks"); "Logistics capacity related tweaks");
LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false, LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,

View File

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

View File

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