-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vanx
committed
Aug 28, 2024
1 parent
68276b9
commit 409bd06
Showing
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
Content.Shared/Weapons/Melee/Events/MeleeAttemptedEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
namespace Content.Shared.Weapons.Melee.Events; | ||
|
||
/// <summary> | ||
/// Raised on a melee when someone is attempting to attack with it. | ||
/// Cancel this event to prevent it from attacking. | ||
/// </summary> | ||
[ByRefEvent] | ||
public record struct MeleeAttemptedEvent | ||
{ | ||
/// <summary> | ||
/// The user attempting to attack with the weapon. | ||
/// </summary> | ||
public EntityUid User; | ||
|
||
/// <summary> | ||
/// The weapon being used. | ||
/// </summary> | ||
public EntityUid Used; | ||
|
||
public bool Cancelled { get; private set; } | ||
|
||
/// </summary> | ||
/// Prevent the weapon from attacking | ||
/// </summary> | ||
public void Cancel() | ||
{ | ||
Cancelled = true; | ||
} | ||
|
||
/// </summary> | ||
/// Allow the weapon to attack again, only use if you know what you are doing | ||
/// </summary> | ||
public void Uncancel() | ||
{ | ||
Cancelled = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters