RemoveObject

Category: Objects / Existence
Since engine version: 4.6.5.0 CP (extended in 4.9.1.0 GWE)

Description

Removes an object from the game.

Syntax

bool RemoveObject (object pObj, bool fEjectContents);

Parameters

pObj:
[opt] Object to be removed. Can be 0 in local calls.
fEjectContents:
[opt] If true, the object's contents is exited before deletion of the object. Otherwise, the contents will be deleted as well.

Remark

When removing an object, numerous internal references to the object are cleared and any pointer to the object will become invalid. If you have stored a pointer to this object (e.g. in thread local script) you must no longer use this pointer after deletion of the object. If an object removes itself by script it should not execute any more script commands following the removal. The deleting function should immediately end with return().
If the object is a valid crew member at the time of removal, the associated info object in the crew list will not be marked as 'killed', meaning a subsequent call to MakeCrewMember() might reuse the same crew info. To properly kill a clonk until the end of a round use Kill().

Example

public func Activate(pClonk) { return(RemoveObject(pClonk)); }
If a clonk activates this object, we will be deleted.
See also: CreateObject, Explode, Kill
Sven2, August 2002