/usr/include/Eris-1.3/Eris/Avatar.h is in liberis-1.3-dev 1.3.23-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | #ifndef ERIS_AVATAR_H
#define ERIS_AVATAR_H
#include <Eris/Types.h>
#include <Eris/EntityRef.h>
#include <Atlas/Objects/ObjectsFwd.h>
#include <wfmath/point.h>
#include <wfmath/vector.h>
#include <wfmath/quaternion.h>
#include <wfmath/timestamp.h>
#include <sigc++/trackable.h>
#include <sigc++/signal.h>
#include <sigc++/connection.h>
#include <vector>
namespace Eris
{
// Forward Declerations
class Account;
class IGRouter;
class View;
class Connection;
class TransferInfo;
/** The player's avatar representation. **/
class Avatar : virtual public sigc::trackable
{
public:
virtual ~Avatar();
/// Get the Entity id of this Avatar
const std::string & getId() const;
/// Get the Entity this Avatar refers to
EntityPtr getEntity() const;
View* getView() const;
Connection* getConnection() const;
/** get the current local approximation of world time. */
double getWorldTime();
const EntityRef& getWielded() const;
/**
* @brief Drop an entity in the Avatar's inventory at the given location.
* @param entity The entity to drop.
* @param pos The position within the location to place the entity at (if possible by the server).
* @param orientation The orientation of the new entity. This will only be used if the quaternion sent is valid.
* @param loc The new location, as an entity id.
*/
void drop(Entity* entity, const WFMath::Point<3>& pos,
const WFMath::Quaternion& orientation, const std::string& loc);
/**
* @brief Drop an entity in the Avatar's inventory at the Avatar's feet (or actually in the parent entity of the Avatar).
* @param entity The entity to drop.
* @param pos The position within the location to place the entity at (if possible by the server).
* @param orientation The orientation of the new entity. This will only be used if the quaternion sent is valid.
*/
void drop(Entity* entity, const WFMath::Vector<3>& offset = WFMath::Vector<3>(0, 0, 0),
const WFMath::Quaternion& orientation = WFMath::Quaternion());
/// Move an entity into the Avatar's inventory
void take(Entity*);
/// Touch an entity
void touch(Entity*);
/// Say something (in-game)
void say(const std::string&);
/// Say something (in-game), addressing one or many entities
/// @param message The message, i.e. what is being said.
/// @param entities A list of entities being addressed.
void sayTo(const std::string& message, const std::vector<const Entity*>& entities);
/// Emote something (in-game)
void emote(const std::string&);
/// Have the character move towards a position
void moveToPoint(const WFMath::Point<3>&);
/// Set the character's velocity
void moveInDirection(const WFMath::Vector<3>&);
/// Set the character's velocity and orientation
void moveInDirection(const WFMath::Vector<3>&, const WFMath::Quaternion&);
/**
* @brief Place an entity inside another one.
*
* @note Use this method both when you want to move an entity from one
* container to another, or just want to update the position or
* orientation of an entity without changing its container.
*
* @param entity The entity to place.
* @param container The container for the entity.
* @param pos The position of the entity within the container.
* @param orientation An optional orientation of the entity.
*/
void place(Entity* entity, Entity* container, const WFMath::Point<3>& pos,
const WFMath::Quaternion& orientation = WFMath::Quaternion());
/// Wield an entity which is inside the Avatar's inventory
void wield(Entity * entity);
/**
* @brief Use the currently wielded entity (tool) on another entity.
* @param entity A pointer to the entity you wish to use your tool on.
* @param position A position where you perform the operation.
* @param op The operation of the tool to perform, or an empty string to use the default.
*
* If @a position is invalid the "pos" parameter will not be set on the USE operation.
*
* @sa WFMath::Point< 3 >::Point(), WFMath::Point< 3 >::setValid(), WFMath::Point< 3 >::isValid()
**/
void useOn(Entity * entity, const WFMath::Point< 3 > & position, const std::string& op);
/**
@brief Attach the specified entity
@param entity The entity to be attacked
*/
void attack(Entity* entity);
/**
@brief Stop the current task, if one is in progress.
This could be either a useOn or attack.
*/
void useStop();
void deactivate();
/**
* @brief 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 setIsAdmin(bool isAdmin);
/**
* @brief 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.
*/
bool getIsAdmin();
/**
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*> GotCharacterEntity;
// These two signals just transmit the Entity's
// AddedMember and RemovedMember signals, but
// you're allowed to connect to them as soon as
// the Avatar has been created, instead of having to wait
// for the Entity to be created.
/// An object was added to the inventory
sigc::signal<void,Entity*> InvAdded;
/// An object was removed from the inventory
sigc::signal<void,Entity*> InvRemoved;
/** emitted when this Avatar hears something. Passes the source of
the sound, and the operation that was heard, for example a Talk. */
sigc::signal<void, Entity*, const Atlas::Objects::Operation::RootOperation&> Hear;
/**
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
*/
sigc::signal<void, const TransferInfo &> TransferRequested;
protected:
friend class Account;
/** Create a new Avatar object.
@param pl The player that owns the Avatar
*/
Avatar(Account& pl, const std::string& entId);
friend class AccountRouter;
friend class IGRouter;
/** 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 updateWorldTime(double t);
protected:
void onEntityAppear(Entity* ent);
void onCharacterChildAdded(Entity* child);
void onCharacterChildRemoved(Entity* child);
/**
* @brief Called when the avatar entity is deleted.
*/
void onAvatarEntityDeleted();
void onCharacterWield(const Atlas::Message::Element&);
void onWieldedChanged();
virtual void onTransferRequested(const TransferInfo &transfer);
void logoutResponse(const Atlas::Objects::Operation::RootOperation&);
/**
* @brief Called when a logout of the avatar has been requested by the
* server.
*/
void logoutRequested();
/**
* @brief Called when a logout and server transfer of the avatar has been
* requested by the server.
* @param transferInfo The transfer info which contains information about
* the server to transfer to.
*/
void logoutRequested(const TransferInfo& transferInfo);
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;
};
inline const std::string & Avatar::getId() const
{
return m_entityId;
}
inline EntityPtr Avatar::getEntity() const
{
return m_entity;
}
inline View* Avatar::getView() const
{
return m_view;
}
inline const EntityRef& Avatar::getWielded() const
{
return m_wielded;
}
} // of namespace Eris
#endif
|