1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 22:15:32 +00:00

[Client] Prevent guards from arresting players who are currently jailed

This commit is contained in:
David Cernat 2018-02-25 21:33:04 +02:00
parent 60f686ee43
commit 03266d7648
3 changed files with 22 additions and 9 deletions

View file

@ -112,6 +112,16 @@ namespace MWGui
MWWorld::Ptr player = MWMechanics::getPlayer(); MWWorld::Ptr player = MWMechanics::getPlayer();
/*
Start of tes3mp addition
Declare pointer to LocalPlayer for use in other additions
*/
mwmp::LocalPlayer* localPlayer = mwmp::Main::get().getLocalPlayer();
/*
End of tes3mp addition
*/
for (int i=0; i<mDays*24; ++i) for (int i=0; i<mDays*24; ++i)
MWBase::Environment::get().getMechanicsManager()->rest(true); MWBase::Environment::get().getMechanicsManager()->rest(true);
MWBase::Environment::get().getWorld()->advanceTime(mDays * 24); MWBase::Environment::get().getWorld()->advanceTime(mDays * 24);
@ -129,7 +139,7 @@ namespace MWGui
Disable increases for Security and Sneak when using ignoreJailSkillIncreases Disable increases for Security and Sneak when using ignoreJailSkillIncreases
*/ */
if (mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases) if (localPlayer->ignoreJailSkillIncreases)
value.setBase(std::max(0, value.getBase()-1)); value.setBase(std::max(0, value.getBase()-1));
else if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak) else if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak)
/* /*
@ -153,7 +163,7 @@ namespace MWGui
If we've received a packet overriding the default jail end text, use the new text If we've received a packet overriding the default jail end text, use the new text
*/ */
if (!mwmp::Main::get().getLocalPlayer()->jailEndText.empty()) if (!localPlayer->jailEndText.empty())
message = mwmp::Main::get().getLocalPlayer()->jailEndText; message = mwmp::Main::get().getLocalPlayer()->jailEndText;
/* /*
End of tes3mp addition End of tes3mp addition
@ -176,7 +186,7 @@ namespace MWGui
Account for usage of ignoreJailSkillIncreases Account for usage of ignoreJailSkillIncreases
*/ */
if (!mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases && if (!localPlayer->ignoreJailSkillIncreases &&
(*it == ESM::Skill::Sneak || *it == ESM::Skill::Security)) (*it == ESM::Skill::Sneak || *it == ESM::Skill::Security))
/* /*
End of tes3mp change (minor) End of tes3mp change (minor)
@ -195,10 +205,10 @@ namespace MWGui
Reset all PlayerJail-related overrides Reset all PlayerJail-related overrides
*/ */
mwmp::Main::get().getLocalPlayer()->ignoreJailTeleportation = false; localPlayer->ignoreJailTeleportation = false;
mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases = false; localPlayer->ignoreJailSkillIncreases = false;
mwmp::Main::get().getLocalPlayer()->jailProgressText = ""; localPlayer->jailProgressText = "";
mwmp::Main::get().getLocalPlayer()->jailEndText = ""; localPlayer->jailEndText = "";
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

View file

@ -64,10 +64,13 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte
Because multiplayer does not pause the game, prevent infinite arrest loops by ignoring Because multiplayer does not pause the game, prevent infinite arrest loops by ignoring
players already engaged in dialogue players already engaged in dialogue
Additionally, do not arrest players who are currently jailed
*/ */
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr()) if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
{ {
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue)) if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue) ||
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail))
{ {
return true; return true;
} }

View file

@ -69,9 +69,9 @@ LocalPlayer::LocalPlayer()
scale = 1; scale = 1;
isWerewolf = false; isWerewolf = false;
diedSinceArrestAttempt = false;
isReceivingQuickKeys = false; isReceivingQuickKeys = false;
isPlayingAnimation = false; isPlayingAnimation = false;
diedSinceArrestAttempt = false;
} }
LocalPlayer::~LocalPlayer() LocalPlayer::~LocalPlayer()