diff --git a/Dustbin/CHANGELOG.md b/Dustbin/CHANGELOG.md index 2654423..c7e0882 100644 --- a/Dustbin/CHANGELOG.md +++ b/Dustbin/CHANGELOG.md @@ -4,6 +4,7 @@ ## Changelog * 1.4.0 + * `Storage dustbin`: Destroy splitter input to a storage placed above it, including stacked and proliferated cargo. Enabling dustbin mode also clears cached full-storage state. * `Tank dustbin`: Fix single tanks blocking liquid input after receiving their first stack, both with and without dustbin mode. * `Belt signal dustbin`: Restore item disposal and startup compatibility with the current game simulation loop after DSP 0.10.33/0.10.34 updates. * Refactorying Tank input logic codes, for better performance, and resolve a bug [#53](https://github.com/soarqin/DSP_Mods/issues/53) @@ -46,6 +47,7 @@ ## 更新日志 * 1.4.0 + * `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。 * `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。 * `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。 * 重构储液罐的输入逻辑代码,以提高性能并解决bug [#53](https://github.com/soarqin/DSP_Mods/issues/53) diff --git a/Dustbin/StoragePatch.cs b/Dustbin/StoragePatch.cs index 85f4aa0..6b64469 100644 --- a/Dustbin/StoragePatch.cs +++ b/Dustbin/StoragePatch.cs @@ -116,6 +116,7 @@ public static class StoragePatch if (storagePool[storageId].id != storageId) return; var enabled = _storageDustbinCheckBox.Checked; storagePool[storageId].IsDustbin = enabled; + storagePool[storageId].ResetOptimizationFlags(); if (!NebulaModAPI.IsMultiplayerActive) return; var planetId = window.factory.planetId; NebulaModAPI.MultiplayerSession.Network.SendPacketToLocalStar(new NebulaSupport.Packet.ToggleEvent(planetId, storageId, enabled)); @@ -210,6 +211,16 @@ public static class StoragePatch return matcher.InstructionEnumeration(); } + [HarmonyPrefix] + [HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.AddCargo))] + private static bool StorageComponent_AddCargo_Prefix(StorageComponent __instance, ref Cargo cargo, ref bool __result) + { + if (!__instance.IsDustbin) return true; + __result = cargo.item > 0 && cargo.stack > 0; + if (__result) Dustbin.CalcGetSands(cargo.item, cargo.stack, cargo.inc); + return false; + } + /* We keep this to make MOD compatible with older version */ [HarmonyPostfix] [HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.Import))]