HOTFIX Fix pickup effects occurring with verb creation (#38705)

* fix: don't run pickup effects on verb creation

* review

* redundant

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Perry Fraser
2025-10-11 15:42:10 -04:00
committed by GitHub
parent e89651c774
commit 5ade6688e7
9 changed files with 141 additions and 34 deletions

View File

@@ -167,15 +167,21 @@ namespace Content.Shared.ActionBlocker
return !ev.Cancelled;
}
public bool CanPickup(EntityUid user, EntityUid item)
/// <summary>
/// Whether a user can pickup the given item.
/// </summary>
/// <param name="user">The mob trying to pick up the item.</param>
/// <param name="item">The item being picked up.</param>
/// <param name="showPopup">Whether or not to show a popup to the player telling them why the attempt failed.</param>
public bool CanPickup(EntityUid user, EntityUid item, bool showPopup = false)
{
var userEv = new PickupAttemptEvent(user, item);
var userEv = new PickupAttemptEvent(user, item, showPopup);
RaiseLocalEvent(user, userEv);
if (userEv.Cancelled)
return false;
var itemEv = new GettingPickedUpAttemptEvent(user, item);
var itemEv = new GettingPickedUpAttemptEvent(user, item, showPopup);
RaiseLocalEvent(item, itemEv);
return !itemEv.Cancelled;