2012-09-04 13:25:53 +02:00
|
|
|
#ifndef GAME_MWMECHANICS_AIPACKAGE_H
|
|
|
|
#define GAME_MWMECHANICS_AIPACKAGE_H
|
|
|
|
|
2014-05-12 21:05:32 -04:00
|
|
|
#include "pathfinding.hpp"
|
|
|
|
#include "../../../components/esm/defs.hpp"
|
|
|
|
|
2014-05-13 03:58:32 -04:00
|
|
|
#include "obstacle.hpp"
|
|
|
|
|
2012-09-04 13:25:53 +02:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
/// \brief Base class for AI packages
|
|
|
|
class AiPackage
|
|
|
|
{
|
|
|
|
public:
|
2014-04-29 23:40:59 -04:00
|
|
|
///Enumerates the various AITypes availible.
|
2014-01-07 04:12:37 +04:00
|
|
|
enum TypeId {
|
|
|
|
TypeIdNone = -1,
|
|
|
|
TypeIdWander = 0,
|
|
|
|
TypeIdTravel = 1,
|
|
|
|
TypeIdEscort = 2,
|
|
|
|
TypeIdFollow = 3,
|
|
|
|
TypeIdActivate = 4,
|
2014-04-02 00:18:22 -04:00
|
|
|
TypeIdCombat = 5,
|
2014-05-13 03:58:32 -04:00
|
|
|
TypeIdPursue = 6,
|
|
|
|
TypeIdAvoidDoor = 7
|
2014-01-07 04:12:37 +04:00
|
|
|
};
|
|
|
|
|
2014-05-13 03:58:32 -04:00
|
|
|
///Default constructor
|
|
|
|
AiPackage();
|
|
|
|
|
2014-04-29 23:40:59 -04:00
|
|
|
///Default Deconstructor
|
2012-09-04 13:25:53 +02:00
|
|
|
virtual ~AiPackage();
|
2014-04-29 23:40:59 -04:00
|
|
|
|
|
|
|
///Clones the package
|
2012-09-04 13:25:53 +02:00
|
|
|
virtual AiPackage *clone() const = 0;
|
2014-04-29 23:40:59 -04:00
|
|
|
|
|
|
|
/// Updates and runs the package (Should run every frame)
|
|
|
|
/// \return Package completed?
|
2013-10-30 20:42:50 +01:00
|
|
|
virtual bool execute (const MWWorld::Ptr& actor,float duration) = 0;
|
2014-04-29 23:40:59 -04:00
|
|
|
|
|
|
|
/// Returns the TypeID of the AiPackage
|
|
|
|
/// \see enum TypeId
|
2012-09-04 13:25:53 +02:00
|
|
|
virtual int getTypeId() const = 0;
|
2013-11-18 12:33:09 +01:00
|
|
|
|
2014-05-12 21:05:32 -04:00
|
|
|
/// Higher number is higher priority (0 being the lowest)
|
2013-11-18 12:33:09 +01:00
|
|
|
virtual unsigned int getPriority() const {return 0;}
|
2014-05-12 21:05:32 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Causes the actor to attempt to walk to the specified location
|
|
|
|
/** \return If the actor has arrived at his destination **/
|
|
|
|
bool pathTo(const MWWorld::Ptr& actor, ESM::Pathgrid::Point dest, float duration);
|
|
|
|
|
|
|
|
PathFinder mPathFinder;
|
2014-05-13 03:58:32 -04:00
|
|
|
ObstacleCheck mObstacleCheck;
|
2014-05-12 21:05:32 -04:00
|
|
|
|
2014-05-13 03:58:32 -04:00
|
|
|
float mDoorCheckDuration;
|
2014-05-12 21:05:32 -04:00
|
|
|
float mTimer;
|
|
|
|
float mStuckTimer;
|
2014-05-13 03:58:32 -04:00
|
|
|
float mTotalTime;
|
|
|
|
|
|
|
|
MWWorld::LiveCellRef<ESM::Door>* mLastDoorChecked; //Used to ensure we don't try to CONSTANTLY open a door
|
2014-05-12 21:05:32 -04:00
|
|
|
|
|
|
|
ESM::Position mStuckPos;
|
2012-09-04 13:25:53 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|