From 0e5c3f781fe1419163f52936f49b466f0d1f4bbc Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 7 Jul 2016 22:10:38 +0900 Subject: [PATCH] Only allow trap distance check to apply to player --- apps/openmw/mwworld/actiontrap.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/actiontrap.cpp b/apps/openmw/mwworld/actiontrap.cpp index e9ec5fa5e2..1ddf86bf6c 100644 --- a/apps/openmw/mwworld/actiontrap.cpp +++ b/apps/openmw/mwworld/actiontrap.cpp @@ -1,6 +1,7 @@ #include "actiontrap.hpp" #include "../mwmechanics/spellcasting.hpp" +#include "../mwmechanics/actorutil.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -17,13 +18,13 @@ namespace MWWorld // radius, because for most trap spells this is 1 foot, much less than the activation distance. // Using activation distance as the trap range. - if (distance > trapRange) // actor activated object outside range of trap + if (distance > trapRange && actor == MWMechanics::getPlayer()) // player activated object outside range of trap { MWMechanics::CastSpell cast(mTrapSource, mTrapSource); cast.mHitPosition = trapPosition; cast.cast(mSpellId); } - else // actor activated object within range of trap + else // player activated object within range of trap, or NPC activated trap { MWMechanics::CastSpell cast(mTrapSource, actor); cast.mHitPosition = actorPosition;