Add user to AttemptMeleeEvent, add ThrowItemAttemptEvent (#30193)
* Add user to AttemptMeleeEvent, add ThrowItemAttemptEvent * Add xmldoc
This commit is contained in:
@@ -120,7 +120,13 @@ namespace Content.Shared.ActionBlocker
|
|||||||
var ev = new ThrowAttemptEvent(user, itemUid);
|
var ev = new ThrowAttemptEvent(user, itemUid);
|
||||||
RaiseLocalEvent(user, ev);
|
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)
|
public bool CanSpeak(EntityUid uid)
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
public EntityUid ItemUid { get; }
|
public EntityUid ItemUid { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised on the item entity that is thrown.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="User">The user that threw this entity.</param>
|
||||||
|
/// <param name="Cancelled">Whether or not the throw should be cancelled.</param>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct ThrowItemAttemptEvent(EntityUid User, bool Cancelled = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised when we try to pushback an entity from throwing
|
/// Raised when we try to pushback an entity from throwing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ namespace Content.Shared.Weapons.Melee.Events;
|
|||||||
/// Raised directed on a weapon when attempt a melee attack.
|
/// Raised directed on a weapon when attempt a melee attack.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ByRefEvent]
|
[ByRefEvent]
|
||||||
public record struct AttemptMeleeEvent(bool Cancelled, string? Message);
|
public record struct AttemptMeleeEvent(EntityUid User, bool Cancelled = false, string? Message = null);
|
||||||
|
|||||||
Reference in New Issue
Block a user