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 item action behaviors.
///
public interface IItemActionBehavior : IExposeData
{
}
///
/// Base class for all item action event args
///
public abstract class ItemActionEventArgs : EventArgs
{
///
/// Entity performing the action.
///
public readonly IEntity Performer;
///
/// Item being used to perform the action
///
public readonly IEntity Item;
///
/// Action being performed
///
public readonly ItemActionType ActionType;
///
/// Item actions component of the item.
///
public readonly ItemActionsComponent ItemActions;
public ItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType)
{
Performer = performer;
ActionType = actionType;
Item = item;
if (!Item.TryGetComponent(out ItemActions))
{
throw new InvalidOperationException($"performer {performer.Name} tried to perform item action {actionType} " +
$" for item {Item.Name} but the item had no ItemActionsComponent," +
" which should never occur");
}
}
}
}