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