1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 16:53:55 +00:00

Crime update: NPCs can report crimes if they didn't see the crime, but were alerted by someone who saw it and did not report it themselves.

This commit is contained in:
scrawl 2014-12-01 16:36:01 +01:00
parent 507cbcfae3
commit 46d93f1b08

View file

@ -930,7 +930,6 @@ namespace MWMechanics
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
bool reported = false;
// Find all the actors within the alarm radius
std::vector<MWWorld::Ptr> neighbors;
@ -947,6 +946,8 @@ namespace MWMechanics
bool victimAware = false;
// Find actors who directly witnessed the crime
bool crimeSeen = false;
bool reported = false;
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
{
if (*it == player)
@ -974,15 +975,17 @@ namespace MWMechanics
if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim))
continue;
// Will the witness report the crime?
if (it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100)
{
reported = true;
}
crimeSeen = true;
}
// Will the witness report the crime?
if (it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100)
{
reported = true;
}
}
if (reported)
if (crimeSeen && reported)
reportCrime(player, victim, type, arg);
else if (victimAware && !victim.isEmpty() && type == OT_Assault)
startCombat(victim, player);