mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 06:40:09 +00:00
Merge pull request #1072 from Allofich/range
Give "on touch" spells same range as vanilla MW
This commit is contained in:
commit
8379291f70
@ -2642,7 +2642,8 @@ namespace MWWorld
|
|||||||
|
|
||||||
// Get the target to use for "on touch" effects, using the facing direction from Head node
|
// Get the target to use for "on touch" effects, using the facing direction from Head node
|
||||||
MWWorld::Ptr target;
|
MWWorld::Ptr target;
|
||||||
float distance = 192.f; // ??
|
float distance = getMaxActivationDistance();
|
||||||
|
|
||||||
osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3();
|
osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3();
|
||||||
osg::Vec3f origin = getActorHeadTransform(actor).getTrans();
|
osg::Vec3f origin = getActorHeadTransform(actor).getTrans();
|
||||||
|
|
||||||
@ -2680,6 +2681,16 @@ namespace MWWorld
|
|||||||
hitPosition = result2.mHitPointWorld;
|
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();
|
std::string selectedSpell = stats.getSpells().getSelectedSpell();
|
||||||
|
|
||||||
MWMechanics::CastSpell cast(actor, target);
|
MWMechanics::CastSpell cast(actor, target);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user