Files
tbd-station-14/Content.Shared/Interfaces/GameObjects/Components/Interaction/IAttack.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

41 lines
1.2 KiB
C#

#nullable enable
using System;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Shared.Interfaces.GameObjects.Components
{
/// <summary>
/// This interface gives components behavior when being used to "attack".
/// </summary>
[RequiresExplicitImplementation]
public interface IAttack
{
// Redirects to ClickAttack by default.
bool WideAttack(AttackEventArgs eventArgs) => ClickAttack(eventArgs);
bool ClickAttack(AttackEventArgs eventArgs);
}
public class AttackEventArgs : EventArgs
{
public AttackEventArgs(IEntity user, EntityCoordinates clickLocation, bool wideAttack, EntityUid target = default)
{
User = user;
ClickLocation = clickLocation;
WideAttack = wideAttack;
Target = target;
IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var targetEntity);
TargetEntity = targetEntity;
}
public IEntity User { get; }
public EntityCoordinates ClickLocation { get; }
public bool WideAttack { get; }
public EntityUid Target { get; }
public IEntity? TargetEntity { get; }
}
}