118 lines
2.9 KiB
C#
118 lines
2.9 KiB
C#
using Content.Shared.Body.Events;
|
|
using Content.Shared.DragDrop;
|
|
using Content.Shared.Emoting;
|
|
using Content.Shared.Interaction.Events;
|
|
using Content.Shared.Inventory.Events;
|
|
using Content.Shared.Item;
|
|
using Content.Shared.Movement;
|
|
using Content.Shared.Speech;
|
|
using Content.Shared.Throwing;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Shared.ActionBlocker
|
|
{
|
|
/// <summary>
|
|
/// Utility methods to check if a specific entity is allowed to perform an action.
|
|
/// </summary>
|
|
[UsedImplicitly]
|
|
public class ActionBlockerSystem : EntitySystem
|
|
{
|
|
public bool CanMove(EntityUid uid)
|
|
{
|
|
var ev = new MovementAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanInteract(EntityUid uid)
|
|
{
|
|
var ev = new InteractionAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanUse(EntityUid uid)
|
|
{
|
|
var ev = new UseAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanThrow(EntityUid uid)
|
|
{
|
|
var ev = new ThrowAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanSpeak(EntityUid uid)
|
|
{
|
|
var ev = new SpeakAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanDrop(EntityUid uid)
|
|
{
|
|
var ev = new DropAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanPickup(EntityUid uid)
|
|
{
|
|
var ev = new PickupAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanEmote(EntityUid uid)
|
|
{
|
|
var ev = new EmoteAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanAttack(EntityUid uid, EntityUid? target = null)
|
|
{
|
|
var ev = new AttackAttemptEvent(uid, target);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanChangeDirection(EntityUid uid)
|
|
{
|
|
var ev = new ChangeDirectionAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanShiver(EntityUid uid)
|
|
{
|
|
var ev = new ShiverAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
|
|
public bool CanSweat(EntityUid uid)
|
|
{
|
|
var ev = new SweatAttemptEvent(uid);
|
|
RaiseLocalEvent(uid, ev);
|
|
|
|
return !ev.Cancelled;
|
|
}
|
|
}
|
|
}
|