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:
parent
1a8acac40a
commit
3dbe17b6ed
@ -32,12 +32,18 @@ AiPursue *MWMechanics::AiPursue::clone() const
|
|||||||
}
|
}
|
||||||
bool AiPursue::execute (const MWWorld::Ptr& actor, float duration)
|
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
|
ESM::Position pos = actor.getRefData().getPosition(); //position of the actor
|
||||||
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtrViaActorId(mTargetActorId); //The target to follow
|
const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtrViaActorId(mTargetActorId); //The target to follow
|
||||||
|
|
||||||
if(target == MWWorld::Ptr())
|
if(target == MWWorld::Ptr())
|
||||||
return true; //Target doesn't exist
|
return true; //Target doesn't exist
|
||||||
|
|
||||||
|
if(target.getClass().getCreatureStats(target).isDead())
|
||||||
|
return true;
|
||||||
|
|
||||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
||||||
|
|
||||||
//Set the target desition from the actor
|
//Set the target desition from the actor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user