Planeshift
gemObject Class Reference

A gemObject is any solid, graphical object visible in PS with normal physics and normal collision detection. More...

#include <gem.h>

Public Member Functions

virtual void Disconnect ()
 Called when a client disconnects. More...
 
virtual void Dump ()
 Dump debug information. More...
 
gemActorGetActorPtr ()
 
gemActionLocationGetALPtr ()
 
virtual float GetBaseAdvertiseRange ()
 This value indicates the range that this entity would become visible to other entities if no other modifiers were taken into consideration. More...
 
virtual psCharacterGetCharacterData ()
 
virtual ClientGetClient () const
 
uint32_t GetClientID ()
 
virtual csString GetDefaultBehavior (const csString &dfltBehaviors)
 
EID GetEID ()
 
InstanceID GetInstance ()
 
psItemGetItem ()
 
gemItemGetItemPtr ()
 
const char * GetName ()
 
gemNPCGetNPCPtr ()
 
virtual const char * GetObjectType ()
 
gemPetGetPetPtr ()
 
bool IsAlive () const
 Returns whether the object is alive. More...
 
virtual bool IsUpdateReq (csVector3 const &pos, csVector3 const &oldPos)
 
virtual bool IsValid (void)
 
float RangeTo (gemObject *obj, bool ignoreY=false, bool ignoreInstance=false)
 
void RegisterCallback (iDeleteObjectCallback *receiver)
 
virtual void SendBehaviorMessage (const csString &str, gemObject *obj)
 
void SetAlive (bool flag, bool queue=true)
 Set needed stats for alive or dead for object. More...
 
void SetInstance (InstanceID newInstance)
 
void SetName (const char *n)
 
void UnregisterCallback (iDeleteObjectCallback *receiver)
 
virtual ~gemObject ()
 
iScriptableVar implementation

Functions that implement the iScriptableVar interface.

virtual double GetProperty (MathEnvironment *env, const char *ptr)
 
virtual double CalcFunction (MathEnvironment *env, const char *functionName, const double *params)
 
virtual const char * ToString ()
 
Mesh related functions
iMeshWrapper * GetMeshWrapper ()
 
csString GetMesh ()
 
void Move (const csVector3 &pos, float rotangle, iSector *room)
 
bool IsNear (gemObject *obj, float radius, bool ignoreY=false)
 
const csVector3 & GetPosition ()
 
void GetPosition (csVector3 &pos, float &yrot, iSector *&sector)
 
void GetPosition (csVector3 &pos, iSector *&sector)
 
float GetAngle ()
 Get rotation of entity as returned by psWorld::Matrix2YRot. More...
 
iSector * GetSector ()
 
virtual float GetVelocity ()
 Get the z velocity of the actor. More...
 
const char * GetSectorName ()
 
csArray< gemObject * > * GetObjectsInRange (float range)
 
Proxlist related functions.
ProximityListGetProxList ()
 
csArray< PublishDestination > & GetMulticastClients ()
 Returns all the clients which are inside our proxy list. More...
 
void UpdateProxList (bool force=false)
 Generates proxlist if needed (or forced). More...
 
void RemoveFromAllProx ()
 
void SetAlwaysWatching (bool w)
 
bool AlwaysWatching ()
 
Networking functions
virtual void Broadcast (int clientnum, bool control)
 
virtual bool Send (int clientnum, bool control, bool to_superclients, psPersistAllEntities *allEntities=NULL)
 Send this object to the given client. More...
 
virtual void SendGroupMessage (MsgEntry *me)
 Distribute this object to all members of a group. More...
 
Overridden functions in child classes
virtual PID GetPID ()
 
virtual int GetGuildID ()
 
virtual psGuildInfoGetGuild ()
 
virtual bool UpdateDR ()
 
virtual void BroadcastTargetStatDR (ClientConnectionSet *clients)
 
virtual void SendTargetStatDR (Client *client)
 
virtual psNPCDialogGetNPCDialogPtr ()
 
virtual void GetLastSuperclientPos (csVector3 &pos, InstanceID &instance, csTicks &last) const
 
virtual void SetLastSuperclientPos (const csVector3 &pos, InstanceID instance, const csTicks &now)
 
virtual void AddLootablePlayer (PID playerID)
 
virtual void RemoveLootablePlayer (PID playerID)
 
virtual bool IsLootablePlayer (PID playerID)
 
virtual ClientGetRandomLootClient (int range)
 
virtual AccountID GetSuperclientID ()
 
virtual void SetSuperclientID (AccountID id)
 
virtual bool GetVisibility ()
 
virtual bool SeesObject (gemObject *object, float range)
 
virtual gemObjectGetOwner ()
 
virtual bool HasKillStealProtection ()
 Returns if the object has killsteal protection. More...
 
- Public Member Functions inherited from iDeleteNotificationObject
virtual ~iDeleteNotificationObject ()
 
- Public Member Functions inherited from iScriptableVar
virtual ~iScriptableVar ()
 

Protected Member Functions

 gemObject (GEMSupervisor *gemsupervisor, EntityManager *entitymanager, CacheManager *cachemanager, const char *name, const char *factname, InstanceID myinstance, iSector *room, const csVector3 &pos, float rotangle, int clientnum)
 
void InitMesh (const char *name, const csVector3 &pos, const float rotangle, iSector *room)
 
bool InitProximityList (float radius, int clientnum)
 

Protected Attributes

bool alwaysWatching
 True if this object always watches (proxlists) regardless of owner. More...
 
CacheManagercacheManager
 
EID eid
 Entity ID (unique identifier for object) More...
 
EntityManagerentityManager
 
csString factname
 Name of CS Mesh Factory used to create this object. More...
 
bool is_alive
 Flag indicating whether object is alive or not. More...
 
csString matname
 Name of base material used by this object. More...
 
csString name
 Name of this object, used mostly for debugging. More...
 
csRef< iMeshFactoryWrapper > nullfact
 Null factory for our mesh instances. More...
 
gemMeshpcmesh
 link to mesh class More...
 
float prox_distance_current
 What is the current actual range for proxlists (they adjust when the # of objects gets too high) More...
 
float prox_distance_desired
 What is the maximum range of proxlist we want. More...
 
ProximityListproxlist
 Proximity List for this object. More...
 
csArray< iDeleteObjectCallback * > receivers
 List of objects which are to be notified when this object is deleted. More...
 
bool valid
 Is object fully loaded. More...
 
InstanceID worldInstance
 Only objects which match instances can see each other. More...
 

Static Protected Attributes

static GEMSupervisorcel
 Static ptr back to main collection of all objects. More...
 

Detailed Description

A gemObject is any solid, graphical object visible in PS with normal physics and normal collision detection.

Definition at line 314 of file gem.h.

Constructor & Destructor Documentation

virtual gemObject::~gemObject ( )
virtual
gemObject::gemObject ( GEMSupervisor gemsupervisor,
EntityManager entitymanager,
CacheManager cachemanager,
const char *  name,
const char *  factname,
InstanceID  myinstance,
iSector *  room,
const csVector3 &  pos,
float  rotangle,
int  clientnum 
)
protected

Member Function Documentation

virtual void gemObject::AddLootablePlayer ( PID  playerID)
inlinevirtual

Reimplemented in gemNPC.

Definition at line 615 of file gem.h.

bool gemObject::AlwaysWatching ( )
inline

Definition at line 527 of file gem.h.

virtual void gemObject::Broadcast ( int  clientnum,
bool  control 
)
virtual
Parameters
clientnumThe client that initiated this update.
controlSet to true when sent to the controlling client.

Reimplemented in gemNPC, gemActor, gemActionLocation, gemItem, and gemActiveObject.

virtual void gemObject::BroadcastTargetStatDR ( ClientConnectionSet clients)
inlinevirtual

Reimplemented in gemActor.

Definition at line 607 of file gem.h.

virtual double gemObject::CalcFunction ( MathEnvironment env,
const char *  functionName,
const double *  params 
)
virtual

Implements iScriptableVar.

Reimplemented in gemActor, and gemItem.

virtual void gemObject::Disconnect ( )
virtual

Called when a client disconnects.

virtual void gemObject::Dump ( )
virtual

Dump debug information.

Used in the com_print function.

gemActor* gemObject::GetActorPtr ( )
gemActionLocation* gemObject::GetALPtr ( )
float gemObject::GetAngle ( )

Get rotation of entity as returned by psWorld::Matrix2YRot.

Returns
rotation about y axis
See also
psWorld::Matrix2Yrot
virtual float gemObject::GetBaseAdvertiseRange ( )
inlinevirtual

This value indicates the range that this entity would become visible to other entities if no other modifiers were taken into consideration.

Reimplemented in gemActionLocation, and gemItem.

Definition at line 541 of file gem.h.

virtual psCharacter* gemObject::GetCharacterData ( )
inlinevirtual

Reimplemented in gemActor.

Definition at line 379 of file gem.h.

virtual Client* gemObject::GetClient ( ) const
inlinevirtual

Reimplemented in gemActor.

Definition at line 384 of file gem.h.

uint32_t gemObject::GetClientID ( )
virtual csString gemObject::GetDefaultBehavior ( const csString &  dfltBehaviors)
virtual

Reimplemented in gemNPC, gemActor, and gemActiveObject.

EID gemObject::GetEID ( )
inline

Definition at line 320 of file gem.h.

virtual psGuildInfo* gemObject::GetGuild ( )
inlinevirtual

Reimplemented in gemActor.

Definition at line 599 of file gem.h.

virtual int gemObject::GetGuildID ( )
inlinevirtual

Definition at line 595 of file gem.h.

InstanceID gemObject::GetInstance ( )
inline

Definition at line 396 of file gem.h.

psItem* gemObject::GetItem ( )
gemItem* gemObject::GetItemPtr ( )
virtual void gemObject::GetLastSuperclientPos ( csVector3 &  pos,
InstanceID instance,
csTicks &  last 
) const
inlinevirtual

Reimplemented in gemActor.

Definition at line 613 of file gem.h.

csString gemObject::GetMesh ( )
inline

Definition at line 423 of file gem.h.

iMeshWrapper* gemObject::GetMeshWrapper ( )
csArray<PublishDestination>& gemObject::GetMulticastClients ( )

Returns all the clients which are inside our proxy list.

const char* gemObject::GetName ( )
virtual psNPCDialog* gemObject::GetNPCDialogPtr ( )
inlinevirtual

Reimplemented in gemNPC.

Definition at line 609 of file gem.h.

gemNPC* gemObject::GetNPCPtr ( )
csArray<gemObject*>* gemObject::GetObjectsInRange ( float  range)
virtual const char* gemObject::GetObjectType ( )
inlinevirtual

Reimplemented in gemPet, gemNPC, gemActor, gemActionLocation, gemItem, and gemActiveObject.

Definition at line 367 of file gem.h.

virtual gemObject* gemObject::GetOwner ( )
inlinevirtual

Reimplemented in gemNPC.

Definition at line 640 of file gem.h.

gemPet* gemObject::GetPetPtr ( )
virtual PID gemObject::GetPID ( )
inlinevirtual

Reimplemented in gemActor.

Definition at line 591 of file gem.h.

const csVector3& gemObject::GetPosition ( )
void gemObject::GetPosition ( csVector3 &  pos,
float yrot,
iSector *&  sector 
)
void gemObject::GetPosition ( csVector3 &  pos,
iSector *&  sector 
)
virtual double gemObject::GetProperty ( MathEnvironment env,
const char *  ptr 
)
virtual

Implements iScriptableVar.

Reimplemented in gemActor, and gemItem.

ProximityList* gemObject::GetProxList ( )
inline

Definition at line 492 of file gem.h.

virtual Client* gemObject::GetRandomLootClient ( int  range)
inlinevirtual

Reimplemented in gemNPC.

Definition at line 621 of file gem.h.

iSector* gemObject::GetSector ( )
const char* gemObject::GetSectorName ( )
inline

Definition at line 474 of file gem.h.

virtual AccountID gemObject::GetSuperclientID ( )
inlinevirtual

Reimplemented in gemNPC.

Definition at line 625 of file gem.h.

virtual float gemObject::GetVelocity ( )
virtual

Get the z velocity of the actor.

Reimplemented in gemActor.

virtual bool gemObject::GetVisibility ( )
inlinevirtual

Reimplemented in gemActor, gemActionLocation, and gemItem.

Definition at line 631 of file gem.h.

virtual bool gemObject::HasKillStealProtection ( )
inlinevirtual

Returns if the object has killsteal protection.

Rules about killsteal protection should be implmented here. Generic objects don't have killsteal protection

Returns
A boolean indicating if this gemObject must have killsteal protection.

Reimplemented in gemNPC.

Definition at line 653 of file gem.h.

void gemObject::InitMesh ( const char *  name,
const csVector3 &  pos,
const float  rotangle,
iSector *  room 
)
protected
bool gemObject::InitProximityList ( float  radius,
int  clientnum 
)
protected
bool gemObject::IsAlive ( ) const
inline

Returns whether the object is alive.

Definition at line 350 of file gem.h.

virtual bool gemObject::IsLootablePlayer ( PID  playerID)
inlinevirtual

Reimplemented in gemNPC.

Definition at line 617 of file gem.h.

bool gemObject::IsNear ( gemObject obj,
float  radius,
bool  ignoreY = false 
)
virtual bool gemObject::IsUpdateReq ( csVector3 const &  pos,
csVector3 const &  oldPos 
)
virtual
virtual bool gemObject::IsValid ( void  )
inlinevirtual

Definition at line 342 of file gem.h.

void gemObject::Move ( const csVector3 &  pos,
float  rotangle,
iSector *  room 
)
float gemObject::RangeTo ( gemObject obj,
bool  ignoreY = false,
bool  ignoreInstance = false 
)
void gemObject::RegisterCallback ( iDeleteObjectCallback receiver)
inlinevirtual

Implements iDeleteNotificationObject.

Definition at line 401 of file gem.h.

void gemObject::RemoveFromAllProx ( )
virtual void gemObject::RemoveLootablePlayer ( PID  playerID)
inlinevirtual

Reimplemented in gemNPC.

Definition at line 616 of file gem.h.

virtual bool gemObject::SeesObject ( gemObject object,
float  range 
)
inlinevirtual

Reimplemented in gemActor, and gemActionLocation.

Definition at line 635 of file gem.h.

virtual bool gemObject::Send ( int  clientnum,
bool  control,
bool  to_superclients,
psPersistAllEntities allEntities = NULL 
)
inlinevirtual

Send this object to the given client.

Parameters
clientnumThe client that initiated this update.
controlSet to true when sent to the controlling client.
to_superclientsSend to super clients
allEntitiesBuffer the message instead of sending it.

Reimplemented in gemNPC, gemActor, gemActionLocation, gemItem, and gemActiveObject.

Definition at line 575 of file gem.h.

virtual void gemObject::SendBehaviorMessage ( const csString &  str,
gemObject obj 
)
virtual
virtual void gemObject::SendGroupMessage ( MsgEntry me)
inlinevirtual

Distribute this object to all members of a group.

Parameters
meThe MsgEntry to send to all group members.

Reimplemented in gemActor.

Definition at line 585 of file gem.h.

virtual void gemObject::SendTargetStatDR ( Client client)
inlinevirtual

Reimplemented in gemActor.

Definition at line 608 of file gem.h.

void gemObject::SetAlive ( bool  flag,
bool  queue = true 
)

Set needed stats for alive or dead for object.

When dead the mana and HP rate are set to 0.

Parameters
flagTrue if alive
queueSet to false to prevent queuing to superclients
void gemObject::SetAlwaysWatching ( bool  w)
inline

Definition at line 519 of file gem.h.

void gemObject::SetInstance ( InstanceID  newInstance)
inline

Definition at line 392 of file gem.h.

virtual void gemObject::SetLastSuperclientPos ( const csVector3 &  pos,
InstanceID  instance,
const csTicks &  now 
)
inlinevirtual

Reimplemented in gemActor.

Definition at line 614 of file gem.h.

void gemObject::SetName ( const char *  n)
virtual void gemObject::SetSuperclientID ( AccountID  id)
inlinevirtual

Reimplemented in gemNPC.

Definition at line 629 of file gem.h.

virtual const char* gemObject::ToString ( )
inlinevirtual

Implements iScriptableVar.

Definition at line 331 of file gem.h.

void gemObject::UnregisterCallback ( iDeleteObjectCallback receiver)
inlinevirtual

Implements iDeleteNotificationObject.

Definition at line 405 of file gem.h.

virtual bool gemObject::UpdateDR ( )
inlinevirtual

Reimplemented in gemActor.

Definition at line 603 of file gem.h.

void gemObject::UpdateProxList ( bool  force = false)

Generates proxlist if needed (or forced).

Then removes entities of nearby objects at clients, if needed.

Parameters
forceForce an update if set to true.

Member Data Documentation

bool gemObject::alwaysWatching
protected

True if this object always watches (proxlists) regardless of owner.

Definition at line 677 of file gem.h.

CacheManager* gemObject::cacheManager
protected

Definition at line 670 of file gem.h.

GEMSupervisor* gemObject::cel
staticprotected

Static ptr back to main collection of all objects.

Definition at line 668 of file gem.h.

EID gemObject::eid
protected

Entity ID (unique identifier for object)

Definition at line 675 of file gem.h.

EntityManager* gemObject::entityManager
protected

Definition at line 669 of file gem.h.

csString gemObject::factname
protected

Name of CS Mesh Factory used to create this object.

Definition at line 673 of file gem.h.

bool gemObject::is_alive
protected

Flag indicating whether object is alive or not.

Definition at line 672 of file gem.h.

csString gemObject::matname
protected

Name of base material used by this object.

Definition at line 674 of file gem.h.

csString gemObject::name
protected

Name of this object, used mostly for debugging.

Definition at line 667 of file gem.h.

csRef<iMeshFactoryWrapper> gemObject::nullfact
protected

Null factory for our mesh instances.

Definition at line 676 of file gem.h.

gemMesh* gemObject::pcmesh
protected

link to mesh class

Definition at line 665 of file gem.h.

float gemObject::prox_distance_current
protected

What is the current actual range for proxlists (they adjust when the # of objects gets too high)

Definition at line 682 of file gem.h.

float gemObject::prox_distance_desired
protected

What is the maximum range of proxlist we want.

Definition at line 681 of file gem.h.

ProximityList* gemObject::proxlist
protected

Proximity List for this object.

Definition at line 666 of file gem.h.

csArray<iDeleteObjectCallback*> gemObject::receivers
protected

List of objects which are to be notified when this object is deleted.

Definition at line 679 of file gem.h.

bool gemObject::valid
protected

Is object fully loaded.

Definition at line 663 of file gem.h.

InstanceID gemObject::worldInstance
protected

Only objects which match instances can see each other.

Definition at line 671 of file gem.h.


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