* Add user to AttemptMeleeEvent, add ThrowItemAttemptEvent
* Add xmldoc
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)
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>
/// Raised when we try to pushback an entity from throwing
/// </summary>
/// Raised directed on a weapon when attempt a melee attack.
/// </summary>
[ByRefEvent]
-public record struct AttemptMeleeEvent(bool Cancelled, string? Message);
+public record struct AttemptMeleeEvent(EntityUid User, bool Cancelled = false, string? Message = null);