Fix storage fill giving no reason for failing (#27122)
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Coordinates;
|
||||
using Content.Shared.Destructible;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Hands.Components;
|
||||
@@ -65,6 +64,8 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
private readonly List<ItemSizePrototype> _sortedSizes = new();
|
||||
private FrozenDictionary<string, ItemSizePrototype> _nextSmallest = FrozenDictionary<string, ItemSizePrototype>.Empty;
|
||||
|
||||
protected readonly List<string> CantFillReasons = [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -628,8 +629,15 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
if (CheckingCanInsert)
|
||||
return;
|
||||
|
||||
if (!CanInsert(uid, args.EntityUid, out _, component, ignoreStacks: true))
|
||||
if (!CanInsert(uid, args.EntityUid, out var reason, component, ignoreStacks: true))
|
||||
{
|
||||
#if DEBUG
|
||||
if (reason != null)
|
||||
CantFillReasons.Add(reason);
|
||||
#endif
|
||||
|
||||
args.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAppearance(Entity<StorageComponent?, AppearanceComponent?> entity)
|
||||
@@ -1072,7 +1080,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var saved = list[i];
|
||||
|
||||
|
||||
if (saved == location)
|
||||
{
|
||||
list.Remove(location);
|
||||
@@ -1259,6 +1267,13 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
protected void ClearCantFillReasons()
|
||||
{
|
||||
#if DEBUG
|
||||
CantFillReasons.Clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plays a clientside pickup animation for the specified uid.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user