ActionBlocker CanThrow uses EntityUid exclusively
This commit is contained in:
@@ -51,18 +51,13 @@ namespace Content.Shared.ActionBlocker
|
|||||||
return !ev.Cancelled;
|
return !ev.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanThrow(IEntity entity)
|
|
||||||
{
|
|
||||||
var ev = new ThrowAttemptEvent(entity);
|
|
||||||
|
|
||||||
RaiseLocalEvent(entity.Uid, ev);
|
|
||||||
|
|
||||||
return !ev.Cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanThrow(EntityUid uid)
|
public bool CanThrow(EntityUid uid)
|
||||||
{
|
{
|
||||||
return CanThrow(EntityManager.GetEntity(uid));
|
var ev = new ThrowAttemptEvent(uid);
|
||||||
|
|
||||||
|
RaiseLocalEvent(uid, ev);
|
||||||
|
|
||||||
|
return !ev.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanSpeak(IEntity entity)
|
public bool CanSpeak(IEntity entity)
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ namespace Content.Shared.Interaction
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool TryThrowInteraction(IEntity user, IEntity item)
|
public bool TryThrowInteraction(IEntity user, IEntity item)
|
||||||
{
|
{
|
||||||
if (user == null || item == null || !_actionBlockerSystem.CanThrow(user)) return false;
|
if (user == null || item == null || !_actionBlockerSystem.CanThrow(user.Uid)) return false;
|
||||||
|
|
||||||
ThrownInteraction(user, item);
|
ThrownInteraction(user, item);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ namespace Content.Shared.Throwing
|
|||||||
{
|
{
|
||||||
public class ThrowAttemptEvent : CancellableEntityEventArgs
|
public class ThrowAttemptEvent : CancellableEntityEventArgs
|
||||||
{
|
{
|
||||||
public ThrowAttemptEvent(IEntity entity)
|
public ThrowAttemptEvent(EntityUid uid)
|
||||||
{
|
{
|
||||||
Entity = entity;
|
Uid = uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEntity Entity { get; }
|
public EntityUid Uid { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user