Don't headtrack or greet magically hidden actors (bug #5978)

check_span
Alexei Kotov 2 years ago
parent c54822acf9
commit 88bd3d559a

@ -46,6 +46,7 @@
Bug #5863: GetEffect should return true after the player has teleported
Bug #5913: Failed assertion during Ritual of Trees quest
Bug #5937: Lights always need to be rotated by 90 degrees
Bug #5978: NPCs and Creatures talk to and headtrack a player character with a 75% chameleon effect or more
Bug #5989: Simple water isn't affected by texture filter settings
Bug #6037: Launcher: Morrowind content language cannot be set to English
Bug #6051: NaN water height in ESM file is not handled gracefully

@ -253,6 +253,9 @@ namespace MWMechanics
if (targetActor.getClass().getCreatureStats(targetActor).isDead())
return;
if (isTargetMagicallyHidden(targetActor))
return;
static const float fMaxHeadTrackDistance = MWBase::Environment::get().getWorld()->getStore()
.get<ESM::GameSetting>().find("fMaxHeadTrackDistance")->mValue.getFloat();
static const float fInteriorHeadTrackMult = MWBase::Environment::get().getWorld()->getStore()
@ -471,7 +474,7 @@ namespace MWMechanics
if (greetingState == Greet_None)
{
if ((playerPos - actorPos).length2() <= helloDistance * helloDistance &&
!playerStats.isDead() && !actorStats.isParalyzed()
!playerStats.isDead() && !actorStats.isParalyzed() && !isTargetMagicallyHidden(player)
&& MWBase::Environment::get().getWorld()->getLOS(player, actor)
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, actor))
greetingTimer++;

@ -34,4 +34,11 @@ namespace MWMechanics
const MWMechanics::MagicEffects& effects = actor.getClass().getCreatureStats(actor).getMagicEffects();
return effects.get(ESM::MagicEffect::WaterWalking).getMagnitude() > 0;
}
bool isTargetMagicallyHidden(const MWWorld::Ptr& actor)
{
const MagicEffects& magicEffects = actor.getClass().getCreatureStats(actor).getMagicEffects();
return (magicEffects.get(ESM::MagicEffect::Invisibility).getMagnitude() > 0)
|| (magicEffects.get(ESM::MagicEffect::Chameleon).getMagnitude() > 75);
}
}

@ -12,6 +12,7 @@ namespace MWMechanics
bool isPlayerInCombat();
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
bool hasWaterWalking(const MWWorld::Ptr& actor);
bool isTargetMagicallyHidden(const MWWorld::Ptr& actor);
}
#endif

@ -13,6 +13,7 @@
#include "../mwworld/actionequip.hpp"
#include "../mwworld/cellstore.hpp"
#include "actorutil.hpp"
#include "npcstats.hpp"
#include "combat.hpp"
#include "weaponpriority.hpp"

@ -11,7 +11,7 @@
#include "movement.hpp"
#include "creaturestats.hpp"
#include "combat.hpp"
#include "actorutil.hpp"
namespace MWMechanics
{

@ -506,13 +506,6 @@ namespace MWMechanics
return (iFightDistanceBase - fFightDistanceMultiplier * d);
}
bool isTargetMagicallyHidden(const MWWorld::Ptr& target)
{
const MagicEffects& magicEffects = target.getClass().getCreatureStats(target).getMagicEffects();
return (magicEffects.get(ESM::MagicEffect::Invisibility).getMagnitude() > 0)
|| (magicEffects.get(ESM::MagicEffect::Chameleon).getMagnitude() > 75);
}
float getAggroDistance(const MWWorld::Ptr& actor, const osg::Vec3f& lhs, const osg::Vec3f& rhs)
{
if (canActorMoveByZAxis(actor))

@ -54,8 +54,6 @@ void applyFatigueLoss(const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon,
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2);
bool isTargetMagicallyHidden(const MWWorld::Ptr& target);
float getAggroDistance(const MWWorld::Ptr& actor, const osg::Vec3f& lhs, const osg::Vec3f& rhs);
}

Loading…
Cancel
Save