OpenMW
|
Base class for AI packages. More...
#include <aipackage.hpp>
Public Types | |
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... | |
Public Member Functions | |
AiPackage () | |
Default constructor. More... | |
virtual | ~AiPackage () |
Default Deconstructor. More... | |
virtual AiPackage * | clone () const =0 |
Clones the package. More... | |
virtual bool | execute (const MWWorld::Ptr &actor, CharacterController &characterController, AiState &state, float duration)=0 |
virtual int | getTypeId () const =0 |
virtual unsigned int | getPriority () const |
Higher number is higher priority (0 being the lowest) More... | |
virtual void | writeState (ESM::AiSequence::AiSequence &sequence) const |
virtual void | fastForward (const MWWorld::Ptr &actor, AiState &state) |
Simulates the passing of time. More... | |
virtual 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 | canCancel () const |
Can this Ai package be canceled? (default true) More... | |
virtual bool | shouldCancelPreviousAi () const |
Upon adding this Ai package, should the Ai Sequence attempt to cancel previous Ai packages (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) |
Static Public Member Functions | |
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 | |
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 | |
PathFinder | mPathFinder |
ObstacleCheck | mObstacleCheck |
float | mTimer |
osg::Vec3f | mLastActorPos |
short | mRotateOnTheRunChecks |
bool | mIsShortcutting |
bool | mShortcutProhibited |
ESM::Pathgrid::Point | mShortcutFailPos |
Private Member Functions | |
bool | isNearInactiveCell (const ESM::Position &actorPos) |
Base class for AI packages.
MWMechanics::AiPackage::AiPackage | ( | ) |
Default constructor.
|
virtual |
Default Deconstructor.
|
virtual |
Can this Ai package be canceled? (default true)
Reimplemented in MWMechanics::AiCombat, MWMechanics::AiPursue, MWMechanics::AiAvoidDoor, and MWMechanics::AiFace.
|
protected |
Check if the way to the destination is clear, taking into account actor speed.
|
pure virtual |
Clones the package.
Implemented in MWMechanics::AiCombat, MWMechanics::AiFollow, MWMechanics::AiWander, MWMechanics::AiEscort, MWMechanics::AiPursue, MWMechanics::AiActivate, MWMechanics::AiTravel, MWMechanics::AiAvoidDoor, and MWMechanics::AiFace.
|
protectedvirtual |
|
protected |
|
pure virtual |
Updates and runs the package (Should run every frame)
Implemented in MWMechanics::AiCombat, MWMechanics::AiFollow, MWMechanics::AiWander, MWMechanics::AiEscort, MWMechanics::AiPursue, MWMechanics::AiTravel, MWMechanics::AiActivate, MWMechanics::AiAvoidDoor, and MWMechanics::AiFace.
|
inlinevirtual |
Simulates the passing of time.
Reimplemented in MWMechanics::AiFollow, MWMechanics::AiWander, MWMechanics::AiEscort, and MWMechanics::AiTravel.
|
virtual |
Return true if the actor should follow the target through teleport doors (default false)
Reimplemented in MWMechanics::AiFollow.
|
inlinevirtual |
Higher number is higher priority (0 being the lowest)
Reimplemented in MWMechanics::AiCombat, MWMechanics::AiAvoidDoor, and MWMechanics::AiFace.
|
virtual |
Return true if this package should repeat. Currently only used for Wander packages.
Reimplemented in MWMechanics::AiWander.
|
virtual |
Get the target actor the AI is targeted at (not applicable to all AI packages, default return empty Ptr)
Reimplemented in MWMechanics::AiCombat, MWMechanics::AiEscort, MWMechanics::AiFollow, and MWMechanics::AiPursue.
|
pure virtual |
Returns the TypeID of the AiPackage
Implemented in MWMechanics::AiCombat, MWMechanics::AiFollow, MWMechanics::AiWander, MWMechanics::AiEscort, MWMechanics::AiPursue, MWMechanics::AiTravel, MWMechanics::AiActivate, MWMechanics::AiAvoidDoor, and MWMechanics::AiFace.
|
private |
|
static |
Return if actor's rotation speed is sufficient to rotate to the destination pathpoint on the run. Otherwise actor should rotate while standing.
bool MWMechanics::AiPackage::isTargetMagicallyHidden | ( | const MWWorld::Ptr & | target | ) |
|
protected |
Handles path building and shortcutting with obstacles avoiding.
Stops the actor when it gets too close to a unloaded cell
void MWMechanics::AiPackage::reset | ( | ) |
Reset pathfinding state.
|
protected |
Check if there aren't any obstacles along the path to make shortcut possible If a shortcut is possible then path will be cleared and filled with the destination point.
destInLOS | If not NULL function will return ray cast check result |
|
virtual |
Upon adding this Ai package, should the Ai Sequence attempt to cancel previous Ai packages (default true)?
Reimplemented in MWMechanics::AiCombat, MWMechanics::AiPursue, MWMechanics::AiFollow, MWMechanics::AiAvoidDoor, and MWMechanics::AiFace.
|
virtual |
Return true if having this AiPackage makes the actor side with the target in fights (default false)
Reimplemented in MWMechanics::AiEscort, and MWMechanics::AiFollow.
|
inlinevirtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |