Entity - KBEngine client

KBEngine API

KBEngine

Entity class

[ KBEngine module]

Entity is part of the KBEngine module. More...

import KBEngine

Member functions

def baseCall( self, methodName, methodArgs ):
def cellCall( self, methodName, methodArgs ):

Callbacks

def onDestroy( self ):
def onEnterWorld( self ):
def onLeaveWorld( self ):
def onEnterSpace( self ):
def onLeaveSpace( self ):

Attributes

direction  Tuple of 3 floats as (roll, pitch, yaw)
id  Read-only Integer
position  Vector3
spaceID  Read-only uint32
isOnGround  Read-only bool
inWorld  Read-only bool
className  Read-only string

A detailed description

Instances of class Entity represent game objects on the client.



An Entity can call methods on its equivalent entity in the base and cell applications via ENTITYCALL. This requires a set of remotely-invoked functions (specified in the entity's .def file). It also works the other way around, and a Client can have its functions remotely invoked by the entity's base and cell parts (must be specified in the <ClientMethods> section of the entity's .def file).

Client entities can have cell attribute changes broadcast to them by using any of the *_CLIENT* broadcast flags on properties in the entity's def file on the server side. If a property is set to be broadcast, set_<property>() is called on the client entity when a cell attribute is changed. See http://kbengine.org/docs/programming/entitydef.html for more info.

Member function documentation

def baseCall( self, methodName, methodArgs ):

Function description:

The method to call the base part of the entity.
Note: the entity must have a base part on the server side. Only client entities controlled by the client can access this method.

Example:
js plugin: entity.baseCall("reqCreateAvatar", roleType, name);
c# plugin: entity.baseCall("reqCreateAvatar", new object[]{roleType, name});

parameters:

methodName string, method name.
methodArgs objects, method parameter list.

return:

Because it is a remote call, it is not possible to block waiting for a return, so there is no return value.

def cellCall( self, methodName, methodArgs ):

Function description:

The method to call the cell part of this entity.
Note: The entity must have a cell part on the server. Only client entities controlled by the client can access this method.

Example:
js plugin: entity.cellCall("xxx", roleType, name);
c# plugin: entity.cellCall("xxx", new object[]{roleType, name});

parameters:

methodName string, method name.
methodArgs objects, method parameter list.

return:

Because it is a remote call, it is not possible to block waiting for a return, so there is no return value.


Callback function documentation

def onDestroy( self ):

Called when the entity is destroyed

def onEnterWorld( self ):

If the entity is not client-controlled, it indicates that the entity has entered the view scope of the client-controlled entity on the server, at which point the client can see the entity.
If the entity is client controlled, it indicates that the entity has created a cell on the server and entered the Space.

def onLeaveWorld( self ):

If the entity is not client-controlled, it indicates that the entity has left the view scope of the client-controlled entity on the server side, and the client cannot see this entity at this time.
If the entity is client controlled, it indicates that the entity has already destroyed the cell on the server and left the Space.

def onEnterSpace( self ):

The client-controlled entity enters a new space.

def onLeaveSpace( self ):

The client-controlled entity leaves the current space.

Attribute documentation

className

The class name of the entity.

Type:

Read-only, string

position

The coordinates (x,y,z) of this entity in world space. The data is synchronized from the server to the client.

Type:

Vector3

direction

This attribute describes the orientation of the Entity in world space. Data is synchronized from the server to the client.

Type:

Vector3, which contains (roll, pitch, yaw) in radians.

isOnGround

If the value of this attribute is True, the Entity is on the ground, otherwise it is False.
If it is a client-controlled entity, this attribute will be synchronized to the server when changed, and other entities will be synchronized to the client by the server. The client can determine this value to avoid the overhead of accuracy.

Type:

Read-write, bool