MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / setWalkPath

Method setWalkPath

source/entities/MovableGameEntity.cpp:67–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void MovableGameEntity::setWalkPath(const std::string& walkAnim, const std::string& endAnim, bool loopEndAnim,
68 bool playIdleWhenAnimationEnds, const std::vector<Ogre::Vector3>& path)
69{
70 mWalkQueue.clear();
71 // We set the animation after clearing mWalkQueue and before filling it to be
72 // sure it is empty when we set it
73 if(!path.empty())
74 setAnimationState(walkAnim);
75
76 for(const Ogre::Vector3& dest : path)
77 mWalkQueue.push_back(dest);
78
79 if(path.empty())
80 {
81 setAnimationState(endAnim, loopEndAnim, Ogre::Vector3::ZERO, playIdleWhenAnimationEnds);
82 }
83 else
84 {
85 // We save the wanted animation
86 mDestinationAnimationState = endAnim;
87 mDestinationAnimationLoop = loopEndAnim;
88 mDestinationPlayIdleWhenAnimationEnds = playIdleWhenAnimationEnds;
89 }
90
91 if(!getIsOnServerMap())
92 return;
93
94 for(Seat* seat : mSeatsWithVisionNotified)
95 {
96 if(seat->getPlayer() == nullptr)
97 continue;
98 if(!seat->getPlayer()->getIsHuman())
99 continue;
100
101 const std::string& name = getName();
102 uint32_t nbDest = mWalkQueue.size();
103 ServerNotification *serverNotification = new ServerNotification(
104 ServerNotificationType::animatedObjectSetWalkPath, seat->getPlayer());
105 serverNotification->mPacket << name << walkAnim << endAnim << loopEndAnim << playIdleWhenAnimationEnds << nbDest;
106 for(const Ogre::Vector3& v : mWalkQueue)
107 serverNotification->mPacket << v;
108
109 ODServer::getSingleton().queueServerNotification(serverNotification);
110 }
111}
112
113void MovableGameEntity::clearDestinations(const std::string& animation, bool loopAnim, bool playIdleWhenAnimationEnds)
114{

Callers 14

processMessageMethod · 0.80
handleFightMethod · 0.80
handleSearchJobMethod · 0.80
handleFightMethod · 0.80
handleFleeMethod · 0.80
handleFindHomeMethod · 0.80
handleGetFeeMethod · 0.80
handleEatChickenMethod · 0.80
addCreatureUsingRoomMethod · 0.80
addCreatureUsingRoomMethod · 0.80
addCreatureUsingRoomMethod · 0.80

Calls 4

clearMethod · 0.80
getIsHumanMethod · 0.80
getPlayerMethod · 0.45

Tested by

no test coverage detected