mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 19:49:54 +00:00
2e9985c1a3
More robust in case the target changes cell or there are multiple targets with the same RefId
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#ifndef GAME_MWMECHANICS_AIFOLLOW_H
|
|
#define GAME_MWMECHANICS_AIFOLLOW_H
|
|
|
|
#include "aipackage.hpp"
|
|
#include <string>
|
|
#include "pathfinding.hpp"
|
|
#include <components/esm/defs.hpp>
|
|
|
|
namespace MWMechanics
|
|
{
|
|
/// \brief AiPackage for an actor to follow another actor/the PC
|
|
/** The AI will follow the target until a condition (time, or position) are set. Both can be disabled to cause the actor to follow the other indefinitely
|
|
**/
|
|
class AiFollow : public AiPackage
|
|
{
|
|
public:
|
|
/// Follow Actor for duration or until you arrive at a world position
|
|
AiFollow(const MWWorld::Ptr& actor,float duration, float X, float Y, float Z);
|
|
/// Follow Actor for duration or until you arrive at a position in a cell
|
|
AiFollow(const MWWorld::Ptr& actor,const std::string &CellId,float duration, float X, float Y, float Z);
|
|
/// Follow Actor indefinitively
|
|
AiFollow(const MWWorld::Ptr& actor);
|
|
|
|
virtual AiFollow *clone() const;
|
|
|
|
virtual bool execute (const MWWorld::Ptr& actor,float duration);
|
|
|
|
virtual int getTypeId() const;
|
|
|
|
/// Returns the actor being followed
|
|
std::string getFollowedActor();
|
|
|
|
private:
|
|
/// This will make the actor always follow.
|
|
/** Thus ignoring mDuration and mX,mY,mZ (used for summoned creatures). **/
|
|
bool mAlwaysFollow;
|
|
float mDuration;
|
|
float mX;
|
|
float mY;
|
|
float mZ;
|
|
int mActorId; // The actor we should follow
|
|
std::string mCellId;
|
|
};
|
|
}
|
|
#endif
|