TryPickupRestricted

From ZDoom Wiki
Jump to navigation Jump to search

Inventory

virtual bool TryPickupRestricted(in out Actor toucher)

Usage

A virtual function called by Inventory items when they're received (either by being picked up from the world, or by being given directly). This is called in CallTryPickup, right after TryPickup has been called, but only if CanPickup returns false AND the item doesn't have the INVENTORY.RESTRICTABSOLUTELY flag.

Just like TryPickup, this function should not be called directly, but can be overridden to add extra behavior. If you want to add behavior when an item has already been received, consider using AttachToOwner or Use instead.

Parameters

  • Actor toucher
The actor who is attempting to receive this item.

Return values

Returns true if the item was successfully received. Note, this doesn't guarantee that the item itself keep existing. Many classes, such as Health, perform their function (such as healing the toucher) and then disappear. TryPickup still returns true in this case, because technically the item was sucecssfully received.

ZScript definition

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.

The base Inventory class defines it as follows:

	virtual bool TryPickupRestricted (in out Actor toucher)
	{
		return false;
	}

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also