Fix server exception on emptying a StackComponent.cs.
This commit is contained in:
@@ -9,10 +9,8 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components.Timers;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Timers;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -86,8 +84,9 @@ namespace Content.Server.GameObjects.Components.Stack
|
||||
|
||||
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.Using.TryGetComponent<StackComponent>(out var stack))
|
||||
{
|
||||
if (!eventArgs.Using.TryGetComponent<StackComponent>(out var stack))
|
||||
return false;
|
||||
|
||||
if (!stack.StackType.Equals(StackType))
|
||||
{
|
||||
return false;
|
||||
@@ -110,18 +109,15 @@ namespace Content.Server.GameObjects.Components.Stack
|
||||
|
||||
if (stack.AvailableSpace == 0)
|
||||
{
|
||||
Owner.SpawnTimer(300, () => popupPos.PopupMessage(eventArgs.User, "Stack is now full."));
|
||||
eventArgs.Using.SpawnTimer(300, () => popupPos.PopupMessage(eventArgs.User, "Stack is now full."));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (toTransfer == 0 && stack.AvailableSpace == 0)
|
||||
{
|
||||
popupPos.PopupMessage(eventArgs.User, "Stack is already full.");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
|
||||
Reference in New Issue
Block a user