#include <World.h>
Public Member Functions | |
World (Player *p, Connection *c) | |
EntityPtr | lookup (const std::string &id) |
convert an entity ID to an instance pointer | |
EntityPtr | getRootEntity () |
obtain a pointer to the root entity for this client (i.e look("")) | |
Connection * | getConnection () const |
Retrieve the Connection object associated with the World. | |
void | tick () |
update the World state periodically : this runs various house-keeping tasks, such as running client side looping events, flushing old entities from memory, and running client-side motion prediction and interpolation. | |
void | setFocusedEntity (EntityPtr f) |
specify the origin entity for the world; nearly always the player | |
EntityPtr | getFocusedEntity () |
get the currently focused entity. | |
const std::string & | getFocusedEntityID () |
get the id of the focused entity. | |
const std::string & | getDispatcherID () const |
void | registerFactory (Factory *f, unsigned int priority=1) |
void | unregisterFactory (Factory *f) |
Remove an factory from the search set. | |
Avatar * | createAvatar (long refno, const std::string &id="") |
Avatar * | getPrimaryAvatar () |
gets the avatar, named this way in case we have multiple ones later | |
Static Public Member Functions | |
World * | getPrimary () |
World is a singleton; this is the accessor. | |
World * | Instance () |
deprecated accessor | |
Public Attributes | |
SigC::Signal1< void, Entity * > | EntityCreate |
Emitted after an entity has been created, added to the world and parented for the first time (i.e basic setup is all complete). | |
SigC::Signal1< void, Entity * > | EntityDelete |
Emitted before an entity is deleted. | |
SigC::Signal1< void, Entity * > | Entered |
Entered signal is invoked just once, when the player enters the IG world. | |
SigC::Signal1< void, Entity * > | Appearance |
Appearance is emitted when an entity becoms visible to the client. | |
SigC::Signal1< void, Entity * > | Disappearance |
Disappearance indicates the client should hide the entity from the user. | |
SigC::Signal1< void, Entity * > | RootEntityChanged |
RootEntity change : emitted when the Top-Level Visible Entity (TLVE) change. | |
SigC::Signal0< void > | Destroyed |
The World and any Avatar were destroyed due to logout/disconnect/deletion of the Avatar. | |
Protected Types | |
typedef std::multimap< unsigned int, Factory * > | FactoryMap |
Protected Member Functions | |
void | look (const std::string &id) |
EntityPtr | create (const Atlas::Objects::Entity::GameEntity &ge) |
bool | isPendingInitialSight (const std::string &id) |
void | registerCallbacks () |
void | setRootEntity (Entity *root) |
void | markInvisible (Entity *e) |
interface for entities to get themselves cleaned up eventually; this method will place the entity into an internal LRU cache maintained by world (the InvisibleEntityCache) for some duration, before the Entity is deleted. | |
void | markVisible (Entity *e) |
mark the entity as visible again : this will place the entity back into the active list. | |
void | flush (Entity *e) |
callback from the entity cache, when it decided an entity can be completely deleted | |
void | recvInfoCharacter (const Atlas::Objects::Operation::Info &ifo, const Atlas::Objects::Entity::GameEntity &character) |
void | recvAppear (const Atlas::Objects::Operation::Appearance &ap) |
void | recvDisappear (const Atlas::Objects::Operation::Disappearance &ds) |
void | recvSightObject (const Atlas::Objects::Operation::Sight &sight, const Atlas::Objects::Entity::GameEntity &ent) |
void | recvSightCreate (const Atlas::Objects::Operation::Create &cr, const Atlas::Objects::Entity::GameEntity &ent) |
void | recvSightDelete (const Atlas::Objects::Operation::Delete &del) |
void | recvSightSet (const Atlas::Objects::Operation::Set &set) |
void | recvSightMove (const Atlas::Objects::Operation::Move &mv) |
void | recvSoundTalk (const Atlas::Objects::Operation::Sound &snd, const Atlas::Objects::Operation::Talk &tk) |
void | recvErrorLook (const Atlas::Objects::Operation::Look &lk) |
void | lookupTimeout (std::string id) |
void | netConnect () |
callback when Connection generates a 'Connected' signal (usually a reconnect) | |
Protected Attributes | |
std::string | _characterID |
ID of the playing character (usually the same as the focused entity's ID). | |
std::string | _igID |
this can't change, even if _characterID does | |
Connection * | _con |
The underlying connection. | |
Player * | _player |
The Player object (future : list). | |
bool | _initialEntry |
Set if World.Entered needs to be emitted. | |
EntityIDMap | _lookup |
this map tracks all entities we mirror | |
EntityPtr | _root |
the root entity of the world (manged by us) | |
EntityPtr | _focused |
origin entity for field-of-view and so on | |
FactoryMap | _efactories |
storage of every entity factory registered on the world | |
StringSet | _pendingInitialSight |
Set of entities that are waiting for a SIGHT after a LOOK (caused by an appear / move / set / ...). | |
InvisibleEntityCache * | _ieCache |
cache of invisble entities that might re-appear so we keep them around | |
Avatar * | _avatar |
the player character in this world | |
Static Protected Attributes | |
World * | _theWorld = NULL |
static singleton instance | |
Friends | |
class | Entity |
class | Avatar |
class | InvisibleEntityCache |
|
get the currently focused entity. This value is only valid after World.Entered is emitted; prior to that it will return NULL. |
|
get the id of the focused entity. This should be identical to doing getFocusedEntity()->getID(), except that is value is valid before World.Entered is emitted. |
|
mark the entity as visible again : this will place the entity back into the active list. Note that no other state changes occur. |
|
|
|
update the World state periodically : this runs various house-keeping tasks, such as running client side looping events, flushing old entities from memory, and running client-side motion prediction and interpolation. Basically, you want to be calling this reasonably often. |
|
Emitted before an entity is deleted. The signal is invoked before the ID is unregistered or entity is unparented |
|
RootEntity change : emitted when the Top-Level Visible Entity (TLVE) change. The TLVE is the entity returned by LOOK("") at any given point. The signals specifies the new TLVE; you can obtain the current one by calling getRootEntity, i.e the the internal value is updated after the signal is emitted. |