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