mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 11:53:51 +00:00
[Client] Prevent NPCs from attacking a player engaged in dialogue
This commit is contained in:
parent
b883b4c7ce
commit
6da6c4e62d
1 changed files with 27 additions and 0 deletions
|
@ -13,6 +13,16 @@
|
||||||
#include "../mwworld/actionequip.hpp"
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Include additional headers for multiplayer purposes
|
||||||
|
*/
|
||||||
|
#include "../mwgui/windowmanagerimp.hpp"
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
#include "npcstats.hpp"
|
#include "npcstats.hpp"
|
||||||
#include "spellcasting.hpp"
|
#include "spellcasting.hpp"
|
||||||
#include "combat.hpp"
|
#include "combat.hpp"
|
||||||
|
@ -754,6 +764,23 @@ namespace MWMechanics
|
||||||
ESM::Position actorPos = actor.getRefData().getPosition();
|
ESM::Position actorPos = actor.getRefData().getPosition();
|
||||||
ESM::Position enemyPos = enemy.getRefData().getPosition();
|
ESM::Position enemyPos = enemy.getRefData().getPosition();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Because multiplayer doesn't pause the world during dialogue, disallow fights with
|
||||||
|
a player engaged in dialogue
|
||||||
|
*/
|
||||||
|
if (enemy == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
|
{
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
const CreatureStats& enemyStats = enemy.getClass().getCreatureStats(enemy);
|
const CreatureStats& enemyStats = enemy.getClass().getCreatureStats(enemy);
|
||||||
if (enemyStats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude() > 0
|
if (enemyStats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude() > 0
|
||||||
|| enemyStats.getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude() > 0)
|
|| enemyStats.getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude() > 0)
|
||||||
|
|
Loading…
Reference in a new issue