forked from mirror/openmw-tes3mp
Closes #1127: Fix for subtitles for idle dialogue appearing outside of hearing range
This commit is contained in:
parent
bea161331c
commit
05e75e1214
1 changed files with 5 additions and 2 deletions
|
@ -191,8 +191,11 @@ namespace MWMechanics
|
|||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
float chance = store.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
// TODO: do not show subtitle messagebox if player is too far away? or do not say at all?
|
||||
if (roll < chance)
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// Don't bother if the player is out of hearing range
|
||||
if (roll < chance && Ogre::Vector3(player.getRefData().getPosition().pos).distance(Ogre::Vector3(actor.getRefData().getPosition().pos)) < 1500)
|
||||
MWBase::Environment::get().getDialogueManager()->say(actor, "idle");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue