Files
tbd-station-14/Content.Shared/Weapons/Melee/Events/MeleeHitEvent.cs
2023-04-27 11:56:51 -07:00

69 lines
2.3 KiB
C#

using Content.Shared.Damage;
using Robust.Shared.Audio;
namespace Content.Shared.Weapons.Melee.Events;
/// <summary>
/// Raised directed on the melee weapon entity used to attack something in combat mode,
/// whether through a click attack or wide attack.
/// </summary>
public sealed class MeleeHitEvent : HandledEntityEventArgs
{
/// <summary>
/// The base amount of damage dealt by the melee hit.
/// </summary>
public readonly DamageSpecifier BaseDamage;
/// <summary>
/// Modifier sets to apply to the hit event when it's all said and done.
/// This should be modified by adding a new entry to the list.
/// </summary>
public List<DamageModifierSet> ModifiersList = new();
/// <summary>
/// Damage to add to the default melee weapon damage. Applied before modifiers.
/// </summary>
/// <remarks>
/// This might be required as damage modifier sets cannot add a new damage type to a DamageSpecifier.
/// </remarks>
public DamageSpecifier BonusDamage = new();
/// <summary>
/// A list containing every hit entity. Can be zero.
/// </summary>
public IReadOnlyList<EntityUid> HitEntities;
/// <summary>
/// Used to define a new hit sound in case you want to override the default GenericHit.
/// Also gets a pitch modifier added to it.
/// </summary>
public SoundSpecifier? HitSoundOverride;
/// <summary>
/// The user who attacked with the melee weapon.
/// </summary>
public readonly EntityUid User;
/// <summary>
/// The melee weapon used.
/// </summary>
public readonly EntityUid Weapon;
/// <summary>
/// Check if this is true before attempting to do something during a melee attack other than changing/adding bonus damage. <br/>
/// For example, do not spend charges unless <see cref="IsHit"/> equals true.
/// </summary>
/// <remarks>
/// Examining melee weapons calls this event, but with <see cref="IsHit"/> set to false.
/// </remarks>
public bool IsHit = true;
public MeleeHitEvent(List<EntityUid> hitEntities, EntityUid user, EntityUid weapon, DamageSpecifier baseDamage)
{
HitEntities = hitEntities;
User = user;
Weapon = weapon;
BaseDamage = baseDamage;
}
}