| 65 | } |
| 66 | |
| 67 | void 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 | |
| 113 | void MovableGameEntity::clearDestinations(const std::string& animation, bool loopAnim, bool playIdleWhenAnimationEnds) |
| 114 | { |
no test coverage detected