2014-05-13 07:58:32 +00:00
# ifndef GAME_MWMECHANICS_AIFOLLOW_H
# define GAME_MWMECHANICS_AIFOLLOW_H
2012-11-15 21:32:15 +00:00
# include "aipackage.hpp"
# include <string>
2014-01-11 11:06:36 +00:00
# include "pathfinding.hpp"
2014-05-13 17:43:50 +00:00
# include <components/esm/defs.hpp>
2012-11-15 21:32:15 +00:00
2014-06-12 21:27:04 +00:00
namespace ESM
{
namespace AiSequence
{
struct AiFollow ;
}
}
2012-11-15 21:32:15 +00:00
namespace MWMechanics
{
2014-04-30 03:40:59 +00:00
/// \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
2014-06-12 21:27:04 +00:00
* */
class AiFollow : public AiPackage
{
2012-11-16 17:38:15 +00:00
public :
2014-04-30 03:40:59 +00:00
/// Follow Actor for duration or until you arrive at a world position
2014-05-16 10:11:34 +00:00
AiFollow ( const std : : string & ActorId , float duration , float X , float Y , float Z ) ;
2014-04-30 03:40:59 +00:00
/// Follow Actor for duration or until you arrive at a position in a cell
2014-05-16 10:11:34 +00:00
AiFollow ( const std : : string & ActorId , const std : : string & CellId , float duration , float X , float Y , float Z ) ;
2014-04-30 03:40:59 +00:00
/// Follow Actor indefinitively
2014-05-16 10:11:34 +00:00
AiFollow ( const std : : string & ActorId ) ;
2014-04-30 03:40:59 +00:00
2014-06-12 21:27:04 +00:00
AiFollow ( const ESM : : AiSequence : : AiFollow * follow ) ;
2012-11-16 17:38:15 +00:00
virtual AiFollow * clone ( ) const ;
2014-04-30 03:40:59 +00:00
2013-10-30 19:42:50 +00:00
virtual bool execute ( const MWWorld : : Ptr & actor , float duration ) ;
2014-04-30 03:40:59 +00:00
2012-11-16 17:38:15 +00:00
virtual int getTypeId ( ) const ;
2012-11-15 21:32:15 +00:00
2014-04-30 03:40:59 +00:00
/// Returns the actor being followed
2014-01-12 13:02:40 +00:00
std : : string getFollowedActor ( ) ;
2014-06-12 21:27:04 +00:00
virtual void writeState ( ESM : : AiSequence : : AiSequence & sequence ) const ;
2012-11-16 17:38:15 +00:00
private :
2014-04-30 03:40:59 +00:00
/// This will make the actor always follow.
/** Thus ignoring mDuration and mX,mY,mZ (used for summoned creatures). **/
bool mAlwaysFollow ;
2014-06-12 21:27:04 +00:00
float mRemainingDuration ; // Seconds
2012-11-16 17:38:15 +00:00
float mX ;
float mY ;
float mZ ;
2014-05-16 10:11:34 +00:00
std : : string mActorId ;
2014-06-12 21:27:04 +00:00
std : : string mCellId ;
} ;
}
# endif