Refactor disarms (#36546)

* Refactor disarms

- Move client stuff to shared
- Cleanup a bunch of stuff
- Ref events
- Fix the swing sound mispredict (I noticed it on target dummies).

* Revert this change

* minor review

* Rebiew

---------

Co-authored-by: Milon <milonpl.git@proton.me>
This commit is contained in:
metalgearsloth
2025-04-19 11:38:22 +10:00
committed by GitHub
parent 1dbc40f051
commit 8ab0e59db6
10 changed files with 214 additions and 234 deletions

View File

@@ -1,31 +1,33 @@
namespace Content.Shared.CombatMode
namespace Content.Shared.CombatMode;
[ByRefEvent]
public record struct DisarmedEvent(EntityUid Target, EntityUid Source, float PushProb)
{
public sealed class DisarmedEvent : HandledEntityEventArgs
{
/// <summary>
/// The entity being disarmed.
/// </summary>
public EntityUid Target { get; init; }
/// <summary>
/// The entity being disarmed.
/// </summary>
public readonly EntityUid Target = Target;
/// <summary>
/// The entity performing the disarm.
/// </summary>
public EntityUid Source { get; init; }
/// <summary>
/// The entity performing the disarm.
/// </summary>
public readonly EntityUid Source = Source;
/// <summary>
/// Probability for push/knockdown.
/// </summary>
public float PushProbability { get; init; }
/// <summary>
/// Probability for push/knockdown.
/// </summary>
public readonly float PushProbability = PushProb;
/// <summary>
/// Prefix for the popup message that will be displayed on a successful push.
/// Should be set before returning.
/// </summary>
public string PopupPrefix { get; set; } = "";
/// <summary>
/// Prefix for the popup message that will be displayed on a successful push.
/// Should be set before returning.
/// </summary>
public string PopupPrefix = "";
/// <summary>
/// Whether the entity was successfully stunned from a shove.
/// </summary>
public bool IsStunned { get; set; }
}
/// <summary>
/// Whether the entity was successfully stunned from a shove.
/// </summary>
public bool IsStunned;
public bool Handled;
}