using System.Numerics;
using Content.Shared.Damage;
using Robust.Shared.Map;
namespace Content.Shared.Weapons.Hitscan.Events;
///
/// Raised on the hitscan entity when "fired". This could be from reflections or from the gun. This is the catalyst that
/// other systems will listen for to actually shoot the gun.
///
[ByRefEvent]
public record struct HitscanTraceEvent
{
///
/// Location the hitscan was fired from.
///
public EntityCoordinates FromCoordinates;
///
/// Direction that the ray was fired towards.
///
public Vector2 ShotDirection;
///
/// Gun that was fired - this will always be the original weapon even if reflected.
///
public EntityUid Gun;
///
/// Player who shot the gun, if null the gun was fired by itself.
///
public EntityUid? Shooter;
///
/// Target that was being aimed at (Not necessarily hit).
///
public EntityUid? Target;
}
///
/// All data known data for when a hitscan is actually fired.
///
public record struct HitscanRaycastFiredData
{
///
/// Direction that the ray was fired towards.
///
public Vector2 ShotDirection;
///
/// The entity that got hit, if null the raycast didn't hit anyone.
///
public EntityUid? HitEntity;
///
/// Gun that fired the raycast.
///
public EntityUid Gun;
///
/// Player who shot the gun, if null the gun was fired by itself.
///
public EntityUid? Shooter;
}
///
/// Try to hit the targeted entity with a hitscan laser. Stuff like the reflection system should listen for this and
/// cancel the event if the laser was reflected.
///
[ByRefEvent]
public struct AttemptHitscanRaycastFiredEvent
{
///
/// Data for the hitscan that was fired.
///
public HitscanRaycastFiredData Data;
///
/// Set to true the hitscan is cancelled (e.g. due to reflection).
/// Cancelled hitscans should not apply damage or trigger follow-up effects.
///
public bool Cancelled;
}
///
/// Results of a hitscan raycast and will be raised on the raycast entity on itself. Stuff like the damage system should
/// listen for this. At this point we KNOW the laser hit the entity.
///
[ByRefEvent]
public struct HitscanRaycastFiredEvent
{
///
/// Data for the hitscan that was fired.
///
public HitscanRaycastFiredData Data;
}
[ByRefEvent]
public record struct HitscanDamageDealtEvent
{
///
/// Target that was dealt damage.
///
public EntityUid Target;
///
/// The amount of damage that the target was dealt.
///
public DamageSpecifier DamageDealt;
}