mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:15:32 +00:00
Don't report crime for attacking an NPC that is already in combat with another NPC (Fixes #1908, Fixes #1821)
This commit is contained in:
parent
f721b7adfb
commit
40ce5add59
1 changed files with 14 additions and 2 deletions
|
@ -1128,9 +1128,21 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attacking peaceful NPCs is a crime
|
// Attacking an NPC that is already in combat with any other NPC is not a crime
|
||||||
|
AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||||
|
bool isFightingNpc = false;
|
||||||
|
for (std::list<AiPackage*>::const_iterator it = seq.begin(); it != seq.end(); ++it)
|
||||||
|
{
|
||||||
|
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr target = static_cast<AiCombat*>(*it)->getTarget();
|
||||||
|
if (!target.isEmpty() && target.getClass().isNpc())
|
||||||
|
isFightingNpc = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr.getClass().isNpc() && !attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)
|
if (ptr.getClass().isNpc() && !attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)
|
||||||
&& !isAggressive(ptr, attacker))
|
&& !isAggressive(ptr, attacker) && !isFightingNpc)
|
||||||
commitCrime(attacker, ptr, MWBase::MechanicsManager::OT_Assault);
|
commitCrime(attacker, ptr, MWBase::MechanicsManager::OT_Assault);
|
||||||
|
|
||||||
if (!attacker.isEmpty() && (attacker.getClass().getCreatureStats(attacker).getAiSequence().isInCombat(ptr)
|
if (!attacker.isEmpty() && (attacker.getClass().getCreatureStats(attacker).getAiSequence().isInCombat(ptr)
|
||||||
|
|
Loading…
Reference in a new issue