Cafu Engine
Cafu Engine Scripting
The open-source game engine and graphics engine for multiplayer, cross-platform, real-time 3D action
BaseEntityT Class Reference

This is the base class that all other entities directly or indirectly inherit from. More...

Inheritance diagram for BaseEntityT:

Public Member Functions

string GetName ()
 Returns the name of this entity. More...
 
x y z GetOrigin ()
 Returns the origin of this entity as a triple of numbers. More...
 
 SetOrigin (number x, number y, number z)
 Sets a new position for this entity. More...
 

Detailed Description

This is the base class that all other entities directly or indirectly inherit from.

The functionality that this class provides is shared by all entities. Entities of this class cannot be created in map files directly, but they're always created via one of the derived classes.

Implementing C++ Class:
DeathMatch::BaseEntityT

Member Function Documentation

string GetName ( )

Returns the name of this entity.

The name of the entity is normally assigned in the map file / map editor, and unique among all entities. When a new map starts, a script object that represents the entity is created as a global with this name.

Example:
This function prints the names of all entities in a map:
function listAllEnts()
for k, v in pairs(_G) do -- Iterate over all global variables.
if type(v)=="table" and v.GetName then -- Implement a very simple type check.
Console.Print(v:GetName() .. "\n") -- Note that v:GetName() == k is true.
end
end
end
Returns
The name that the entity has been assigned in the map file / map editor.
x y z GetOrigin ( )

Returns the origin of this entity as a triple of numbers.

Example:
local px, py, pz=Player1:GetOrigin()
Returns
The origin of this entity as a triple of numbers.
SetOrigin ( number  x,
number  y,
number  z 
)

Sets a new position for this entity.

Parameters
xThe new x-coordinate for the origin of this entity.
yThe new y-coordinate for the origin of this entity.
zThe new z-coordinate for the origin of this entity.