Files
crystall-punk-14/Content.Shared/Interfaces/GameObjects/Components/Interaction/IAttack.cs

44 lines
1.3 KiB
C#
Raw Normal View History

#nullable enable
2020-08-31 18:55:42 +02:00
using System;
2021-01-23 22:45:23 +01:00
using Robust.Shared.Analyzers;
2020-08-31 18:55:42 +02:00
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>
2021-01-23 20:00:29 +01:00
[RequiresExplicitImplementation]
public interface IAttack
{
2020-08-31 18:55:42 +02:00
// Redirects to ClickAttack by default.
2021-04-29 03:23:15 +10:00
[Obsolete("WideAttack")]
2020-08-31 18:55:42 +02:00
bool WideAttack(AttackEventArgs eventArgs) => ClickAttack(eventArgs);
2021-04-29 03:23:15 +10:00
[Obsolete("Use ClickAttack instead")]
2020-08-31 18:55:42 +02:00
bool ClickAttack(AttackEventArgs eventArgs);
}
public class AttackEventArgs : EntityEventArgs
{
public AttackEventArgs(IEntity user, EntityCoordinates clickLocation, bool wideAttack, EntityUid target = default)
{
User = user;
ClickLocation = clickLocation;
2020-08-31 18:55:42 +02:00
WideAttack = wideAttack;
Target = target;
2020-09-02 15:22:26 +02:00
IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var targetEntity);
2020-09-02 15:22:26 +02:00
TargetEntity = targetEntity;
}
public IEntity User { get; }
public EntityCoordinates ClickLocation { get; }
2020-08-31 18:55:42 +02:00
public bool WideAttack { get; }
public EntityUid Target { get; }
2020-09-02 15:22:26 +02:00
public IEntity? TargetEntity { get; }
}
}