eris
1.4.0
A WorldForge client library.
|
#include <Avatar.h>
Public Member Functions | |
Avatar (Account &pl, std::string mindId, std::string entityId) | |
const std::string & | getId () const |
Get the Mind id of this Avatar. All interaction with the entity goes through the Mind. More... | |
const std::string & | getEntityId () const |
Entity * | getEntity () const |
Get the Entity this Avatar refers to. More... | |
View & | getView () const |
Connection & | getConnection () const |
Account & | getAccount () const |
double | getWorldTime () |
void | touch (Entity *, const WFMath::Point< 3 > &pos) |
Touch an entity. More... | |
void | wield (Eris::Entity *entity, std::string attachPoint) const |
void | say (const std::string &) |
Say something (in-game) More... | |
void | sayTo (const std::string &message, const std::vector< std::string > &entities) |
void | emote (const std::string &) |
Emote something (in-game) More... | |
void | moveToPoint (const WFMath::Point< 3 > &, const WFMath::Quaternion &orient) |
Have the character move towards a position. Any non-valid data will not be sent. More... | |
void | moveInDirection (const WFMath::Vector< 3 > &, const WFMath::Quaternion &) |
Set the character's velocity and orientation. Any non-valid data will not be sent. More... | |
void | place (const Entity *entity, const Entity *container, const WFMath::Point< 3 > &pos=WFMath::Point< 3 >(), const WFMath::Quaternion &orientation=WFMath::Quaternion(), boost::optional< float > offset=boost::none, int amount=1) |
Place an entity inside another one. More... | |
void | useStop () |
Stop the current task, if one is in progress. More... | |
void | deactivate () |
void | setIsAdmin (bool isAdmin) |
Sets whether the current avatar is an admin character. More... | |
bool | getIsAdmin () const |
Gets whether the current avatar is an admin character. More... | |
void | send (const Atlas::Objects::Operation::RootOperation &op) |
Sends an operation from this Avatar. More... | |
const std::map< std::string, std::unique_ptr< EntityRef > > & | getActiveContainers () const |
Public Attributes | |
sigc::signal< void, Entity * > | GotCharacterEntity |
sigc::signal< void > | CharacterEntityDeleted |
sigc::signal< void, Entity & > | ContainerOpened |
sigc::signal< void, Entity & > | ContainerClosed |
sigc::signal< void, const TransferInfo & > | TransferRequested |
Protected Member Functions | |
void | updateWorldTime (double t) |
void | onEntityAppear (Entity *ent) |
void | onAvatarEntityDeleted () |
Called when the avatar entity is deleted. More... | |
virtual void | onTransferRequested (const TransferInfo &transfer) |
void | logoutResponse (const Atlas::Objects::Operation::RootOperation &) |
void | logoutRequested () |
Called when a logout of the avatar has been requested by the server. More... | |
void | logoutRequested (const TransferInfo &transferInfo) |
Called when a logout and server transfer of the avatar has been requested by the server. More... | |
void | containerActiveChanged (const Atlas::Message::Element &element) |
Protected Attributes | |
Account & | m_account |
std::string | m_mindId |
std::string | m_entityId |
Entity * | m_entity |
WFMath::TimeStamp | m_stampAtLastOp |
double | m_lastOpTime |
std::unique_ptr< View > | m_view |
std::unique_ptr< IGRouter > | m_router |
sigc::connection | m_entityAppearanceCon |
sigc::connection | m_avatarEntityDeletedConnection |
bool | m_isAdmin |
std::unique_ptr< TimedEvent > | m_logoutTimer |
std::map< std::string, std::unique_ptr< EntityRef > > | m_activeContainers |
sigc::connection | m_entityParentDeletedConnection |
Friends | |
class | Account |
class | AccountRouter |
class | IGRouter |
Eris::Avatar::Avatar | ( | Account & | pl, |
std::string | mindId, | ||
std::string | entityId | ||
) |
Create a new Avatar object.
pl | The player that owns the Avatar |
Definition at line 37 of file Avatar.cpp.
References Eris::Account::destroyAvatar(), Eris::Account::getConnection(), getId(), Eris::Account::getId(), Eris::getNewSerialno(), Eris::Connection::send(), and Eris::TypeService::setTypeProviderId().
void Eris::Avatar::emote | ( | const std::string & | em | ) |
Emote something (in-game)
Definition at line 148 of file Avatar.cpp.
References Eris::getNewSerialno(), and Eris::Connection::send().
|
inline |
|
inline |
|
inline |
Get the Mind id of this Avatar. All interaction with the entity goes through the Mind.
Definition at line 250 of file Avatar.h.
Referenced by Avatar(), Eris::Account::avatarLogoutRequested(), logoutRequested(), touch(), and updateWorldTime().
bool Eris::Avatar::getIsAdmin | ( | ) | const |
Gets whether the current avatar is an admin character.
As an "admin" character the avatar has greater ability to alter the state of the server. This is often done by sending Atlas ops to the entity itself, thus bypassing the normal routing rules on the server.
It's up to the client to determine which avatars are admin, and call setIsAdmin as soon as possible after the Avatar has been created.
Definition at line 411 of file Avatar.cpp.
Referenced by place().
double Eris::Avatar::getWorldTime | ( | ) |
get the current local approximation of world time.
Definition at line 305 of file Avatar.cpp.
|
protected |
Called when a logout of the avatar has been requested by the server.
Definition at line 398 of file Avatar.cpp.
References Eris::Account::destroyAvatar(), and getId().
|
protected |
Called when a logout and server transfer of the avatar has been requested by the server.
transferInfo | The transfer info which contains information about the server to transfer to. |
Definition at line 402 of file Avatar.cpp.
References Eris::Account::destroyAvatar(), and getId().
void Eris::Avatar::moveInDirection | ( | const WFMath::Vector< 3 > & | vel, |
const WFMath::Quaternion & | orient | ||
) |
Set the character's velocity and orientation. Any non-valid data will not be sent.
Definition at line 181 of file Avatar.cpp.
References Eris::Connection::send().
void Eris::Avatar::moveToPoint | ( | const WFMath::Point< 3 > & | pos, |
const WFMath::Quaternion & | orient | ||
) |
Have the character move towards a position. Any non-valid data will not be sent.
Definition at line 162 of file Avatar.cpp.
References Eris::Entity::getId(), Eris::Entity::getLocation(), and Eris::Connection::send().
|
protected |
Called when the avatar entity is deleted.
Definition at line 290 of file Avatar.cpp.
References CharacterEntityDeleted, Eris::Account::getConnection(), and TransferRequested.
Referenced by useStop().
void Eris::Avatar::place | ( | const Entity * | entity, |
const Entity * | container, | ||
const WFMath::Point< 3 > & | pos = WFMath::Point<3>() , |
||
const WFMath::Quaternion & | orientation = WFMath::Quaternion() , |
||
boost::optional< float > | offset = boost::none , |
||
int | amount = 1 |
||
) |
Place an entity inside another one.
entity | The entity to place. |
container | The container for the entity. |
pos | The position of the entity within the container. |
orientation | An optional orientation of the entity. |
Definition at line 198 of file Avatar.cpp.
References Eris::Entity::getId(), getIsAdmin(), and Eris::Connection::send().
void Eris::Avatar::say | ( | const std::string & | msg | ) |
Say something (in-game)
Definition at line 120 of file Avatar.cpp.
References Eris::Connection::send().
void Eris::Avatar::sayTo | ( | const std::string & | message, |
const std::vector< std::string > & | entities | ||
) |
Say something (in-game), addressing one or many entities
message | The message, i.e. what is being said. |
entities | A list of ids of entities being addressed. |
Definition at line 131 of file Avatar.cpp.
References Eris::Connection::send().
void Eris::Avatar::send | ( | const Atlas::Objects::Operation::RootOperation & | op | ) |
Sends an operation from this Avatar.
This will set the "to" property to be from this avatar's mind.
op |
Definition at line 415 of file Avatar.cpp.
References Eris::Account::getConnection(), and Eris::Connection::send().
void Eris::Avatar::setIsAdmin | ( | bool | isAdmin | ) |
Sets whether the current avatar is an admin character.
As an "admin" character the avatar has greater ability to alter the state of the server. This is often done by sending Atlas ops to the entity itself, thus bypassing the normal routing rules on the server.
It's up to the client to determine which avatars are admin, and set this flag as soon as possible after the Avatar has been created.
Definition at line 407 of file Avatar.cpp.
void Eris::Avatar::touch | ( | Entity * | e, |
const WFMath::Point< 3 > & | pos | ||
) |
Touch an entity.
Definition at line 90 of file Avatar.cpp.
References getId(), Eris::Entity::getId(), and Eris::Connection::send().
|
protected |
called by the IG router for each op it sees with a valid 'seconds' attribute set. We use this to synchronize the local world time up.
Definition at line 310 of file Avatar.cpp.
References Eris::Account::destroyAvatar(), and getId().
void Eris::Avatar::useStop | ( | ) |
Stop the current task, if one is in progress.
Definition at line 236 of file Avatar.cpp.
References Eris::Entity::BeingDeleted, Eris::Entity::getId(), Eris::Entity::getLocation(), Eris::Entity::getType(), GotCharacterEntity, Eris::Entity::LocationChanged, Eris::Entity::observe(), onAvatarEntityDeleted(), Eris::TypeInfo::refresh(), Eris::Connection::send(), and Eris::Entity::setLocation().
sigc::signal<void> Eris::Avatar::CharacterEntityDeleted |
Emitted when the avatar entity for whatever reason is deleted.
Definition at line 175 of file Avatar.h.
Referenced by onAvatarEntityDeleted().
sigc::signal<void, Entity*> Eris::Avatar::GotCharacterEntity |
Emitted when the character entity of this Avatar is valid (and presumably, visible). This will happen some time after the InGame signal is emitted. A client might wish to show some kind of 'busy' animation, eg an hour-glass, while waiting for this signal.
Definition at line 170 of file Avatar.h.
Referenced by useStop().
sigc::signal<void, const TransferInfo&> Eris::Avatar::TransferRequested |
Emitted when a character transfer authentication is requested. Clients should use the hostname, port number, possess key and entity ID to claim the character on a remote host
Definition at line 185 of file Avatar.h.
Referenced by onAvatarEntityDeleted().