From 36657698fb46b2af751f2f25f0fbd0e5efb9bf7f Mon Sep 17 00:00:00 2001 From: Nuri Date: Wed, 21 Jul 2021 07:46:02 +0000 Subject: [PATCH] Added checks for paralysis, knocked down, and death when picking up items from inventory. Fixes #6165 --- AUTHORS.md | 1 + CHANGELOG.md | 1 + apps/openmw/mwgui/inventorywindow.cpp | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index aa492f6c1e..beb2b490f2 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -159,6 +159,7 @@ Programmers Nikolay Kasyanov (corristo) nobrakal Nolan Poe (nopoe) + Nurivan Gomez (Nuri-G) Oleg Chkan (mrcheko) Paul Cercueil (pcercuei) Paul McElroy (Greendogo) diff --git a/CHANGELOG.md b/CHANGELOG.md index e45b808771..36cde3b894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Bug #6131: Item selection in the avatar window not working correctly for large window sizes Bug #6133: Cannot reliably sneak or steal in the sight of the NPCs siding with player Bug #6143: Capturing a screenshot makes engine to be a temporary unresponsive + Bug #6165: Paralyzed player character can pickup items when the inventory is open Feature #2780: A way to see current OpenMW version in the console Feature #5489: MCP: Telekinesis fix for activators Feature #5996: Support Lua scripts in OpenMW diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 5f18fba91f..eead3919e0 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -29,6 +29,7 @@ #include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/creaturestats.hpp" +#include "../mwmechanics/npcstats.hpp" #include "itemview.hpp" #include "inventoryitemmodel.hpp" @@ -732,6 +733,12 @@ namespace MWGui if (!object.getRefData().activate()) return; + // Player must not be paralyzed, knocked down, or dead to pick up an item. + const MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats(player); + bool godmode = MWBase::Environment::get().getWorld()->getGodModeState(); + if ((!godmode && playerStats.isParalyzed()) || playerStats.getKnockedDown() || playerStats.isDead()) + return; + MWBase::Environment::get().getMechanicsManager()->itemTaken(player, object, MWWorld::Ptr(), count); // add to player inventory