1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-29 23:36:41 +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(); const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
bool reported = false;
// Find all the actors within the alarm radius // Find all the actors within the alarm radius
std::vector<MWWorld::Ptr> neighbors; std::vector<MWWorld::Ptr> neighbors;
@ -947,6 +946,8 @@ namespace MWMechanics
bool victimAware = false; bool victimAware = false;
// Find actors who directly witnessed the crime // 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) for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
{ {
if (*it == player) if (*it == player)
@ -974,15 +975,17 @@ namespace MWMechanics
if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim)) if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim))
continue; continue;
crimeSeen = true;
}
// Will the witness report the crime? // Will the witness report the crime?
if (it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100) if (it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100)
{ {
reported = true; reported = true;
} }
} }
}
if (reported) if (crimeSeen && reported)
reportCrime(player, victim, type, arg); reportCrime(player, victim, type, arg);
else if (victimAware && !victim.isEmpty() && type == OT_Assault) else if (victimAware && !victim.isEmpty() && type == OT_Assault)
startCombat(victim, player); startCombat(victim, player);