mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:36:43 +00:00
Avoid build path through the ground for flying wandering creatures
This commit is contained in:
parent
e82d65a2c7
commit
e033b0c565
1 changed files with 3 additions and 2 deletions
|
@ -298,7 +298,8 @@ namespace MWMechanics
|
||||||
const auto currentPosition = actor.getRefData().getPosition().asVec3();
|
const auto currentPosition = actor.getRefData().getPosition().asVec3();
|
||||||
|
|
||||||
std::size_t attempts = 10; // If a unit can't wander out of water, don't want to hang here
|
std::size_t attempts = 10; // If a unit can't wander out of water, don't want to hang here
|
||||||
bool isWaterCreature = actor.getClass().isPureWaterCreature(actor);
|
const bool isWaterCreature = actor.getClass().isPureWaterCreature(actor);
|
||||||
|
const bool isFlyingCreature = actor.getClass().isPureFlyingCreature(actor);
|
||||||
do {
|
do {
|
||||||
// Determine a random location within radius of original position
|
// Determine a random location within radius of original position
|
||||||
const float wanderRadius = (0.2f + Misc::Rng::rollClosedProbability() * 0.8f) * wanderDistance;
|
const float wanderRadius = (0.2f + Misc::Rng::rollClosedProbability() * 0.8f) * wanderDistance;
|
||||||
|
@ -312,7 +313,7 @@ namespace MWMechanics
|
||||||
if (!isWaterCreature && destinationIsAtWater(actor, mDestination))
|
if (!isWaterCreature && destinationIsAtWater(actor, mDestination))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (isWaterCreature && destinationThroughGround(currentPosition, mDestination))
|
if ((isWaterCreature || isFlyingCreature) && destinationThroughGround(currentPosition, mDestination))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
|
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
|
||||||
|
|
Loading…
Reference in a new issue