mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 16:20:21 +00:00
Add and use 'always active' AI package flag
Update documentation
This commit is contained in:
parent
2d87d287ba
commit
fc0f813dcb
@ -1728,9 +1728,14 @@ namespace MWMechanics
|
|||||||
const float dist = (playerPos - iter->first.getRefData().getPosition().asVec3()).length();
|
const float dist = (playerPos - iter->first.getRefData().getPosition().asVec3()).length();
|
||||||
bool isPlayer = iter->first == player;
|
bool isPlayer = iter->first == player;
|
||||||
CreatureStats &stats = iter->first.getClass().getCreatureStats(iter->first);
|
CreatureStats &stats = iter->first.getClass().getCreatureStats(iter->first);
|
||||||
int packageId = stats.getAiSequence().getTypeId();
|
// Actors with active AI should be able to move.
|
||||||
bool travelling = (packageId == AiPackage::TypeIdTravel) || (packageId == AiPackage::TypeIdInternalTravel);
|
bool alwaysActive = false;
|
||||||
bool inRange = isPlayer || dist <= mActorsProcessingRange || travelling;
|
if (!isPlayer && isConscious(iter->first) && !stats.isParalyzed())
|
||||||
|
{
|
||||||
|
MWMechanics::AiSequence& seq = stats.getAiSequence();
|
||||||
|
alwaysActive = !seq.isEmpty() && seq.getActivePackage()->alwaysActive();
|
||||||
|
}
|
||||||
|
bool inRange = isPlayer || dist <= mActorsProcessingRange || alwaysActive;
|
||||||
int activeFlag = 1; // Can be changed back to '2' to keep updating bounding boxes off screen (more accurate, but slower)
|
int activeFlag = 1; // Can be changed back to '2' to keep updating bounding boxes off screen (more accurate, but slower)
|
||||||
if (isPlayer)
|
if (isPlayer)
|
||||||
activeFlag = 2;
|
activeFlag = 2;
|
||||||
|
@ -104,6 +104,9 @@ namespace MWMechanics
|
|||||||
|
|
||||||
virtual osg::Vec3f getDestination() { return osg::Vec3f(0, 0, 0); }
|
virtual osg::Vec3f getDestination() { return osg::Vec3f(0, 0, 0); }
|
||||||
|
|
||||||
|
// Return true if any loaded actor with this AI package must be active.
|
||||||
|
virtual bool alwaysActive() const { return false; }
|
||||||
|
|
||||||
/// Reset pathfinding state
|
/// Reset pathfinding state
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
@ -209,12 +209,15 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
|||||||
}
|
}
|
||||||
|
|
||||||
MWMechanics::AiPackage* package = mPackages.front();
|
MWMechanics::AiPackage* package = mPackages.front();
|
||||||
|
if (!package->alwaysActive() && outOfRange)
|
||||||
|
return;
|
||||||
|
|
||||||
int packageTypeId = package->getTypeId();
|
int packageTypeId = package->getTypeId();
|
||||||
// workaround ai packages not being handled as in the vanilla engine
|
// workaround ai packages not being handled as in the vanilla engine
|
||||||
if (isActualAiPackage(packageTypeId))
|
if (isActualAiPackage(packageTypeId))
|
||||||
mLastAiPackage = packageTypeId;
|
mLastAiPackage = packageTypeId;
|
||||||
// if active package is combat one, choose nearest target
|
// if active package is combat one, choose nearest target
|
||||||
if (!outOfRange && packageTypeId == AiPackage::TypeIdCombat)
|
if (packageTypeId == AiPackage::TypeIdCombat)
|
||||||
{
|
{
|
||||||
std::list<AiPackage *>::iterator itActualCombat;
|
std::list<AiPackage *>::iterator itActualCombat;
|
||||||
|
|
||||||
@ -272,10 +275,6 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (outOfRange && packageTypeId != AiPackage::TypeIdTravel
|
|
||||||
&& packageTypeId != AiPackage::TypeIdInternalTravel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (package->execute (actor, characterController, mAiState, duration))
|
if (package->execute (actor, characterController, mAiState, duration))
|
||||||
{
|
{
|
||||||
// Put repeating noncombat AI packages on the end of the stack so they can be used again
|
// Put repeating noncombat AI packages on the end of the stack so they can be used again
|
||||||
|
@ -34,6 +34,8 @@ namespace MWMechanics
|
|||||||
|
|
||||||
virtual bool useVariableSpeed() const { return true;}
|
virtual bool useVariableSpeed() const { return true;}
|
||||||
|
|
||||||
|
virtual bool alwaysActive() const { return true; }
|
||||||
|
|
||||||
virtual osg::Vec3f getDestination() { return osg::Vec3f(mX, mY, mZ); }
|
virtual osg::Vec3f getDestination() { return osg::Vec3f(mX, mY, mZ); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -103,13 +103,13 @@ actors processing range
|
|||||||
:Range: 3584 to 7168
|
:Range: 3584 to 7168
|
||||||
:Default: 7168
|
:Default: 7168
|
||||||
|
|
||||||
This setting allows to specify a distance from player in game units, in which OpenMW updates actor's state.
|
This setting specifies the actor state update distance from the player in game units.
|
||||||
Actor state update includes AI, animations, and physics processing.
|
Actor state update includes AI, animations, and physics processing.
|
||||||
Actors near that border start softly fade out instead of just appearing/disapperaing.
|
Actors close to this distance softly fade in and out instead of appearing or disappearing abruptly.
|
||||||
It is not recommended to change this value from default if you use mods with
|
Keep in mind that actors running Travel AI packages are always active to avoid
|
||||||
long-range AiTravel packages (e.g. patrols, caravans and travellers).
|
issues in mods with long-range AiTravel packages (for example, patrols, caravans and travellers).
|
||||||
|
|
||||||
This setting can be controlled in game with the "Actors processing range slider" in the Prefs panel of the Options menu.
|
This setting can be controlled in game with the "Actors Processing Range" slider in the Prefs panel of the Options menu.
|
||||||
|
|
||||||
classic reflected absorb spells behavior
|
classic reflected absorb spells behavior
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user