forked from mirror/openmw-tes3mp
Merge pull request #1638
This commit is contained in:
commit
cbddb4a0a9
1 changed files with 14 additions and 1 deletions
|
@ -1445,7 +1445,20 @@ namespace MWMechanics
|
||||||
// Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back.
|
// Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back.
|
||||||
// Note: accidental or collateral damage attacks are ignored.
|
// Note: accidental or collateral damage attacks are ignored.
|
||||||
if (!target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
if (!target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
||||||
startCombat(target, attacker);
|
{
|
||||||
|
// If an actor has OnPCHitMe declared in his script, his Fight = 0 and the attacker is player,
|
||||||
|
// he will attack the player only if we will force him (e.g. via StartCombat console command)
|
||||||
|
bool peaceful = false;
|
||||||
|
std::string script = target.getClass().getScript(target);
|
||||||
|
if (!script.empty() && target.getRefData().getLocals().hasVar(script, "onpchitme") && attacker == getPlayer())
|
||||||
|
{
|
||||||
|
int fight = std::max(0, target.getClass().getCreatureStats(target).getAiSetting(CreatureStats::AI_Fight).getModified());
|
||||||
|
peaceful = (fight == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!peaceful)
|
||||||
|
startCombat(target, attacker);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue