1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-02-01 15:48:26 +00:00

Use getBaseNode to detect if the actor is active

This commit is contained in:
Evil Eye 2025-12-27 22:29:32 +01:00
parent dbeaa25985
commit 72de0c06ba
2 changed files with 3 additions and 22 deletions

View file

@ -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;

View file

@ -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;