forked from teamnwah/openmw-tes3coop
[Client] Allow AiFollow package to have infinite distance when desired
This commit is contained in:
parent
864c66d1d4
commit
b86155dc11
3 changed files with 46 additions and 1 deletions
|
@ -110,6 +110,17 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
return false;
|
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
|
// AiFollow requires the target to be in range and within sight for the initial activation
|
||||||
if (!mActive)
|
if (!mActive)
|
||||||
{
|
{
|
||||||
|
@ -275,4 +286,17 @@ void AiFollow::fastForward(const MWWorld::Ptr& actor, AiState &state)
|
||||||
mRemainingDuration--;
|
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
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,16 @@ namespace MWMechanics
|
||||||
|
|
||||||
void fastForward(const MWWorld::Ptr& actor, AiState& state);
|
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:
|
private:
|
||||||
/// This will make the actor always follow.
|
/// This will make the actor always follow.
|
||||||
/** Thus ignoring mDuration and mX,mY,mZ (used for summoned creatures). **/
|
/** Thus ignoring mDuration and mX,mY,mZ (used for summoned creatures). **/
|
||||||
|
@ -72,6 +82,16 @@ namespace MWMechanics
|
||||||
int mFollowIndex;
|
int mFollowIndex;
|
||||||
|
|
||||||
static int mFollowIndexCounter;
|
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
|
#endif
|
||||||
|
|
|
@ -233,7 +233,8 @@ void DedicatedActor::setAI()
|
||||||
if (aiAction == mwmp::BaseActorList::FOLLOW)
|
if (aiAction == mwmp::BaseActorList::FOLLOW)
|
||||||
{
|
{
|
||||||
MWMechanics::AiFollow package(targetPtr);
|
MWMechanics::AiFollow package(targetPtr);
|
||||||
ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(package, ptr);
|
package.allowAnyDistance(true);
|
||||||
|
ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(package, ptr, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue