using System;
using Content.Shared.Actions.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Shared.Actions.Behaviors
{
///
/// Currently just a marker interface delineating the different possible
/// types of action behaviors.
///
public interface IActionBehavior
{
}
///
/// Base class for all action event args
///
public abstract class ActionEventArgs : EventArgs
{
///
/// Entity performing the action.
///
public readonly EntityUid Performer;
///
/// Action being performed
///
public readonly ActionType ActionType;
///
/// Actions component of the performer.
///
public readonly SharedActionsComponent? PerformerActions;
public ActionEventArgs(EntityUid performer, ActionType actionType)
{
Performer = performer;
ActionType = actionType;
if (!IoCManager.Resolve().TryGetComponent(Performer, out PerformerActions))
{
throw new InvalidOperationException($"performer {IoCManager.Resolve().GetComponent(performer).EntityName} tried to perform action {actionType} " +
$" but the performer had no actions component," +
" which should never occur");
}
}
}
}