From 72de0c06ba617f417c742ef0f6134ce76cd1a56a Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 27 Dec 2025 22:29:32 +0100 Subject: [PATCH] Use getBaseNode to detect if the actor is active --- apps/openmw/mwmechanics/aicombat.cpp | 12 +----------- apps/openmw/mwmechanics/aipursue.cpp | 13 ++----------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 1ccc4455ed..2b71f2e8a5 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -18,8 +18,6 @@ #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/world.hpp" -#include "../mwlua/localscripts.hpp" - #include "actorutil.hpp" #include "aicombataction.hpp" #include "character.hpp" @@ -121,17 +119,9 @@ namespace MWMechanics // Stop if the target doesn't exist if (target.isEmpty() || !target.getCellRef().getCount() || !target.getRefData().isEnabled() - || target.getClass().getCreatureStats(target).isDead()) + || target.getClass().getCreatureStats(target).isDead() || !target.getRefData().getBaseNode()) return true; - // This is equivalent to checking if the actor is registered with the mechanics manager since every actor has a - // script - if (const MWLua::LocalScripts* scripts = target.getRefData().getLuaScripts()) - { - if (!scripts->isActive()) - return true; - } - if (actor == target) // This should never happen. return true; diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 2f15b35dd5..b9bc3d9966 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -7,8 +7,6 @@ #include "../mwbase/windowmanager.hpp" #include "../mwbase/world.hpp" -#include "../mwlua/localscripts.hpp" - #include "../mwworld/class.hpp" #include "actorutil.hpp" @@ -38,17 +36,10 @@ namespace MWMechanics const MWWorld::Ptr target = getTarget(); // The target to follow // Stop if the target doesn't exist - if (target.isEmpty() || !target.getCellRef().getCount() || !target.getRefData().isEnabled()) + if (target.isEmpty() || !target.getCellRef().getCount() || !target.getRefData().isEnabled() + || !target.getRefData().getBaseNode()) return true; - // This is equivalent to checking if the actor is registered with the mechanics manager since every actor has a - // script - if (const MWLua::LocalScripts* scripts = target.getRefData().getLuaScripts()) - { - if (!scripts->isActive()) - return true; - } - if (isTargetMagicallyHidden(target) && !MWBase::Environment::get().getMechanicsManager()->awarenessCheck(target, actor, false)) return false;