ShouldStay

From ZDoom Wiki
Jump to navigation Jump to search

Inventory

virtual bool ShouldStay ()

Usage

A virtual function called by Inventory items after they've been picked up, to determine if they should remain in the world. Normally called from CreateCopy, in the TryPickup chain.

Mainly used for multiplayer, to let certain items (like keys) stay in the world and be picked up by other players. In the base Inventory class always returns false.

Return values

If it returns true, the player who is picking up the item receives a copy of it, and the original item stays behind.

Examples

The Key class overrides it as follows:

	override bool ShouldStay ()
	{
		return !!multiplayer;
	}

See also