mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +00:00
Ignore distance when considering aggression due to crime (seems to work better, all balmora mages guild members now come to help when one is attacked)
This commit is contained in:
parent
1dc9e151cb
commit
a3ea7cb956
@ -195,7 +195,7 @@ namespace MWBase
|
||||
|
||||
/// @param bias Can be used to add an additional aggression bias towards the target,
|
||||
/// making it more likely for the function to return true.
|
||||
virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0) = 0;
|
||||
virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0, bool ignoreDistance=false) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ namespace MWMechanics
|
||||
}
|
||||
else
|
||||
{
|
||||
bool aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(*it, player, aggression);
|
||||
bool aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(*it, player, aggression, true);
|
||||
if (aggressive)
|
||||
{
|
||||
startCombat(*it, player);
|
||||
@ -1156,12 +1156,14 @@ namespace MWMechanics
|
||||
mActors.clear();
|
||||
}
|
||||
|
||||
bool MechanicsManager::isAggressive(const MWWorld::Ptr &ptr, const MWWorld::Ptr &target, int bias)
|
||||
bool MechanicsManager::isAggressive(const MWWorld::Ptr &ptr, const MWWorld::Ptr &target, int bias, bool ignoreDistance)
|
||||
{
|
||||
Ogre::Vector3 pos1 (ptr.getRefData().getPosition().pos);
|
||||
Ogre::Vector3 pos2 (target.getRefData().getPosition().pos);
|
||||
|
||||
float d = pos1.distance(pos2);
|
||||
float d = 0;
|
||||
if (!ignoreDistance)
|
||||
d = pos1.distance(pos2);
|
||||
|
||||
static int iFightDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
||||
"iFightDistanceBase")->getInt();
|
||||
|
@ -159,7 +159,7 @@ namespace MWMechanics
|
||||
|
||||
/// @param bias Can be used to add an additional aggression bias towards the target,
|
||||
/// making it more likely for the function to return true.
|
||||
virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0);
|
||||
virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0, bool ignoreDistance=false);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user