GameBaseData

Engine/source/T3D/gameBase/gameBase.h

Scriptable, demo-able datablock.

More...

Callbacks

DECLARE_CALLBACK(void , onNewDataBlock , (GameBase *obj) )
DECLARE_CALLBACK(void , onMount , (SceneObject *obj, SceneObject *mountObj, S32 node) )
DECLARE_CALLBACK(void , onUnmount , (SceneObject *obj, SceneObject *mountObj, S32 node) )

Private Types

Parent 

Public Functions

Called after any property of the object is changed in the world editor.

bool

Called when the object is added to the sim.

bool
preload(bool server, String & errorStr)

Called to prepare the datablock for use, after it has been unpacked.

Public Static Functions

Detailed Description

Scriptable, demo-able datablock.

This variant of SimDataBlock performs these additional tasks:

  • Linking datablock's namepsaces to the namespace of their C++ class, so that datablocks can expose script functionality.

  • Linking datablocks to a user defined scripting namespace, by setting the 'class' field at datablock definition time.

  • Adds a category field; this is used by the world creator in the editor to classify creatable shapes. Creatable shapes are placed under the Shapes node in the treeview for this; additional levels are created, named after the category fields.

  • Adds support for demo stream recording. This support takes the form of the member variable packed. When a demo is being recorded by a client, data is unpacked, then packed again to the data stream, then, in the case of datablocks, preload() is called to process the data. It is occasionally the case that certain references in the datablock stream cannot be resolved until preload is called, in which case a raw ID field is stored in the variable which will eventually be used to store a pointer to the object. However, if packData() is called before we resolve this ID, trying to call getID() on the objecct ID would be a fatal error. Therefore, in these cases, we test packed; if it is true, then we know we have to write the raw data, instead of trying to resolve an ID.

see:

SimDataBlock for further details about datablocks.

see:

http://hosted.tribalwar.com/t2faq/datablocks.shtml for an excellent explanation of the basics of datablocks from a scripting perspective.

Callbacks

DECLARE_CALLBACK(void , onAdd , (GameBase *obj) )

DECLARE_CALLBACK(void , onRemove , (GameBase *obj) )

DECLARE_CALLBACK(void , onNewDataBlock , (GameBase *obj) )

DECLARE_CALLBACK(void , onMount , (SceneObject *obj, SceneObject *mountObj, S32 node) )

DECLARE_CALLBACK(void , onUnmount , (SceneObject *obj, SceneObject *mountObj, S32 node) )