diff --git a/CheatEnabler/Patches/DysonSpherePatch.cs b/CheatEnabler/Patches/DysonSpherePatch.cs index 306bbf1..c4db0ab 100644 --- a/CheatEnabler/Patches/DysonSpherePatch.cs +++ b/CheatEnabler/Patches/DysonSpherePatch.cs @@ -134,12 +134,12 @@ public class DysonSpherePatch : PatchImpl { UpdateSailLifeTime(); UpdateSailsCacheForThisGame(); - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin += OnGameBegin; } protected override void OnDisable() { - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin -= OnGameBegin; } private static void UpdateSailLifeTime() @@ -172,7 +172,7 @@ public class DysonSpherePatch : PatchImpl _sailsCacheCapacity[index] = capacity; } - private static void GameMain_Begin_Postfix() + private static void OnGameBegin() { UpdateSailsCacheForThisGame(); UpdateSailLifeTime(); diff --git a/CheatEnabler/Patches/FactoryPatch.cs b/CheatEnabler/Patches/FactoryPatch.cs index cb1012c..35aac5b 100644 --- a/CheatEnabler/Patches/FactoryPatch.cs +++ b/CheatEnabler/Patches/FactoryPatch.cs @@ -94,14 +94,14 @@ public class FactoryPatch : PatchImpl ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value); Enable(true); CargoTrafficPatch.Enable(true); - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild; + GameLogicProc.OnGameBegin += OnGameBegin_For_ImmBuild; GameLogicProc.OnDataLoaded += OnDataLoaded; } public static void Uninit() { GameLogicProc.OnDataLoaded -= OnDataLoaded; - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild; + GameLogicProc.OnGameBegin -= OnGameBegin_For_ImmBuild; CargoTrafficPatch.Enable(false); Enable(false); ImmediateBuild.Enable(false); @@ -292,7 +292,7 @@ public class FactoryPatch : PatchImpl } } - private static void GameMain_Begin_Postfix_For_ImmBuild() + private static void OnGameBegin_For_ImmBuild() { if (DSPGame.IsMenuDemo) return; var factory = GameMain.mainPlayer?.factory; @@ -629,12 +629,12 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { InitSignalBelts(); - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin += OnGameBegin; } protected override void OnDisable() { - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin -= OnGameBegin; _initialized = false; _signalBelts = null; _signalBeltsCapacity = 0; @@ -865,7 +865,7 @@ public class FactoryPatch : PatchImpl set.Remove(v); } - private static void GameMain_Begin_Postfix() + private static void OnGameBegin() { if (DSPGame.IsMenuDemo) return; if (BeltSignalGeneratorEnabled.Value) InitSignalBelts(); diff --git a/UXAssist/Functions/FactoryFunctions.cs b/UXAssist/Functions/FactoryFunctions.cs index 6d181d0..9926a22 100644 --- a/UXAssist/Functions/FactoryFunctions.cs +++ b/UXAssist/Functions/FactoryFunctions.cs @@ -26,9 +26,9 @@ public static class FactoryFunctions public static bool ObjectIsBeltOrInserter(PlanetFactory factory, int objId) { - if (objId == 0) return false; - ItemProto proto = LDB.items.Select(objId > 0 ? factory.entityPool[objId].protoId : factory.prebuildPool[-objId].protoId); - return proto != null && (proto.prefabDesc.isBelt || proto.prefabDesc.isInserter); + if (objId == 0) return false; + ItemProto proto = LDB.items.Select(objId > 0 ? factory.entityPool[objId].protoId : factory.prebuildPool[-objId].protoId); + return proto != null && (proto.prefabDesc.isBelt || proto.prefabDesc.isInserter); } public static void DismantleBlueprintSelectedBuildings() diff --git a/UXAssist/Patches/DysonSpherePatch.cs b/UXAssist/Patches/DysonSpherePatch.cs index a7d2bb3..4db947f 100644 --- a/UXAssist/Patches/DysonSpherePatch.cs +++ b/UXAssist/Patches/DysonSpherePatch.cs @@ -269,14 +269,14 @@ public class DysonSpherePatch : PatchImpl protected override void OnEnable() { InitNodeForAbsorb(); - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; - GameLogicProc.OnGameEnd += GameMain_End_Postfix; + GameLogicProc.OnGameBegin += OnGameBegin; + GameLogicProc.OnGameEnd += OnGameEnd; } protected override void OnDisable() { - GameLogicProc.OnGameEnd -= GameMain_End_Postfix; - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameEnd -= OnGameEnd; + GameLogicProc.OnGameBegin -= OnGameBegin; _initialized = false; _nodeForAbsorb = null; } @@ -347,12 +347,12 @@ public class DysonSpherePatch : PatchImpl return comp is { Count: > 0 }; } - private static void GameMain_Begin_Postfix() + private static void OnGameBegin() { InitNodeForAbsorb(); } - private static void GameMain_End_Postfix() + private static void OnGameEnd() { _initialized = false; _nodeForAbsorb = null; diff --git a/UXAssist/Patches/FactoryPatch.cs b/UXAssist/Patches/FactoryPatch.cs index 4a570d3..e0186e7 100644 --- a/UXAssist/Patches/FactoryPatch.cs +++ b/UXAssist/Patches/FactoryPatch.cs @@ -45,6 +45,9 @@ public class FactoryPatch : PatchImpl public static ConfigEntry EjectorBufferCount; public static ConfigEntry SiloBufferCount; public static ConfigEntry ShortcutKeysForBlueprintCopyEnabled; + public static ConfigEntry PressShiftToTakeWholeBeltItemsEnabled; + public static ConfigEntry PressShiftToTakeWholeBeltItemsIncludeBranches; + public static ConfigEntry PressShiftToTakeWholeBeltItemsIncludeInserters; private static PressKeyBind _doNotRenderEntitiesKey; private static PressKeyBind _offgridfForPathsKey; @@ -131,6 +134,7 @@ public class FactoryPatch : PatchImpl ReceiverBufferCount.SettingChanged += (_, _) => TweakBuildingBuffer.RefreshReceiverBufferCount(); EjectorBufferCount.SettingChanged += (_, _) => TweakBuildingBuffer.RefreshEjectorBufferCount(); SiloBufferCount.SettingChanged += (_, _) => TweakBuildingBuffer.RefreshSiloBufferCount(); + PressShiftToTakeWholeBeltItemsEnabled.SettingChanged += (_, _) => PressShiftToTakeWholeBeltItems.Enable(PressShiftToTakeWholeBeltItemsEnabled.Value); } public static void Start() @@ -150,6 +154,7 @@ public class FactoryPatch : PatchImpl BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value); TankFastFillInAndTakeOut.Enable(TankFastFillInAndTakeOutEnabled.Value); TweakBuildingBuffer.Enable(TweakBuildingBufferEnabled.Value); + PressShiftToTakeWholeBeltItems.Enable(PressShiftToTakeWholeBeltItemsEnabled.Value); Enable(true); UpdateTankFastFillInAndTakeOutMultiplierRealValue(); @@ -159,6 +164,7 @@ public class FactoryPatch : PatchImpl { Enable(false); + PressShiftToTakeWholeBeltItems.Enable(false); TweakBuildingBuffer.Enable(false); TankFastFillInAndTakeOut.Enable(false); BeltSignalsForBuyOut.Enable(false); @@ -276,12 +282,12 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { - GameLogicProc.OnGameEnd += GameMain_End_Postfix; + GameLogicProc.OnGameEnd += OnGameEnd; } protected override void OnDisable() { - GameLogicProc.OnGameEnd -= GameMain_End_Postfix; + GameLogicProc.OnGameEnd -= OnGameEnd; if (_sunlight) { _sunlight.transform.localEulerAngles = new Vector3(0f, 180f); @@ -292,7 +298,7 @@ public class FactoryPatch : PatchImpl _nightlightInitialized = false; } - private static void GameMain_End_Postfix() + private static void OnGameEnd() { if (_sunlight) { @@ -1405,16 +1411,16 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; - GameLogicProc.OnGameEnd += GameMain_End_Postfix; + GameLogicProc.OnGameBegin += OnGameBegin; + GameLogicProc.OnGameEnd += OnGameEnd; FixProto(); } protected override void OnDisable() { UnfixProto(); - GameLogicProc.OnGameEnd -= GameMain_End_Postfix; - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameEnd -= OnGameEnd; + GameLogicProc.OnGameBegin -= OnGameBegin; } public static void AlternatelyChanged() @@ -1465,12 +1471,12 @@ public class FactoryPatch : PatchImpl OldDragBuildDist.Clear(); } - private static void GameMain_Begin_Postfix() + private static void OnGameBegin() { FixProto(); } - private static void GameMain_End_Postfix() + private static void OnGameEnd() { UnfixProto(); } @@ -1782,12 +1788,12 @@ public class FactoryPatch : PatchImpl { AddBeltSignalProtos(); GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin += OnGameBegin; } protected override void OnDisable() { - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin -= OnGameBegin; GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; } @@ -1809,7 +1815,7 @@ public class FactoryPatch : PatchImpl RemovePlanetSignalBelts(factory.index); } - private static void GameMain_Begin_Postfix() + private static void OnGameBegin() { _clusterSeedKey = GameMain.data.GetClusterSeedKey(); InitSignalBelts(); @@ -2233,4 +2239,166 @@ public class FactoryPatch : PatchImpl return matcher.InstructionEnumeration(); } } + + private class PressShiftToTakeWholeBeltItems : PatchImpl + { + private static long nextTimei = 0; + + protected override void OnEnable() + { + GameLogicProc.OnGameBegin += OnGameBegin; + } + + protected override void OnDisable() + { + GameLogicProc.OnGameBegin -= OnGameBegin; + } + + private static void OnGameBegin() + { + nextTimei = 0; + } + + [HarmonyTranspiler] + [HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityDown), MethodType.Getter)] + [HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityPress), MethodType.Getter)] + private static IEnumerable VFInput_fastTransferWithEntityDown_Transpiler(IEnumerable instructions, ILGenerator generator) + { + var matcher = new CodeMatcher(instructions, generator); + matcher.MatchForward(false, + new CodeMatch(OpCodes.Ldsfld, AccessTools.Field(typeof(VFInput), nameof(VFInput.shift))), + new CodeMatch(ci => ci.opcode == OpCodes.Brtrue || ci.opcode == OpCodes.Brtrue_S) + ); + var lables = matcher.Labels; + matcher.RemoveInstructions(2); + matcher.Labels.AddRange(lables); + return matcher.InstructionEnumeration(); + } + + [HarmonyTranspiler] + [HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GameTick))] + private static IEnumerable PlayerAction_Inspect_GameTick_Transpiler(IEnumerable instructions, ILGenerator generator) + { + var matcher = new CodeMatcher(instructions, generator); + matcher.MatchForward(false, + new CodeMatch(OpCodes.Ldc_I4_1), + new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.fastFillIn))) + ); + matcher.SetAndAdvance(OpCodes.Ldsfld, AccessTools.Field(typeof(VFInput), nameof(VFInput.shift))).Insert( + new CodeInstruction(OpCodes.Ldc_I4_0), + new CodeInstruction(OpCodes.Ceq) + ); + + var label0 = generator.DefineLabel(); + var label1 = generator.DefineLabel(); + matcher.Start().MatchForward(false, + new CodeMatch(ci => ci.IsStloc()), + new CodeMatch(OpCodes.Ldc_I4_0), + new CodeMatch(ci => ci.IsStloc()), + new CodeMatch(OpCodes.Ldloc_0), + new CodeMatch(ci => ci.IsLdloc()), + new CodeMatch(ci => ci.IsLdloc()), + new CodeMatch(ci => ci.IsLdloc()), + new CodeMatch(ci => ci.IsLdloc()), + new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastTakeOut))) + ).Advance(8).InsertAndAdvance( + new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(VFInput), nameof(VFInput.shift))), + new CodeInstruction(OpCodes.Brfalse_S, label0), + new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(PressShiftToTakeWholeBeltItems), nameof(EntityFastTakeOutAlt))), + new CodeInstruction(OpCodes.Br, label1) + ).Labels.Add(label0); + matcher.Advance(1).Labels.Add(label1); + return matcher.InstructionEnumeration(); + } + + private static void EntityFastTakeOutAlt(PlanetFactory factory, int entityId, bool toPackage, out ItemBundle itemBundle, out bool full) + { + if (factory._tmp_items == null) + { + factory._tmp_items = new ItemBundle(); + } + else + { + factory._tmp_items.Clear(); + } + itemBundle = factory._tmp_items; + full = false; + if (GameMain.instance.timei < nextTimei) return; + nextTimei = GameMain.instance.timei + 12; + if (entityId == 0 || factory.entityPool[entityId].id != entityId) + { + return; + } + ref var entityData = ref factory.entityPool[entityId]; + if (entityData.beltId <= 0) return; + var cargoTraffic = factory.cargoTraffic; + ref var belt = ref cargoTraffic.beltPool[entityData.beltId]; + if (belt.id != entityData.beltId) return; + var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId); + var end = cargoPath.bufferLength - 1; + var buffer = cargoPath.buffer; + Dictionary takeOutItems = []; + var mainPlayer = factory.gameData.mainPlayer; + var factorySystem = factory.factorySystem; + foreach (var beltId in cargoPath.belts) + { + ref var b = ref cargoTraffic.beltPool[beltId]; + if (b.id != beltId) return; + // From WriteObjectConn: Only slot 4 to 11 is used for belt <-> inserter connections (method argument slot/otherSlot is -1 there) + for (int cidx = 4; cidx < 12; cidx++) + { + factory.ReadObjectConn(b.entityId, cidx, out var isOutput, out var otherObjId, out var otherSlot); + if (otherObjId <= 0) continue; + var inserterId = factory.entityPool[otherObjId].inserterId; + if (inserterId <= 0) continue; + ref var inserter = ref factorySystem.inserterPool[inserterId]; + if (inserter.id != inserterId) continue; + if (inserter.itemId > 0 && inserter.stackCount > 0) + { + takeOutItems[inserter.itemId] = (takeOutItems.TryGetValue(inserter.itemId, out var value) ? value : 0) + + ((long)inserter.itemCount | ((long)inserter.itemInc << 32)); + inserter.itemId = 0; + inserter.stackCount = 0; + inserter.itemCount = 0; + inserter.itemInc = 0; + } + } + } + int i = 0; + while (i <= end) + { + if (buffer[i] >= 246) + { + i += 250 - buffer[i]; + var index = buffer[i + 1] - 1 + (buffer[i + 2] - 1) * 100 + (buffer[i + 3] - 1) * 10000 + (buffer[i + 4] - 1) * 1000000; + ref var cargo = ref cargoPath.cargoContainer.cargoPool[index]; + var item = cargo.item; + var stack = cargo.stack; + var inc = cargo.inc; + takeOutItems[item] = (takeOutItems.TryGetValue(item, out var value) ? value : 0) + + ((long)stack | ((long)inc << 32)); + Array.Clear(buffer, i - 4, 10); + i += 10; + if (cargoPath.updateLen < i) cargoPath.updateLen = i; + cargoPath.cargoContainer.RemoveCargo(index); + } + else + { + i += 5; + if (i > end && i < end + 5) + { + i = end; + } + } + } + foreach (var kvp in takeOutItems) + { + var added = mainPlayer.TryAddItemToPackage(kvp.Key, (int)(kvp.Value & 0xFFFFFFFF), (int)(kvp.Value >> 32), true, entityId); + if (added > 0) + { + UIItemup.Up(kvp.Key, added); + } + } + } + } } diff --git a/UXAssist/Patches/PersistPatch.cs b/UXAssist/Patches/PersistPatch.cs index 52a645f..76ffb5e 100644 --- a/UXAssist/Patches/PersistPatch.cs +++ b/UXAssist/Patches/PersistPatch.cs @@ -4,7 +4,6 @@ using System.Reflection.Emit; using HarmonyLib; using UnityEngine; using UXAssist.Common; -using GameLogicProc = UXAssist.Common.GameLogic; namespace UXAssist.Patches; @@ -13,12 +12,10 @@ public class PersistPatch : PatchImpl public static void Start() { Enable(true); - GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; } public static void Uninit() { - GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; Enable(false); } @@ -173,153 +170,4 @@ public class PersistPatch : PatchImpl { return false; } - - [HarmonyTranspiler] - [HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityDown), MethodType.Getter)] - [HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityPress), MethodType.Getter)] - private static IEnumerable VFInput_fastTransferWithEntityDown_Transpiler(IEnumerable instructions, ILGenerator generator) - { - var matcher = new CodeMatcher(instructions, generator); - matcher.MatchForward(false, - new CodeMatch(OpCodes.Ldsfld, AccessTools.Field(typeof(VFInput), nameof(VFInput.shift))), - new CodeMatch(ci => ci.opcode == OpCodes.Brtrue || ci.opcode == OpCodes.Brtrue_S) - ); - var lables = matcher.Labels; - matcher.RemoveInstructions(2); - matcher.Labels.AddRange(lables); - return matcher.InstructionEnumeration(); - } - - [HarmonyTranspiler] - [HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GameTick))] - private static IEnumerable PlayerAction_Inspect_GameTick_Transpiler(IEnumerable instructions, ILGenerator generator) - { - var matcher = new CodeMatcher(instructions, generator); - matcher.MatchForward(false, - new CodeMatch(OpCodes.Ldc_I4_1), - new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.fastFillIn))) - ); - matcher.SetAndAdvance(OpCodes.Ldsfld, AccessTools.Field(typeof(VFInput), nameof(VFInput.shift))).Insert( - new CodeInstruction(OpCodes.Ldc_I4_0), - new CodeInstruction(OpCodes.Ceq) - ); - - var label0 = generator.DefineLabel(); - var label1 = generator.DefineLabel(); - matcher.Start().MatchForward(false, - new CodeMatch(ci => ci.IsStloc()), - new CodeMatch(OpCodes.Ldc_I4_0), - new CodeMatch(ci => ci.IsStloc()), - new CodeMatch(OpCodes.Ldloc_0), - new CodeMatch(ci => ci.IsLdloc()), - new CodeMatch(ci => ci.IsLdloc()), - new CodeMatch(ci => ci.IsLdloc()), - new CodeMatch(ci => ci.IsLdloc()), - new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastTakeOut))) - ).Advance(8).InsertAndAdvance( - new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(VFInput), nameof(VFInput.shift))), - new CodeInstruction(OpCodes.Brfalse_S, label0), - new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(PersistPatch), nameof(PersistPatch.EntityFastTakeOutAlt))), - new CodeInstruction(OpCodes.Br, label1) - ).Labels.Add(label0); - matcher.Advance(1).Labels.Add(label1); - return matcher.InstructionEnumeration(); - } - - private static long nextTimei = 0; - - private static void EntityFastTakeOutAlt(PlanetFactory factory, int entityId, bool toPackage, out ItemBundle itemBundle, out bool full) - { - if (factory._tmp_items == null) - { - factory._tmp_items = new ItemBundle(); - } - else - { - factory._tmp_items.Clear(); - } - itemBundle = factory._tmp_items; - full = false; - if (GameMain.instance.timei < nextTimei) return; - nextTimei = GameMain.instance.timei + 12; - if (entityId == 0 || factory.entityPool[entityId].id != entityId) - { - return; - } - ref var entityData = ref factory.entityPool[entityId]; - if (entityData.beltId <= 0) return; - var cargoTraffic = factory.cargoTraffic; - ref var belt = ref cargoTraffic.beltPool[entityData.beltId]; - if (belt.id != entityData.beltId) return; - var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId); - var end = cargoPath.bufferLength - 1; - var buffer = cargoPath.buffer; - Dictionary takeOutItems = []; - var mainPlayer = factory.gameData.mainPlayer; - var factorySystem = factory.factorySystem; - foreach (var beltId in cargoPath.belts) - { - ref var b = ref cargoTraffic.beltPool[beltId]; - if (b.id != beltId) return; - // From WriteObjectConn: Only slot 4 to 11 is used for belt <-> inserter connections (slot/otherSlot is -1 there) - for (int cidx = 4; cidx < 12; cidx++) - { - factory.ReadObjectConn(b.entityId, cidx, out var isOutput, out var otherObjId, out var otherSlot); - if (otherObjId <= 0) continue; - var inserterId = factory.entityPool[otherObjId].inserterId; - if (inserterId <= 0) continue; - ref var inserter = ref factorySystem.inserterPool[inserterId]; - if (inserter.id != inserterId) continue; - if (inserter.itemId > 0 && inserter.stackCount > 0) - { - takeOutItems[inserter.itemId] = (takeOutItems.TryGetValue(inserter.itemId, out var value) ? value : 0) - + ((long)inserter.itemCount | ((long)inserter.itemInc << 32)); - inserter.itemId = 0; - inserter.stackCount = 0; - inserter.itemCount = 0; - inserter.itemInc = 0; - } - } - } - int i = 0; - while (i <= end) - { - if (buffer[i] >= 246) - { - i += 250 - buffer[i]; - var index = buffer[i + 1] - 1 + (buffer[i + 2] - 1) * 100 + (buffer[i + 3] - 1) * 10000 + (buffer[i + 4] - 1) * 1000000; - ref var cargo = ref cargoPath.cargoContainer.cargoPool[index]; - var item = cargo.item; - var stack = cargo.stack; - var inc = cargo.inc; - takeOutItems[item] = (takeOutItems.TryGetValue(item, out var value) ? value : 0) - + ((long)stack | ((long)inc << 32)); - Array.Clear(buffer, i - 4, 10); - i += 10; - if (cargoPath.updateLen < i) cargoPath.updateLen = i; - cargoPath.cargoContainer.RemoveCargo(index); - } - else - { - i += 5; - if (i > end && i < end + 5) - { - i = end; - } - } - } - foreach (var kvp in takeOutItems) - { - var added = mainPlayer.TryAddItemToPackage(kvp.Key, (int)(kvp.Value & 0xFFFFFFFF), (int)(kvp.Value >> 32), true, entityId); - if (added > 0) - { - UIItemup.Up(kvp.Key, added); - } - } - } - - private static void GameMain_Begin_Postfix() - { - nextTimei = 0; - } } diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index 2e94b61..d4a10f4 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -140,6 +140,12 @@ public class UXAssist : BaseUnityPlugin, IModCanSave FactoryPatch.SiloBufferCount = Config.Bind("Factory", "SiloBufferCount", 1, new ConfigDescription("Silo buffer count", new AcceptableValueRange(1, 40))); FactoryPatch.ShortcutKeysForBlueprintCopyEnabled = Config.Bind("Factory", "DismantleBlueprintSelection", false, "Dismantle blueprint selected buildings"); + FactoryPatch.PressShiftToTakeWholeBeltItemsEnabled = Config.Bind("Factory", "PressShiftToTakeWholeBeltItems", false, + "Press Ctrl+Shift to take items from whole belts"); + FactoryPatch.PressShiftToTakeWholeBeltItemsIncludeBranches = Config.Bind("Factory", "PressShiftToTakeWholeBeltItemsIncludeBranches", true, + "Press Ctrl+Shift to take items from whole belts: Include branches"); + FactoryPatch.PressShiftToTakeWholeBeltItemsIncludeInserters = Config.Bind("Factory", "PressShiftToTakeWholeBeltItemsIncludeInserters", true, + "Press Ctrl+Shift to take items from whole belts: Include inserters"); LogisticsPatch.AutoConfigLogisticsEnabled = Config.Bind("Factory", "AutoConfigLogistics", false, "Auto-config logistic stations"); LogisticsPatch.AutoConfigLimitAutoReplenishCount = Config.Bind("Factory", "AutoConfigLimitAutoReplenishCount", false,