1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-20 19:39:41 +00:00

Give "on touch" spells same range as vanilla MW

This commit is contained in:
Allofich 2016-09-21 23:34:32 +09:00
parent 513f754529
commit 563ae479e8

View file

@ -2642,7 +2642,8 @@ namespace MWWorld
// Get the target to use for "on touch" effects, using the facing direction from Head node
MWWorld::Ptr target;
float distance = 192.f; // ??
float distance = getMaxActivationDistance();
osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3();
osg::Vec3f origin = getActorHeadTransform(actor).getTrans();
@ -2680,6 +2681,16 @@ namespace MWWorld
hitPosition = result2.mHitPointWorld;
}
// When targeting an actor that is in combat with an "on touch" spell,
// compare against the minimum of activation distance and combat distance.
if (!target.isEmpty() && target.getClass().isActor() && target.getClass().getCreatureStats (target).getAiSequence().isInCombat())
{
distance = std::min (distance, getStore().get<ESM::GameSetting>().find("fCombatDistance")->getFloat());
if (distance < dist1 && distance < dist2)
target = NULL;
}
std::string selectedSpell = stats.getSpells().getSelectedSpell();
MWMechanics::CastSpell cast(actor, target);