eris
1.4.0
A WorldForge client library.
|
7 #include <Atlas/Objects/ObjectsFwd.h>
8 #include <Atlas/Message/Element.h>
10 #include <wfmath/point.h>
11 #include <wfmath/vector.h>
12 #include <wfmath/quaternion.h>
13 #include <wfmath/timestamp.h>
15 #include <sigc++/trackable.h>
16 #include <sigc++/signal.h>
17 #include <sigc++/connection.h>
19 #include <boost/optional.hpp>
39 class Avatar :
virtual public sigc::trackable {
45 Avatar(
Account& pl, std::string mindId, std::string entityId);
51 const std::string&
getId()
const;
54 const std::string& getEntityId()
const;
60 View& getView()
const;
79 void wield(
Eris::Entity* entity, std::string attachPoint)
const;
82 void say(
const std::string&);
87 void sayTo(
const std::string& message,
const std::vector<std::string>& entities);
90 void emote(
const std::string&);
93 void moveToPoint(
const WFMath::Point<3>&,
const WFMath::Quaternion& orient);
96 void moveInDirection(
const WFMath::Vector<3>&,
const WFMath::Quaternion&);
112 const WFMath::Point<3>& pos = WFMath::Point<3>(),
113 const WFMath::Quaternion& orientation = WFMath::Quaternion(),
114 boost::optional<float> offset = boost::none,
155 void send(
const Atlas::Objects::Operation::RootOperation& op);
177 sigc::signal<void, Entity&> ContainerOpened;
178 sigc::signal<void, Entity&> ContainerClosed;
199 void onEntityAppear(
Entity* ent);
206 virtual void onTransferRequested(
const TransferInfo& transfer);
208 void logoutResponse(
const Atlas::Objects::Operation::RootOperation&);
224 void containerActiveChanged(
const Atlas::Message::Element& element);
228 std::string m_mindId;
229 std::string m_entityId;
232 WFMath::TimeStamp m_stampAtLastOp;
235 std::unique_ptr<View> m_view;
236 std::unique_ptr<IGRouter> m_router;
238 sigc::connection m_entityAppearanceCon;
239 sigc::connection m_avatarEntityDeletedConnection;
243 std::unique_ptr<TimedEvent> m_logoutTimer;
245 std::map<std::string, std::unique_ptr<EntityRef>> m_activeContainers;
247 sigc::connection m_entityParentDeletedConnection;
254 inline const std::string& Avatar::getEntityId()
const {
263 inline View& Avatar::getView()
const {
267 inline Account& Avatar::getAccount()
const {
272 return m_activeContainers;
void send(const Atlas::Objects::Operation::RootOperation &op)
Sends an operation from this Avatar.
Entity is a concrete (instantiable) class representing one game entity.
void moveInDirection(const WFMath::Vector< 3 > &, const WFMath::Quaternion &)
Set the character's velocity and orientation. Any non-valid data will not be sent.
void touch(Entity *, const WFMath::Point< 3 > &pos)
Touch an entity.
bool getIsAdmin() const
Gets whether the current avatar is an admin character.
void emote(const std::string &)
Emote something (in-game)
void updateWorldTime(double t)
void say(const std::string &)
Say something (in-game)
void useStop()
Stop the current task, if one is in progress.
Avatar(Account &pl, std::string mindId, std::string entityId)
Encapsulates all the state of an Atlas Account, and methods that operation on that state.
Entity * getEntity() const
Get the Entity this Avatar refers to.
void sayTo(const std::string &message, const std::vector< std::string > &entities)
const std::string & getId() const
Get the Mind id of this Avatar. All interaction with the entity goes through the Mind.
sigc::signal< void, const TransferInfo & > TransferRequested
void setIsAdmin(bool isAdmin)
Sets whether the current avatar is an admin character.
void onAvatarEntityDeleted()
Called when the avatar entity is deleted.
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.
void logoutRequested()
Called when a logout of the avatar has been requested by the server.
const std::map< std::string, std::unique_ptr< EntityRef > > & getActiveContainers() const
sigc::signal< void, Entity * > GotCharacterEntity
sigc::signal< void > CharacterEntityDeleted
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.