diff --git a/CHANGELOG.md b/CHANGELOG.md index 860477345f..a190e566a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index a5ab0a6ae6..edc79c4038 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -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().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++; diff --git a/apps/openmw/mwmechanics/actorutil.cpp b/apps/openmw/mwmechanics/actorutil.cpp index 8615af9860..3c6c9593c2 100644 --- a/apps/openmw/mwmechanics/actorutil.cpp +++ b/apps/openmw/mwmechanics/actorutil.cpp @@ -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); + } } diff --git a/apps/openmw/mwmechanics/actorutil.hpp b/apps/openmw/mwmechanics/actorutil.hpp index 608e26774e..829204eefa 100644 --- a/apps/openmw/mwmechanics/actorutil.hpp +++ b/apps/openmw/mwmechanics/actorutil.hpp @@ -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 diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 48861e19ba..5c546f0715 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -13,6 +13,7 @@ #include "../mwworld/actionequip.hpp" #include "../mwworld/cellstore.hpp" +#include "actorutil.hpp" #include "npcstats.hpp" #include "combat.hpp" #include "weaponpriority.hpp" diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 6e60a79b3f..f48bd7ce51 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -11,7 +11,7 @@ #include "movement.hpp" #include "creaturestats.hpp" -#include "combat.hpp" +#include "actorutil.hpp" namespace MWMechanics { diff --git a/apps/openmw/mwmechanics/combat.cpp b/apps/openmw/mwmechanics/combat.cpp index e18fb892dc..bc680602bc 100644 --- a/apps/openmw/mwmechanics/combat.cpp +++ b/apps/openmw/mwmechanics/combat.cpp @@ -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)) diff --git a/apps/openmw/mwmechanics/combat.hpp b/apps/openmw/mwmechanics/combat.hpp index 3d4a1bd77c..355d609b46 100644 --- a/apps/openmw/mwmechanics/combat.hpp +++ b/apps/openmw/mwmechanics/combat.hpp @@ -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); }