Eris
1.3.19
|
The player's avatar representation. More...
#include <Avatar.h>
Public Member Functions | |
const std::string & | getId () const |
Get the Entity id of this Avatar. | |
EntityPtr | getEntity () const |
Get the Entity this Avatar refers to. | |
View * | getView () const |
Connection * | getConnection () const |
double | getWorldTime () |
get the current local approximation of world time. | |
const EntityRef & | getWielded () const |
void | drop (Entity *entity, const WFMath::Point< 3 > &pos, const WFMath::Quaternion &orientation, const std::string &loc) |
Drop an entity in the Avatar's inventory at the given location. | |
void | drop (Entity *entity, const WFMath::Vector< 3 > &offset=WFMath::Vector< 3 >(0, 0, 0), const WFMath::Quaternion &orientation=WFMath::Quaternion()) |
Drop an entity in the Avatar's inventory at the Avatar's feet (or actually in the parent entity of the Avatar). | |
void | take (Entity *) |
Move an entity into the Avatar's inventory. | |
void | touch (Entity *) |
Touch an entity. | |
void | say (const std::string &) |
Say something (in-game) | |
void | sayTo (const std::string &message, const std::vector< const Entity * > &entities) |
Say something (in-game), addressing one or many entities. | |
void | emote (const std::string &) |
Emote something (in-game) | |
void | moveToPoint (const WFMath::Point< 3 > &) |
Have the character move towards a position. | |
void | moveInDirection (const WFMath::Vector< 3 > &) |
Set the character's velocity. | |
void | moveInDirection (const WFMath::Vector< 3 > &, const WFMath::Quaternion &) |
Set the character's velocity and orientation. | |
void | place (Entity *entity, Entity *container, const WFMath::Point< 3 > &pos, const WFMath::Quaternion &orientation=WFMath::Quaternion()) |
Place an entity inside another one. | |
void | wield (Entity *entity) |
Wield an entity which is inside the Avatar's inventory. | |
void | useOn (Entity *entity, const WFMath::Point< 3 > &position, const std::string &op) |
Use the currently wielded entity (tool) on another entity. | |
void | attack (Entity *entity) |
Attach the specified entity. | |
void | useStop () |
Stop the current task, if one is in progress. | |
void | deactivate () |
void | setIsAdmin (bool isAdmin) |
Sets whether the current avatar is an admin character. | |
bool | getIsAdmin () |
Gets whether the current avatar is an admin character. | |
Public Attributes | |
sigc::signal< void, Entity * > | GotCharacterEntity |
Emitted when the character entity of this Avatar is valid (and presumably, visible). | |
sigc::signal< void, Entity * > | InvAdded |
An object was added to the inventory. | |
sigc::signal< void, Entity * > | InvRemoved |
An object was removed from the inventory. | |
sigc::signal< void, Entity *, const Atlas::Objects::Operation::RootOperation & > | Hear |
emitted when this Avatar hears something. | |
sigc::signal< void, const TransferInfo & > | TransferRequested |
Emitted when a character transfer authentication is requested. | |
Protected Member Functions | |
Avatar (Account &pl, const std::string &entId) | |
Create a new Avatar object. | |
void | updateWorldTime (double t) |
called by the IG router for each op it sees with a valid 'seconds' attribute set. | |
void | onEntityAppear (Entity *ent) |
void | onCharacterChildAdded (Entity *child) |
void | onCharacterChildRemoved (Entity *child) |
void | onCharacterWield (const Atlas::Message::Element &) |
void | onWieldedChanged () |
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. | |
void | logoutRequested (const TransferInfo &transferInfo) |
Called when a logout and server transfer of the avatar has been requested by the server. | |
Protected Attributes | |
Account & | m_account |
std::string | m_entityId |
EntityPtr | m_entity |
WFMath::TimeStamp | m_stampAtLastOp |
double | m_lastOpTime |
IGRouter * | m_router |
View * | m_view |
EntityRef | m_wielded |
sigc::connection | m_entityAppearanceCon |
bool | m_isAdmin |
Friends | |
class | Account |
class | AccountRouter |
class | IGRouter |
The player's avatar representation.
Eris::Avatar::Avatar | ( | Account & | pl, |
const std::string & | entId | ||
) | [protected] |
Create a new Avatar object.
pl | The player that owns the Avatar |
References Eris::View::getEntity().
void Eris::Avatar::attack | ( | Entity * | entity | ) |
Attach the specified entity.
entity | The entity to be attacked |
References Eris::Entity::getId(), and Eris::Connection::send().
void Eris::Avatar::drop | ( | Entity * | entity, |
const WFMath::Point< 3 > & | pos, | ||
const WFMath::Quaternion & | orientation, | ||
const std::string & | loc | ||
) |
Drop an entity in the Avatar's inventory at the given location.
entity | The entity to drop. |
pos | The position within the location to place the entity at (if possible by the server). |
orientation | The orientation of the new entity. This will only be used if the quaternion sent is valid. |
loc | The new location, as an entity id. |
References Eris::Entity::getLocation(), Eris::Entity::getId(), and Eris::Connection::send().
Referenced by drop().
void Eris::Avatar::drop | ( | Entity * | entity, |
const WFMath::Vector< 3 > & | offset = WFMath::Vector<3>(0, 0, 0) , |
||
const WFMath::Quaternion & | orientation = WFMath::Quaternion() |
||
) |
Drop an entity in the Avatar's inventory at the Avatar's feet (or actually in the parent entity of the Avatar).
entity | The entity to drop. |
pos | The position within the location to place the entity at (if possible by the server). |
orientation | The orientation of the new entity. This will only be used if the quaternion sent is valid. |
References drop(), Eris::Entity::getPosition(), Eris::Entity::getLocation(), and Eris::Entity::getId().
bool Eris::Avatar::getIsAdmin | ( | ) |
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.
Referenced by place().
double Eris::Avatar::getWorldTime | ( | ) |
get the current local approximation of world time.
void Eris::Avatar::logoutRequested | ( | const TransferInfo & | transferInfo | ) | [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. |
References Eris::Account::avatarLogoutRequested().
void Eris::Avatar::place | ( | Entity * | entity, |
Entity * | container, | ||
const WFMath::Point< 3 > & | pos, | ||
const WFMath::Quaternion & | orientation = WFMath::Quaternion() |
||
) |
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. |
References Eris::Entity::getId(), getIsAdmin(), and Eris::Connection::send().
void Eris::Avatar::sayTo | ( | const std::string & | message, |
const std::vector< const Entity * > & | entities | ||
) |
Say something (in-game), addressing one or many entities.
message | The message, i.e. what is being said. |
entities | A list of entities being addressed. |
References 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.
void Eris::Avatar::updateWorldTime | ( | double | t | ) | [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.
void Eris::Avatar::useOn | ( | Entity * | entity, |
const WFMath::Point< 3 > & | position, | ||
const std::string & | op | ||
) |
Use the currently wielded entity (tool) on another entity.
entity | A pointer to the entity you wish to use your tool on. |
position | A position where you perform the operation. |
op | The operation of the tool to perform, or an empty string to use the default. |
If position is invalid the "pos" parameter will not be set on the USE operation.
References Eris::Entity::getId(), and Eris::Connection::send().
void Eris::Avatar::useStop | ( | ) |
Stop the current task, if one is in progress.
This could be either a useOn or attack.
References Eris::Connection::send().
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.
sigc::signal<void, Entity*, const Atlas::Objects::Operation::RootOperation&> Eris::Avatar::Hear |
emitted when this Avatar hears something.
Passes the source of the sound, and the operation that was heard, for example a Talk.
Referenced by Eris::ViewEntity::onTalk(), and Eris::ViewEntity::onSoundAction().
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