1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-04 19:42:17 +08:00

UXAsisst 1.3.6

This commit is contained in:
2025-05-25 10:55:03 +08:00
parent b6c182168b
commit f7e1a27be1
8 changed files with 69 additions and 21 deletions

View File

@@ -41,12 +41,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
public static ConfigEntry<int> LabBufferExtraCountForAdvancedAssemble;
public static ConfigEntry<int> LabBufferMaxCountForResearch;
public static ConfigEntry<int> ReceiverBufferCount;
public static ConfigEntry<bool> DismantleBlueprintSelectionEnabled;
public static ConfigEntry<bool> ShortcutKeysForBlueprintCopyEnabled;
private static PressKeyBind _doNotRenderEntitiesKey;
private static PressKeyBind _offgridfForPathsKey;
private static PressKeyBind _cutConveyorBeltKey;
private static PressKeyBind _dismantleBlueprintSelectionKey;
private static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
private static int _tankFastFillInAndTakeOutMultiplierRealValue = 2;
@@ -88,6 +89,15 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
);
I18N.Add("KEYDismantleBlueprintSelection", "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
_selectAllBuildingsInBlueprintCopyKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.A, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.KEYBOARD_KEYBIND,
name = "SelectAllBuildingsInBlueprintCopy",
canOverride = true
}
);
I18N.Add("KEYSelectAllBuildingsInBlueprintCopy", "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
BeltSignalsForBuyOut.InitPersist();
ProtectVeinsFromExhaustion.InitConfig();
@@ -182,8 +192,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
}
}
if (DismantleBlueprintSelectionEnabled.Value && _dismantleBlueprintSelectionKey.keyValue)
Functions.FactoryFunctions.DismantleBlueprintSelectedBuildings();
if (ShortcutKeysForBlueprintCopyEnabled.Value)
{
if (_dismantleBlueprintSelectionKey.keyValue)
Functions.FactoryFunctions.DismantleBlueprintSelectedBuildings();
if (_selectAllBuildingsInBlueprintCopyKey.keyValue)
Functions.FactoryFunctions.SelectAllBuildingsInBlueprintCopy();
}
}
public static void Export(BinaryWriter w)

View File

@@ -466,10 +466,11 @@ public static class LogisticsPatch
private class AllowOverflowInLogistics : PatchImpl<AllowOverflowInLogistics>
{
private static bool _bludprintPasting;
private static bool _blueprintPasting;
// Do not check for overflow when try to send hand items into storages
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
@@ -516,7 +517,7 @@ public static class LogisticsPatch
var oldLabels = matcher.Labels;
matcher.Labels = [];
matcher.InsertAndAdvance(
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(AllowOverflowInLogistics), nameof(_bludprintPasting))).WithLabels(oldLabels),
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(AllowOverflowInLogistics), nameof(_blueprintPasting))).WithLabels(oldLabels),
new CodeInstruction(OpCodes.Brfalse, label)
);
matcher.Advance(9).Labels.Add(label);
@@ -527,14 +528,14 @@ public static class LogisticsPatch
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
private static void BuildTool_BlueprintPaste_CreatePrebuilds_Prefix()
{
_bludprintPasting = true;
_blueprintPasting = true;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
private static void BuildTool_BlueprintPaste_CreatePrebuilds_Postfix()
{
_bludprintPasting = false;
_blueprintPasting = false;
}
}