using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Interaction
{
///
/// This interface gives components behavior when being activated (by default,
/// this is done via the "E" key) when the user is in range and has unobstructed access to the target entity
/// (allows inside blockers). This includes activating an object in the world as well as activating an
/// object in inventory. Unlike IUse, this can be performed on entities that aren't in the active hand,
/// even when the active hand is currently holding something else.
///
[RequiresExplicitImplementation]
public interface IActivate
{
///
/// Called when this component is activated by another entity who is in range.
///
[Obsolete("Use ActivateInWorldMessage instead")]
void Activate(ActivateEventArgs eventArgs);
}
public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs
{
public ActivateEventArgs(IEntity user, IEntity target)
{
User = user;
Target = target;
}
public IEntity User { get; }
public IEntity Target { get; }
}
///
/// Raised when an entity is activated in the world.
///
[PublicAPI]
public class ActivateInWorldEvent : HandledEntityEventArgs, ITargetedInteractEventArgs
{
///
/// Entity that activated the target world entity.
///
public IEntity User { get; }
///
/// Entity that was activated in the world.
///
public IEntity Target { get; }
public ActivateInWorldEvent(IEntity user, IEntity target)
{
User = user;
Target = target;
}
}
}