diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp index 0874f5fdf..ecd6d18f0 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -129,7 +129,7 @@ namespace MWGui Disable increases for Security and Sneak when using ignoreJailSkillIncreases */ if (mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases) - value.setBase(value.getBase() - 1); + value.setBase(std::max(0, value.getBase()-1)); else if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak) /* End of tes3mp change (minor) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 879798a44..6e2f068af 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1065,7 +1065,18 @@ namespace MWMechanics && MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, ptr)) { static const int iCrimeThresholdMultiplier = esmStore.get().find("iCrimeThresholdMultiplier")->getInt(); - if (player.getClass().getNpcStats(player).getBounty() >= cutoff * iCrimeThresholdMultiplier) + + /* + Start of tes3mp change (major) + + Only attack players based on their high bounty if they haven't died since the last + time an attempt was made to arrest them + */ + if (player.getClass().getNpcStats(player).getBounty() >= cutoff * iCrimeThresholdMultiplier + && !mwmp::Main::get().getLocalPlayer()->diedSinceArrestAttempt) + /* + End of tes3mp change (major) + */ { MWBase::Environment::get().getMechanicsManager()->startCombat(ptr, player); creatureStats.setHitAttemptActorId(player.getClass().getCreatureStats(player).getActorId()); // Stops the guard from quitting combat if player is unreachable @@ -1096,6 +1107,24 @@ namespace MWMechanics // Update witness crime id npcStats.setCrimeId(-1); } + /* + Start of tes3mp addition + + If the player has died, stop combat with them as though they had + paid their bounty + */ + else if (mwmp::Main::get().getLocalPlayer()->diedSinceArrestAttempt) + { + if (creatureStats.getAiSequence().isInCombat(player)) + { + creatureStats.getAiSequence().stopCombat(); + creatureStats.setAttacked(false); + creatureStats.setAlarmed(false); + } + } + /* + End of tes3mp addition + */ } } } diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 2a375534e..50a68c8e6 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -13,7 +13,10 @@ Include additional headers for multiplayer purposes */ +#include #include "../mwgui/windowmanagerimp.hpp" +#include "../mwmp/Main.hpp" +#include "../mwmp/LocalPlayer.hpp" /* End of tes3mp addition */ @@ -81,6 +84,18 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte if (pathTo(actor, dest, duration, 100)) { target.getClass().activate(target,actor).get()->execute(actor); //Arrest player when reached + + /* + Start of tes3mp addition + + Record that the player has not died since the last attempt to arrest them + */ + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "After being pursued by %s, diedSinceArrestAttempt is now false", actor.getCellRef().getRefId().c_str()); + mwmp::Main::get().getLocalPlayer()->diedSinceArrestAttempt = false; + /* + End of tes3mp addition + */ + return true; } diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index cef392ff1..3cd057830 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -61,6 +61,8 @@ LocalPlayer::LocalPlayer() jailProgressText = ""; jailEndText = ""; + + diedSinceArrestAttempt = false; } LocalPlayer::~LocalPlayer() diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp index e0c7e39d0..c6e6ab5b3 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp @@ -52,6 +52,12 @@ namespace mwmp // readied but be unable to use it unless we clear it here playerPtr.getClass().getNpcStats(playerPtr).setDrawState(MWMechanics::DrawState_Nothing); + // Record that the player has died since the last attempt was made to arrest them, + // used to make guards lenient enough to attempt an arrest again + player->diedSinceArrestAttempt = true; + + LOG_APPEND(Log::LOG_INFO, "- diedSinceArrestAttempt is now true"); + packet.setPlayer(player); packet.Send(serverAddr); diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 1f971d285..0b3a2cc9a 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -263,6 +263,8 @@ namespace mwmp std::string jailEndText; unsigned int resurrectType; + + bool diedSinceArrestAttempt; }; }