1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-10 21:40:15 +00:00

Terminate AiPursue when target dies (Fixes #1836)

This commit is contained in:
scrawl 2014-08-23 22:55:32 +02:00
parent 1a8acac40a
commit 3dbe17b6ed

View File

@ -32,12 +32,18 @@ AiPursue *MWMechanics::AiPursue::clone() const
}
bool AiPursue::execute (const MWWorld::Ptr& actor, float duration)
{
if(actor.getClass().getCreatureStats(actor).isDead())
return true;
ESM::Position pos = actor.getRefData().getPosition(); //position of the actor
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtrViaActorId(mTargetActorId); //The target to follow
if(target == MWWorld::Ptr())
return true; //Target doesn't exist
if(target.getClass().getCreatureStats(target).isDead())
return true;
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
//Set the target desition from the actor