OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
MWMechanics::AiFollow Class Reference

AiPackage for an actor to follow another actor/the PC. More...

#include <aifollow.hpp>

Inheritance diagram for MWMechanics::AiFollow:
Collaboration diagram for MWMechanics::AiFollow:

Public Member Functions

 AiFollow (const std::string &ActorId, float duration, float X, float Y, float Z)
 Follow Actor for duration or until you arrive at a world position. More...
 
 AiFollow (const std::string &ActorId, const std::string &CellId, float duration, float X, float Y, float Z)
 Follow Actor for duration or until you arrive at a position in a cell. More...
 
 AiFollow (const std::string &ActorId, bool commanded=false)
 Follow Actor indefinitively. More...
 
 AiFollow (const ESM::AiSequence::AiFollow *follow)
 
MWWorld::Ptr getTarget () const
 Get the target actor the AI is targeted at (not applicable to all AI packages, default return empty Ptr) More...
 
virtual bool sideWithTarget () const
 Return true if having this AiPackage makes the actor side with the target in fights (default false) More...
 
virtual bool followTargetThroughDoors () const
 Return true if the actor should follow the target through teleport doors (default false) More...
 
virtual bool shouldCancelPreviousAi () const
 Upon adding this Ai package, should the Ai Sequence attempt to cancel previous Ai packages (default true)? More...
 
virtual AiFollowclone () const
 Clones the package. More...
 
virtual bool execute (const MWWorld::Ptr &actor, CharacterController &characterController, AiState &state, float duration)
 
virtual int getTypeId () const
 
std::string getFollowedActor ()
 Returns the actor being followed. More...
 
virtual void writeState (ESM::AiSequence::AiSequence &sequence) const
 
bool isCommanded () const
 
int getFollowIndex () const
 
void fastForward (const MWWorld::Ptr &actor, AiState &state)
 Simulates the passing of time. More...
 
- Public Member Functions inherited from MWMechanics::AiPackage
 AiPackage ()
 Default constructor. More...
 
virtual ~AiPackage ()
 Default Deconstructor. More...
 
virtual unsigned int getPriority () const
 Higher number is higher priority (0 being the lowest) More...
 
virtual bool canCancel () const
 Can this Ai package be canceled? (default true) More...
 
virtual bool getRepeat () const
 Return true if this package should repeat. Currently only used for Wander packages. More...
 
void reset ()
 Reset pathfinding state. More...
 
bool isTargetMagicallyHidden (const MWWorld::Ptr &target)
 

Private Attributes

bool mAlwaysFollow
 This will make the actor always follow. More...
 
bool mCommanded
 
float mDuration
 
float mRemainingDuration
 
float mX
 
float mY
 
float mZ
 
std::string mActorRefId
 
int mActorId
 
std::string mCellId
 
bool mActive
 
int mFollowIndex
 

Static Private Attributes

static int mFollowIndexCounter = 0
 

Additional Inherited Members

- Public Types inherited from MWMechanics::AiPackage
enum  TypeId {
  TypeIdNone = -1, TypeIdWander = 0, TypeIdTravel = 1, TypeIdEscort = 2,
  TypeIdFollow = 3, TypeIdActivate = 4, TypeIdCombat = 5, TypeIdPursue = 6,
  TypeIdAvoidDoor = 7, TypeIdFace = 8
}
 Enumerates the various AITypes available. More...
 
- Static Public Member Functions inherited from MWMechanics::AiPackage
static bool isReachableRotatingOnTheRun (const MWWorld::Ptr &actor, const ESM::Pathgrid::Point &dest)
 Return if actor's rotation speed is sufficient to rotate to the destination pathpoint on the run. Otherwise actor should rotate while standing. More...
 
- Protected Member Functions inherited from MWMechanics::AiPackage
bool pathTo (const MWWorld::Ptr &actor, const ESM::Pathgrid::Point &dest, float duration, float destTolerance=0.0f)
 Handles path building and shortcutting with obstacles avoiding. More...
 
bool shortcutPath (const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint, const MWWorld::Ptr &actor, bool *destInLOS)
 
bool checkWayIsClearForActor (const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint, const MWWorld::Ptr &actor)
 Check if the way to the destination is clear, taking into account actor speed. More...
 
virtual bool doesPathNeedRecalc (const ESM::Pathgrid::Point &newDest, const MWWorld::CellStore *currentCell)
 
void evadeObstacles (const MWWorld::Ptr &actor, float duration, const ESM::Position &pos)
 
- Protected Attributes inherited from MWMechanics::AiPackage
PathFinder mPathFinder
 
ObstacleCheck mObstacleCheck
 
float mTimer
 
osg::Vec3f mLastActorPos
 
short mRotateOnTheRunChecks
 
bool mIsShortcutting
 
bool mShortcutProhibited
 
ESM::Pathgrid::Point mShortcutFailPos
 

Detailed Description

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

Constructor & Destructor Documentation

MWMechanics::AiFollow::AiFollow ( const std::string &  ActorId,
float  duration,
float  X,
float  Y,
float  Z 
)

Follow Actor for duration or until you arrive at a world position.

MWMechanics::AiFollow::AiFollow ( const std::string &  ActorId,
const std::string &  CellId,
float  duration,
float  X,
float  Y,
float  Z 
)

Follow Actor for duration or until you arrive at a position in a cell.

MWMechanics::AiFollow::AiFollow ( const std::string &  ActorId,
bool  commanded = false 
)

Follow Actor indefinitively.

MWMechanics::AiFollow::AiFollow ( const ESM::AiSequence::AiFollow follow)

Member Function Documentation

AiFollow * MWMechanics::AiFollow::clone ( ) const
virtual

Clones the package.

Implements MWMechanics::AiPackage.

bool MWMechanics::AiFollow::execute ( const MWWorld::Ptr actor,
CharacterController characterController,
AiState state,
float  duration 
)
virtual

Updates and runs the package (Should run every frame)

Returns
Package completed?

Implements MWMechanics::AiPackage.

Here is the call graph for this function:

void MWMechanics::AiFollow::fastForward ( const MWWorld::Ptr actor,
AiState state 
)
virtual

Simulates the passing of time.

Reimplemented from MWMechanics::AiPackage.

virtual bool MWMechanics::AiFollow::followTargetThroughDoors ( ) const
inlinevirtual

Return true if the actor should follow the target through teleport doors (default false)

Reimplemented from MWMechanics::AiPackage.

std::string MWMechanics::AiFollow::getFollowedActor ( )

Returns the actor being followed.

int MWMechanics::AiFollow::getFollowIndex ( ) const
MWWorld::Ptr MWMechanics::AiFollow::getTarget ( ) const
virtual

Get the target actor the AI is targeted at (not applicable to all AI packages, default return empty Ptr)

Reimplemented from MWMechanics::AiPackage.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWMechanics::AiFollow::getTypeId ( ) const
virtual

Returns the TypeID of the AiPackage

See Also
enum TypeId

Implements MWMechanics::AiPackage.

bool MWMechanics::AiFollow::isCommanded ( ) const

Here is the caller graph for this function:

virtual bool MWMechanics::AiFollow::shouldCancelPreviousAi ( ) const
inlinevirtual

Upon adding this Ai package, should the Ai Sequence attempt to cancel previous Ai packages (default true)?

Reimplemented from MWMechanics::AiPackage.

virtual bool MWMechanics::AiFollow::sideWithTarget ( ) const
inlinevirtual

Return true if having this AiPackage makes the actor side with the target in fights (default false)

Reimplemented from MWMechanics::AiPackage.

void MWMechanics::AiFollow::writeState ( ESM::AiSequence::AiSequence sequence) const
virtual

Reimplemented from MWMechanics::AiPackage.

Member Data Documentation

bool MWMechanics::AiFollow::mActive
private
int MWMechanics::AiFollow::mActorId
mutableprivate
std::string MWMechanics::AiFollow::mActorRefId
private
bool MWMechanics::AiFollow::mAlwaysFollow
private

This will make the actor always follow.

Thus ignoring mDuration and mX,mY,mZ (used for summoned creatures).

std::string MWMechanics::AiFollow::mCellId
private
bool MWMechanics::AiFollow::mCommanded
private
float MWMechanics::AiFollow::mDuration
private
int MWMechanics::AiFollow::mFollowIndex
private
int MWMechanics::AiFollow::mFollowIndexCounter = 0
staticprivate
float MWMechanics::AiFollow::mRemainingDuration
private
float MWMechanics::AiFollow::mX
private
float MWMechanics::AiFollow::mY
private
float MWMechanics::AiFollow::mZ
private

The documentation for this class was generated from the following files: