1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 22:49:55 +00:00
openmw-tes3mp/apps/openmw/mwmechanics/aiavoiddoor.hpp

51 lines
1.3 KiB
C++
Raw Normal View History

2014-05-13 17:07:27 +00:00
#ifndef GAME_MWMECHANICS_AIAVOIDDOOR_H
#define GAME_MWMECHANICS_AIAVOIDDOOR_H
#include "aipackage.hpp"
2016-06-17 14:07:16 +00:00
2014-05-13 17:07:27 +00:00
#include <string>
2016-06-17 14:07:16 +00:00
#include <components/esm/defs.hpp>
2016-06-17 14:07:16 +00:00
2014-05-13 17:07:27 +00:00
#include "../mwworld/class.hpp"
2016-06-17 14:07:16 +00:00
#include "pathfinding.hpp"
2014-05-13 17:07:27 +00:00
namespace MWMechanics
{
/// \brief AiPackage to have an actor avoid an opening door
/** The AI will retreat from the door until it has finished opening, walked far away from it, or one second has passed, in an attempt to avoid it
**/
class AiAvoidDoor : public AiPackage
{
2014-05-13 17:07:27 +00:00
public:
/// Avoid door until the door is fully open
2015-12-19 14:57:37 +00:00
AiAvoidDoor(const MWWorld::ConstPtr& doorPtr);
2014-05-13 17:07:27 +00:00
virtual AiAvoidDoor *clone() const;
virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration);
2014-05-13 17:07:27 +00:00
virtual int getTypeId() const;
2014-06-12 21:27:04 +00:00
virtual unsigned int getPriority() const;
virtual bool canCancel() const { return false; }
virtual bool shouldCancelPreviousAi() const { return false; }
2014-05-13 17:07:27 +00:00
private:
float mDuration;
2015-12-19 14:57:37 +00:00
MWWorld::ConstPtr mDoorPtr;
osg::Vec3f mLastPos;
int mDirection;
bool isStuck(const osg::Vec3f& actorPos) const;
void adjustDirection();
float getAdjustedAngle() const;
};
}
#endif
2014-05-13 17:07:27 +00:00