Revert "Remove IContainer and move some functions to the system (#4351)" (#4361)

This commit is contained in:
metalgearsloth
2023-09-10 21:46:17 +10:00
committed by GitHub
parent 7892cc895f
commit 039b70f502
21 changed files with 486 additions and 308 deletions
@@ -1,26 +0,0 @@
using Robust.Shared.GameObjects;
namespace Robust.Shared.Containers;
public abstract partial class SharedContainerSystem
{
/// <summary>
/// Checks if the entity can be removed from this container.
/// </summary>
/// <returns>True if the entity can be removed, false otherwise.</returns>
public bool CanRemove(EntityUid toRemove, BaseContainer container)
{
if (!container.Contains(toRemove))
return false;
//raise events
var removeAttemptEvent = new ContainerIsRemovingAttemptEvent(container, toRemove);
RaiseLocalEvent(container.Owner, removeAttemptEvent, true);
if (removeAttemptEvent.Cancelled)
return false;
var gettingRemovedAttemptEvent = new ContainerGettingRemovedAttemptEvent(container, toRemove);
RaiseLocalEvent(toRemove, gettingRemovedAttemptEvent, true);
return !gettingRemovedAttemptEvent.Cancelled;
}
}