mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-01 20:11:31 +00:00
Use walking speed for swimming actor with water walking for pathfinding
This will make them find shorter paths nearby shores.
This commit is contained in:
parent
b4971b6841
commit
594bd6e136
2 changed files with 9 additions and 2 deletions
|
@ -121,6 +121,7 @@
|
|||
Bug #7723: Assaulting vampires and werewolves shouldn't be a crime
|
||||
Bug #7724: Guards don't help vs werewolves
|
||||
Bug #7742: Governing attribute training limit should use the modified attribute
|
||||
Bug #7758: Water walking is not taken into account to compute path cost on the water
|
||||
Feature #2566: Handle NAM9 records for manual cell references
|
||||
Feature #3537: Shader-based water ripples
|
||||
Feature #5173: Support for NiFogProperty
|
||||
|
|
|
@ -492,8 +492,6 @@ DetourNavigator::AreaCosts MWMechanics::AiPackage::getAreaCosts(const MWWorld::P
|
|||
const DetourNavigator::Flags flags = getNavigatorFlags(actor);
|
||||
const MWWorld::Class& actorClass = actor.getClass();
|
||||
|
||||
const float swimSpeed = (flags & DetourNavigator::Flag_swim) == 0 ? 0.0f : actorClass.getSwimSpeed(actor);
|
||||
|
||||
const float walkSpeed = [&] {
|
||||
if ((flags & DetourNavigator::Flag_walk) == 0)
|
||||
return 0.0f;
|
||||
|
@ -502,6 +500,14 @@ DetourNavigator::AreaCosts MWMechanics::AiPackage::getAreaCosts(const MWWorld::P
|
|||
return actorClass.getRunSpeed(actor);
|
||||
}();
|
||||
|
||||
const float swimSpeed = [&] {
|
||||
if ((flags & DetourNavigator::Flag_swim) == 0)
|
||||
return 0.0f;
|
||||
if (hasWaterWalking(actor))
|
||||
return walkSpeed;
|
||||
return actorClass.getSwimSpeed(actor);
|
||||
}();
|
||||
|
||||
const float maxSpeed = std::max(swimSpeed, walkSpeed);
|
||||
|
||||
if (maxSpeed == 0)
|
||||
|
|
Loading…
Reference in a new issue