using Robust.Shared.GameStates;
namespace Content.Shared.Weapons.Melee.Components;
///
/// This is used for a melee weapon that throws whatever gets hit by it in a line
/// until it hits a wall or a time limit is exhausted.
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true)]
[Access(typeof(MeleeThrowOnHitSystem))]
public sealed partial class MeleeThrowOnHitComponent : Component
{
///
/// The speed at which hit entities should be thrown.
///
[DataField, AutoNetworkedField]
public float Speed = 10f;
///
/// The maximum distance the hit entity should be thrown.
///
[DataField, AutoNetworkedField]
public float Distance = 20f;
///
/// Whether or not anchorable entities should be unanchored when hit.
///
[DataField, AutoNetworkedField]
public bool UnanchorOnHit;
///
/// How long should this stun the target, if applicable?
///
[DataField, AutoNetworkedField]
public TimeSpan? StunTime;
///
/// Should this also work on a throw-hit?
///
[DataField, AutoNetworkedField]
public bool ActivateOnThrown;
///
/// Whether the entity can apply knockback this instance of being thrown.
/// If true, the entity cannot apply knockback.
///
[DataField, AutoNetworkedField]
[ViewVariables(VVAccess.ReadOnly)]
public bool ThrowOnCooldown;
///
/// Whether this item has hit anyone while it was thrown.
///
[DataField, AutoNetworkedField]
[ViewVariables(VVAccess.ReadOnly)]
public bool HitWhileThrown;
}
///
/// Raised a weapon entity with to see if a throw is allowed.
///
[ByRefEvent]
public record struct AttemptMeleeThrowOnHitEvent(EntityUid Target, EntityUid? User, bool Cancelled = false, bool Handled = false);
///
/// Raised a target entity before it is thrown by .
///
[ByRefEvent]
public record struct MeleeThrowOnHitStartEvent(EntityUid Weapon, EntityUid? User);