mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 23:21:20 -04:00
Merge pull request #1394 from akortunov/followerattackfix
Prevent followers from attacking player if crime was reported
This commit is contained in:
commit
8acf0ba633
@ -1067,11 +1067,6 @@ namespace MWMechanics
|
|||||||
if (playerFollowers.find(*it) != playerFollowers.end())
|
if (playerFollowers.find(*it) != playerFollowers.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (type == OT_Theft || type == OT_Pickpocket)
|
|
||||||
MWBase::Environment::get().getDialogueManager()->say(*it, "thief");
|
|
||||||
else if (type == OT_Trespassing)
|
|
||||||
MWBase::Environment::get().getDialogueManager()->say(*it, "intruder");
|
|
||||||
|
|
||||||
crimeSeen = true;
|
crimeSeen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1173,10 +1168,25 @@ namespace MWMechanics
|
|||||||
if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim))
|
if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Player's followers should not attack player, or try to arrest him
|
||||||
|
if (it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdFollow))
|
||||||
|
{
|
||||||
|
std::set<MWWorld::Ptr> playerFollowers;
|
||||||
|
getActorsSidingWith(player, playerFollowers);
|
||||||
|
|
||||||
|
if (playerFollowers.find(*it) != playerFollowers.end())
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 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 (type == OT_Theft || type == OT_Pickpocket)
|
||||||
|
MWBase::Environment::get().getDialogueManager()->say(*it, "thief");
|
||||||
|
else if (type == OT_Trespassing)
|
||||||
|
MWBase::Environment::get().getDialogueManager()->say(*it, "intruder");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it->getClass().isClass(*it, "guard"))
|
if (it->getClass().isClass(*it, "guard"))
|
||||||
@ -1190,16 +1200,6 @@ namespace MWMechanics
|
|||||||
|
|
||||||
if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
||||||
{
|
{
|
||||||
// Player's followers should not try to arrest player
|
|
||||||
if (it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdFollow))
|
|
||||||
{
|
|
||||||
std::set<MWWorld::Ptr> playerFollowers;
|
|
||||||
getActorsSidingWith(player, playerFollowers);
|
|
||||||
|
|
||||||
if (playerFollowers.find(*it) != playerFollowers.end())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it);
|
it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user