Use walking speed for swimming actor with water walking for pathfinding

This will make them find shorter paths nearby shores.
qt6_macos
elsid 12 months ago
parent b4971b6841
commit 594bd6e136
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -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…
Cancel
Save