Planeshift
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

GEMSupervisor Class Reference

This class holds the refs to the core factories, etc in CEL. More...

#include <gem.h>

List of all members.

Public Member Functions

void ActivateNPCs (AccountID superclientID)
void AddActorEntity (gemActor *actor)
void AddEntity (gemObject *obj, EID objEid)
 Ugly function, used for gemAL.
void AddItemEntity (gemItem *item)
void AttachObject (iObject *object, gemObject *gobject)
 Attach a server gemObject to a Crystal Space object.
int CountManagedNPCs (AccountID superclientID)
EID CreateEntity (gemObject *obj)
void FillNPCList (MsgEntry *msg, AccountID superclientID)
gemObjectFindAttachedObject (iObject *object)
 See if there is a gemObject attached to a given Crystal Space object.
csArray< gemObject * > FindNearbyEntities (iSector *sector, const csVector3 &pos, InstanceID instance, float radius, bool doInvisible=false)
 Create a list of all nearby gem objects.
csArray< gemObject * > FindSectorEntities (iSector *sector, bool doInvisible=false)
 Create a list of all gem objects in a sector.
 GEMSupervisor (iObjectRegistry *objreg, psDatabase *db, EntityManager *entitymanager, CacheManager *cachemanager)
 Create a new singleton of the GEM Supervisor object.
void GetAllEntityPos (csArray< psAllEntityPosMessage > &msgs)
csHash< gemObject *, EID > & GetAllGEMS ()
 Get a hash of all the current entities on the server.
void GetPlayerObjects (PID playerID, csArray< gemObject * > &list)
 Gets a list of all the 'live' entities that this player has ownership of.
void HandleDamageMessage (MsgEntry *me, Client *client)
void HandleStatDRUpdateMessage (MsgEntry *me, Client *client)
void HandleStatsMessage (MsgEntry *me, Client *client)
void RemoveActorEntity (gemActor *actor)
void RemoveEntity (gemObject *which)
void RemoveItemEntity (gemItem *item, uint32 uid)
void RemovePlayerFromLootables (PID playerID)
void SendAllNPCStats (AccountID superclientID)
void StopAllNPCs (AccountID superclientID)
void Teleport (gemObject *object, float x, float y, float z, float rot, const char *sectorname)
 Teleport a player to a location.
void UnattachObject (iObject *object, gemObject *gobject)
 Unattach a gemObject from a Crystal Space object.
void UpdateAllDR ()
void UpdateAllStats ()
virtual ~GEMSupervisor ()
 Destroy this singleton.
Search functions
EID FindItemID (psItem *item)
 Find an entity ID (EID) for an item.
gemObjectFindObject (EID cel_id)
gemObjectFindObject (const csString &name)
gemActorFindPlayerEntity (PID player_id)
gemNPCFindNPCEntity (PID npc_id)
gemNPCFindNPCEntity (EID eid)
gemItemFindItemEntity (uint32 item_id)

Public Attributes

psDatabasedatabase
 The main PlaneShift database object.
NPCManagernpcmanager
 NPC controller.
iObjectRegistry * object_reg
 The Crystal Space Object Registry.

Protected Member Functions

EID GetNextID ()
 Get the next ID for an object.

Protected Attributes

csHash< gemActor *, PID > actors_by_pid
 A list of all the actors stored by PID (player/character ID).
csRef< iEngine > engine
 Stored here to save expensive csQueryRegistry calls.
csHash< gemObject *, EID > entities_by_eid
 A list of all the entities stored by EID (entity/gem ID).
csHash< gemItem *, uint32 > items_by_uid
 A list of all the items stored by UID (psItem ID).
uint32 nextEID
 The next ID available for an object.

Detailed Description

This class holds the refs to the core factories, etc in CEL.

Definition at line 126 of file gem.h.


Constructor & Destructor Documentation

GEMSupervisor::GEMSupervisor ( iObjectRegistry *  objreg,
psDatabase db,
EntityManager entitymanager,
CacheManager cachemanager 
)

Create a new singleton of the GEM Supervisor object.

Parameters:
objregThe Crystal Space Object Registry.
dbThe main PlaneShift database.
entitymanagerThe EntityManager.
cachemanagerThe CacheManager.
virtual GEMSupervisor::~GEMSupervisor ( ) [virtual]

Destroy this singleton.

This will only be ever called on a server shutdown.


Member Function Documentation

void GEMSupervisor::ActivateNPCs ( AccountID  superclientID)
void GEMSupervisor::AddActorEntity ( gemActor actor)
void GEMSupervisor::AddEntity ( gemObject obj,
EID  objEid 
)

Ugly function, used for gemAL.

void GEMSupervisor::AddItemEntity ( gemItem item)
void GEMSupervisor::AttachObject ( iObject *  object,
gemObject gobject 
)

Attach a server gemObject to a Crystal Space object.

In most cases this will be a mesh wrapper.

Parameters:
objectThe Crystal Space object we want to attach our gemObject to.
gobjectThe PlaneShift object that we want to attach.
int GEMSupervisor::CountManagedNPCs ( AccountID  superclientID)
EID GEMSupervisor::CreateEntity ( gemObject obj)
void GEMSupervisor::FillNPCList ( MsgEntry msg,
AccountID  superclientID 
)
gemObject* GEMSupervisor::FindAttachedObject ( iObject *  object)

See if there is a gemObject attached to a given Crystal Space object.

Parameters:
objectThe Cyrstal Space object we want to see if there is an object attached to.
Returns:
A gemObject if it exists that is attached to the Crystal Space object.
gemItem* GEMSupervisor::FindItemEntity ( uint32  item_id)
EID GEMSupervisor::FindItemID ( psItem item)

Find an entity ID (EID) for an item.

Parameters:
itemThe psItem that we want to find the entity ID for.
Returns:
the EID of that item if it was found. 0 if no id could be found.
csArray<gemObject*> GEMSupervisor::FindNearbyEntities ( iSector *  sector,
const csVector3 &  pos,
InstanceID  instance,
float  radius,
bool  doInvisible = false 
)

Create a list of all nearby gem objects.

Parameters:
sectorThe sector to check in.
posThe starting position
instanceThe instance ID for the starting point
radiusThe distance around the starting point to check.
doInvisibleIf true check invisible meshes otherwise ignore them.
Returns:
A csArray<> of all the objects in the given radius.
gemNPC* GEMSupervisor::FindNPCEntity ( PID  npc_id)
gemNPC* GEMSupervisor::FindNPCEntity ( EID  eid)
gemObject* GEMSupervisor::FindObject ( const csString &  name)
gemObject* GEMSupervisor::FindObject ( EID  cel_id)
gemActor* GEMSupervisor::FindPlayerEntity ( PID  player_id)
csArray<gemObject*> GEMSupervisor::FindSectorEntities ( iSector *  sector,
bool  doInvisible = false 
)

Create a list of all gem objects in a sector.

Parameters:
sectorThe sector to check in.
doInvisibleIf true check invisible meshes otherwise ignore them.
Returns:
A csArray<> of all the objects in the given radius.
void GEMSupervisor::GetAllEntityPos ( csArray< psAllEntityPosMessage > &  msgs)
csHash<gemObject*, EID>& GEMSupervisor::GetAllGEMS ( ) [inline]

Get a hash of all the current entities on the server.

Returns:
a csHash of all the gemObjects.

Definition at line 157 of file gem.h.

EID GEMSupervisor::GetNextID ( ) [protected]

Get the next ID for an object.

Returns:
The next ID available that can be assigned to an object.
void GEMSupervisor::GetPlayerObjects ( PID  playerID,
csArray< gemObject * > &  list 
)

Gets a list of all the 'live' entities that this player has ownership of.

This can be things like items in containers or work items.

Parameters:
playerIDThe character owner ID we are looking for.
listThe populated list of items that are active in game.
void GEMSupervisor::HandleDamageMessage ( MsgEntry me,
Client client 
)
void GEMSupervisor::HandleStatDRUpdateMessage ( MsgEntry me,
Client client 
)
void GEMSupervisor::HandleStatsMessage ( MsgEntry me,
Client client 
)
void GEMSupervisor::RemoveActorEntity ( gemActor actor)
void GEMSupervisor::RemoveEntity ( gemObject which)
void GEMSupervisor::RemoveItemEntity ( gemItem item,
uint32  uid 
)
void GEMSupervisor::RemovePlayerFromLootables ( PID  playerID)
void GEMSupervisor::SendAllNPCStats ( AccountID  superclientID)
void GEMSupervisor::StopAllNPCs ( AccountID  superclientID)
void GEMSupervisor::Teleport ( gemObject object,
float  x,
float  y,
float  z,
float  rot,
const char *  sectorname 
)

Teleport a player to a location.

Parameters:
objectThe player to move
xX Location to move to
yY Location to move to
zZ Location to move to
rotThe rotation to use.
sectornameThe sector name to move to.
void GEMSupervisor::UnattachObject ( iObject *  object,
gemObject gobject 
)

Unattach a gemObject from a Crystal Space object.

In most cases the Crystal Space object is a meshwrapper.

Parameters:
objectThe Crystal Space object we want to unattach our client object from.
gobjectThe gem object we want to unattach.
void GEMSupervisor::UpdateAllDR ( )
void GEMSupervisor::UpdateAllStats ( )

Member Data Documentation

csHash<gemActor*, PID> GEMSupervisor::actors_by_pid [protected]

A list of all the actors stored by PID (player/character ID).

Definition at line 296 of file gem.h.

The main PlaneShift database object.

Definition at line 132 of file gem.h.

csRef<iEngine> GEMSupervisor::engine [protected]

Stored here to save expensive csQueryRegistry calls.

Definition at line 301 of file gem.h.

csHash<gemObject*, EID> GEMSupervisor::entities_by_eid [protected]

A list of all the entities stored by EID (entity/gem ID).

Definition at line 294 of file gem.h.

csHash<gemItem*, uint32> GEMSupervisor::items_by_uid [protected]

A list of all the items stored by UID (psItem ID).

Definition at line 295 of file gem.h.

uint32 GEMSupervisor::nextEID [protected]

The next ID available for an object.

Definition at line 298 of file gem.h.

NPC controller.

Definition at line 133 of file gem.h.

iObjectRegistry* GEMSupervisor::object_reg

The Crystal Space Object Registry.

Definition at line 131 of file gem.h.


The documentation for this class was generated from the following file: