1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +00:00

[Client] Allow AiFollow package to have infinite distance when desired

This commit is contained in:
David Cernat 2018-07-10 01:40:57 +03:00
parent 864c66d1d4
commit b86155dc11
3 changed files with 46 additions and 1 deletions

View file

@ -110,6 +110,17 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte
return false;
}
/*
Start of tes3mp addition
If this follow package is set to allow for any distance, skip the checks below
*/
if (mIgnoreDistance)
mActive = true;
/*
End of tes3mp addition
*/
// AiFollow requires the target to be in range and within sight for the initial activation
if (!mActive)
{
@ -275,4 +286,17 @@ void AiFollow::fastForward(const MWWorld::Ptr& actor, AiState &state)
mRemainingDuration--;
}
/*
Start of tes3mp addition
Make it possible to allow following from any distance
*/
void AiFollow::allowAnyDistance(bool state)
{
mIgnoreDistance = state;
}
/*
End of tes3mp addition
*/
}

View file

@ -57,6 +57,16 @@ namespace MWMechanics
void fastForward(const MWWorld::Ptr& actor, AiState& state);
/*
Start of tes3mp addition
Make it possible to allow following from any distance
*/
void allowAnyDistance(bool state);
/*
End of tes3mp addition
*/
private:
/// This will make the actor always follow.
/** Thus ignoring mDuration and mX,mY,mZ (used for summoned creatures). **/
@ -72,6 +82,16 @@ namespace MWMechanics
int mFollowIndex;
static int mFollowIndexCounter;
/*
Start of tes3mp addition
Track whether this package allows following to start from any distance
*/
bool mIgnoreDistance = false;
/*
End of tes3mp addition
*/
};
}
#endif

View file

@ -233,7 +233,8 @@ void DedicatedActor::setAI()
if (aiAction == mwmp::BaseActorList::FOLLOW)
{
MWMechanics::AiFollow package(targetPtr);
ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(package, ptr);
package.allowAnyDistance(true);
ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(package, ptr, true);
}
}
}