diff --git a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs index 005c7dc78e..afa1e19ead 100644 --- a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs +++ b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs @@ -120,7 +120,13 @@ namespace Content.Shared.ActionBlocker var ev = new ThrowAttemptEvent(user, itemUid); RaiseLocalEvent(user, ev); - return !ev.Cancelled; + if (ev.Cancelled) + return false; + + var itemEv = new ThrowItemAttemptEvent(user); + RaiseLocalEvent(itemUid, ref itemEv); + + return !itemEv.Cancelled; } public bool CanSpeak(EntityUid uid) diff --git a/Content.Shared/Throwing/ThrowAttemptEvent.cs b/Content.Shared/Throwing/ThrowAttemptEvent.cs index bf8cad6c74..dfb3dca5c7 100644 --- a/Content.Shared/Throwing/ThrowAttemptEvent.cs +++ b/Content.Shared/Throwing/ThrowAttemptEvent.cs @@ -13,6 +13,14 @@ public EntityUid ItemUid { get; } } + /// + /// Raised on the item entity that is thrown. + /// + /// The user that threw this entity. + /// Whether or not the throw should be cancelled. + [ByRefEvent] + public record struct ThrowItemAttemptEvent(EntityUid User, bool Cancelled = false); + /// /// Raised when we try to pushback an entity from throwing /// diff --git a/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs b/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs index 2800e3b34d..cbcadcd19f 100644 --- a/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs +++ b/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs @@ -4,4 +4,4 @@ namespace Content.Shared.Weapons.Melee.Events; /// Raised directed on a weapon when attempt a melee attack. /// [ByRefEvent] -public record struct AttemptMeleeEvent(bool Cancelled, string? Message); +public record struct AttemptMeleeEvent(EntityUid User, bool Cancelled = false, string? Message = null);