From 480000da07fe5e8138a73226df4aff752f2c1388 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sun, 15 Sep 2019 23:17:36 +0300 Subject: [PATCH] Use Open action as fallback for companion activation (bug #5161) --- CHANGELOG.md | 1 + apps/openmw/mwclass/creature.cpp | 15 ++++++--------- apps/openmw/mwclass/npc.cpp | 24 ++++++++++++------------ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8beb82cb..b3f458f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -138,6 +138,7 @@ Bug #5134: Doors rotation by "Lock" console command is inconsistent Bug #5137: Textures with Clamp Mode set to Clamp instead of Wrap are too dark outside the boundaries Bug #5149: Failing lock pick attempts isn't always a crime + Bug #5161: Creature companions can't be activated when they are knocked down Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index ba0bbf97f..855f083af 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -454,18 +454,15 @@ namespace MWClass // otherwise wait until death animation if(stats.isDeathAnimationFinished()) return std::shared_ptr(new MWWorld::ActionOpen(ptr)); - - // death animation is not finished, do nothing - return std::shared_ptr (new MWWorld::FailedAction("")); } + else if (!stats.getAiSequence().isInCombat() && !stats.getKnockedDown()) + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); - if(stats.getAiSequence().isInCombat()) - return std::shared_ptr(new MWWorld::FailedAction("")); - - if(stats.getKnockedDown()) - return std::shared_ptr(new MWWorld::FailedAction("")); + // Tribunal and some mod companions oddly enough must use open action as fallback + if (!getScript(ptr).empty() && ptr.getRefData().getLocals().getIntVar(getScript(ptr), "companion")) + return std::shared_ptr(new MWWorld::ActionOpen(ptr)); - return std::shared_ptr(new MWWorld::ActionTalk(ptr)); + return std::shared_ptr(new MWWorld::FailedAction("")); } MWWorld::ContainerStore& Creature::getContainerStore (const MWWorld::Ptr& ptr) const diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 868ab9d85..0eabe8ff2 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -884,22 +884,22 @@ namespace MWClass // otherwise wait until death animation if(stats.isDeathAnimationFinished()) return std::shared_ptr(new MWWorld::ActionOpen(ptr)); - - // death animation is not finished, do nothing - return std::shared_ptr (new MWWorld::FailedAction("")); } + else if (!stats.getAiSequence().isInCombat()) + { + if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak) || stats.getKnockedDown()) + return std::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing - if(stats.getAiSequence().isInCombat()) - return std::shared_ptr(new MWWorld::FailedAction("")); - - if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak) || stats.getKnockedDown()) - return std::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing + // Can't talk to werewolves + if (!getNpcStats(ptr).isWerewolf()) + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); + } - // Can't talk to werewolfs - if(getNpcStats(ptr).isWerewolf()) - return std::shared_ptr (new MWWorld::FailedAction("")); + // Tribunal and some mod companions oddly enough must use open action as fallback + if (!getScript(ptr).empty() && ptr.getRefData().getLocals().getIntVar(getScript(ptr), "companion")) + return std::shared_ptr(new MWWorld::ActionOpen(ptr)); - return std::shared_ptr(new MWWorld::ActionTalk(ptr)); + return std::shared_ptr (new MWWorld::FailedAction("")); } MWWorld::ContainerStore& Npc::getContainerStore (const MWWorld::Ptr& ptr)