mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:49:56 +00:00
Use 2D distance for fight rating of vertically moving actors (bug #4961)
This commit is contained in:
parent
a02f730a77
commit
25e52f7dfe
7 changed files with 15 additions and 13 deletions
|
@ -77,6 +77,7 @@
|
|||
Bug #4945: Poor random magic magnitude distribution
|
||||
Bug #4947: Player character doesn't use lip animation
|
||||
Bug #4948: Footstep sounds while levitating on ground level
|
||||
Bug #4961: Flying creature combat engagement takes z-axis into account
|
||||
Bug #4963: Enchant skill progress is incorrect
|
||||
Bug #4964: Multiple effect spell projectile sounds play louder than vanilla
|
||||
Bug #4965: Global light attenuation settings setup is lacking
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
|
@ -16,4 +17,10 @@ namespace MWMechanics
|
|||
{
|
||||
return MWBase::Environment::get().getWorld()->getPlayer().isInCombat();
|
||||
}
|
||||
|
||||
bool canActorMoveByZAxis(const MWWorld::Ptr& actor)
|
||||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
return (actor.getClass().canSwim(actor) && world->isSwimming(actor)) || world->isFlying(actor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace MWMechanics
|
|||
{
|
||||
MWWorld::Ptr getPlayer();
|
||||
bool isPlayerInCombat();
|
||||
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -402,9 +402,3 @@ DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MWMechanics::AiPackage::canActorMoveByZAxis(const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
return (actor.getClass().canSwim(actor) && world->isSwimming(actor)) || world->isFlying(actor) || !world->isActorCollisionEnabled(actor);
|
||||
}
|
||||
|
|
|
@ -130,8 +130,6 @@ namespace MWMechanics
|
|||
|
||||
DetourNavigator::Flags getNavigatorFlags(const MWWorld::Ptr& actor) const;
|
||||
|
||||
bool canActorMoveByZAxis(const MWWorld::Ptr& actor) const;
|
||||
|
||||
// TODO: all this does not belong here, move into temporary storage
|
||||
PathFinder mPathFinder;
|
||||
ObstacleCheck mObstacleCheck;
|
||||
|
|
|
@ -215,11 +215,7 @@ namespace MWMechanics
|
|||
getAllowedNodes(actor, currentCell->getCell(), storage);
|
||||
}
|
||||
|
||||
bool actorCanMoveByZ = (actor.getClass().canSwim(actor) && MWBase::Environment::get().getWorld()->isSwimming(actor))
|
||||
|| MWBase::Environment::get().getWorld()->isFlying(actor)
|
||||
|| !MWBase::Environment::get().getWorld()->isActorCollisionEnabled(actor);
|
||||
|
||||
if(actorCanMoveByZ && mDistance > 0) {
|
||||
if (canActorMoveByZAxis(actor) && mDistance > 0) {
|
||||
// Typically want to idle for a short time before the next wander
|
||||
if (Misc::Rng::rollDice(100) >= 92 && storage.mState != AiWanderStorage::Wander_Walking) {
|
||||
wanderNearStart(actor, storage, mDistance);
|
||||
|
|
|
@ -475,6 +475,11 @@ namespace MWMechanics
|
|||
{
|
||||
osg::Vec3f pos1 (actor1.getRefData().getPosition().asVec3());
|
||||
osg::Vec3f pos2 (actor2.getRefData().getPosition().asVec3());
|
||||
if (canActorMoveByZAxis(actor2))
|
||||
{
|
||||
pos1.z() = 0.f;
|
||||
pos2.z() = 0.f;
|
||||
}
|
||||
|
||||
float d = (pos1 - pos2).length();
|
||||
|
||||
|
|
Loading…
Reference in a new issue