From a3bb6ea6095578406f44695efaf7a914ab971c28 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Tue, 15 Apr 2025 23:38:12 +0800 Subject: [PATCH] try to fix connection bug in feature `Cut Conveyor Belt` --- UXAssist/Functions/FactoryFunctions.cs | 9 +++++++++ UXAssist/Patches/PlayerPatch.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/UXAssist/Functions/FactoryFunctions.cs b/UXAssist/Functions/FactoryFunctions.cs index 418a86a..c4f7806 100644 --- a/UXAssist/Functions/FactoryFunctions.cs +++ b/UXAssist/Functions/FactoryFunctions.cs @@ -6,6 +6,15 @@ public static class FactoryFunctions { ref var belt = ref cargoTraffic.beltPool[beltId]; if (belt.id != beltId || belt.outputId <= 0) return; + + // Clear entity connection + var factory = cargoTraffic.factory; + factory.ReadObjectConn(belt.entityId, 0, out var isOutput, out var otherObjId, out var otherSlot); + if (isOutput && factory.entityPool[otherObjId].beltId == belt.outputId) { + factory.ClearObjectConnDirect(belt.entityId, 0); + factory.ClearObjectConnDirect(otherObjId, otherSlot); + } + // Alter belt connections 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); diff --git a/UXAssist/Patches/PlayerPatch.cs b/UXAssist/Patches/PlayerPatch.cs index 6e097e2..5a0c209 100644 --- a/UXAssist/Patches/PlayerPatch.cs +++ b/UXAssist/Patches/PlayerPatch.cs @@ -64,7 +64,7 @@ public static class PlayerPatch { EnhancedMechaForgeCountControl.Enable(EnhancedMechaForgeCountControlEnabled.Value); HideTipsForSandsChanges.Enable(HideTipsForSandsChangesEnabled.Value); - ShortcutKeysForStarsName.Enable(ShortcutKeysForAstrosNameEnabled.Value); + ShortcutKeysForStarsName.Enable(ShortcutKeysForStarsNameEnabled.Value); AutoNavigation.Enable(AutoNavigationEnabled.Value); }