Fix storage fill giving no reason for failing (#27122)

This commit is contained in:
DrSmugleaf
2024-04-18 20:24:13 -07:00
committed by GitHub
parent 6ec40900ef
commit 45df595c15
2 changed files with 29 additions and 3 deletions

View File

@@ -65,12 +65,23 @@ public sealed partial class StorageSystem
var sortedItems = items
.OrderByDescending(x => ItemSystem.GetItemShape(x.Comp).GetArea());
ClearCantFillReasons();
foreach (var ent in sortedItems)
{
if (Insert(uid, ent, out _, out var reason, storageComp: storage, playSound: false))
continue;
if (CantFillReasons.Count > 0)
{
var reasons = string.Join(", ", CantFillReasons.Select(s => Loc.GetString(s)));
if (reason == null)
reason = reasons;
else
reason += $", {reasons}";
}
Log.Error($"Tried to StorageFill {ToPrettyString(ent)} inside {ToPrettyString(uid)} but can't. reason: {reason}");
ClearCantFillReasons();
Del(ent);
}
}