Collect

Category: Objects / Contents
Since engine version: 1.0 OC

Description

Collects an object. This function performs the same events as they occur if the object is collected in the game through the Collection area (there will be a RejectCollect call, flag collection checks, hit calls, etc.) The only difference is that there will be no comparison of collection position and the collected item is not checked for the OCF_Carryable flag.
Using this function you can for example collect objects directly from a container. If the function fails (e.g. through a RejectCollect or a full target container) the function returns false, otherwise true.

Syntax

bool Collect(object item, bool ignore_ocf);

Parameters

item:
Object to be collected.
ignore_ocf:
Ignores the fact that a container must have OCF_Collection for it to collect an object.

Example

protected func ContainedUse(object clonk)
{
	var obj = Contents();
	if (obj)
		if (!clonk->Collect(obj))
			clonk->Message("Collect not possible.",clonk);
	return true;
}
With contained use the first inventory object is passed to the selected clonk.
See also: Enter
Sven2, 2002-05