mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user