diff --git a/src/Decentralized/ShowcaseCases.cs b/src/Decentralized/ShowcaseCases.cs index 69579b9..acf2c41 100644 --- a/src/Decentralized/ShowcaseCases.cs +++ b/src/Decentralized/ShowcaseCases.cs @@ -99,14 +99,19 @@ namespace Decentralized Place(item); Log.Info($"展示样例(鉴定){_next}/{All.Count}:{c.Name}"); })); - ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Clear counter + half of storage (test)", () => Log.Guard("清柜台与一半储物", () => + ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Clear desk + half of storage and machine bays (test)", () => Log.Guard("清柜台与一半储物", () => { var e = EmporiumEntry.Instance; int counter = 0, bays = 0; - foreach (var it in e.backInvinvElement.childItems.ToList()) { it.Destroy(); counter++; } - var storage = e.invElement.childItems.Where(i => i.identifier != null && i.identifier.StartsWith("storage_bay")).ToList(); - for (int i = 0; i < storage.Count; i += 2) { storage[i].Destroy(); bays++; } - Log.Info($"清空柜台 {counter} 件;储物箱 {storage.Count} 个里去掉 {bays} 个"); + foreach (var inv in new[] { e.backInvinvElement, e.backInvinvElementCounter, e.frontInvinvElement }) + if (inv != null) foreach (var it in inv.childItems.ToList()) { it.Destroy(); counter++; } + var storage = e.invElement.childItems.Where(i => i.identifier != null && (i.identifier.StartsWith("storage_bay") || i.identifier.StartsWith("machine_bay"))).ToList(); + foreach (var kind in storage.GroupBy(i => i.identifier)) + { + var list = kind.ToList(); + for (int i = 0; i < list.Count; i += 2) { list[i].Destroy(); bays++; } + } + Log.Info($"清空桌面 {counter} 件;储藏区和机器区 {storage.Count} 个里去掉 {bays} 个"); })); ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Paper: dump starters (test)", () => Log.Guard("纸张起点", () => {