Skip to content

Commit 72de0c0

Browse files
committed
Use getBaseNode to detect if the actor is active
1 parent dbeaa25 commit 72de0c0

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

apps/openmw/mwmechanics/aicombat.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "../mwbase/mechanicsmanager.hpp"
1919
#include "../mwbase/world.hpp"
2020

21-
#include "../mwlua/localscripts.hpp"
22-
2321
#include "actorutil.hpp"
2422
#include "aicombataction.hpp"
2523
#include "character.hpp"
@@ -121,17 +119,9 @@ namespace MWMechanics
121119

122120
// Stop if the target doesn't exist
123121
if (target.isEmpty() || !target.getCellRef().getCount() || !target.getRefData().isEnabled()
124-
|| target.getClass().getCreatureStats(target).isDead())
122+
|| target.getClass().getCreatureStats(target).isDead() || !target.getRefData().getBaseNode())
125123
return true;
126124

127-
// This is equivalent to checking if the actor is registered with the mechanics manager since every actor has a
128-
// script
129-
if (const MWLua::LocalScripts* scripts = target.getRefData().getLuaScripts())
130-
{
131-
if (!scripts->isActive())
132-
return true;
133-
}
134-
135125
if (actor == target) // This should never happen.
136126
return true;
137127

apps/openmw/mwmechanics/aipursue.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include "../mwbase/windowmanager.hpp"
88
#include "../mwbase/world.hpp"
99

10-
#include "../mwlua/localscripts.hpp"
11-
1210
#include "../mwworld/class.hpp"
1311

1412
#include "actorutil.hpp"
@@ -38,17 +36,10 @@ namespace MWMechanics
3836
const MWWorld::Ptr target = getTarget(); // The target to follow
3937

4038
// Stop if the target doesn't exist
41-
if (target.isEmpty() || !target.getCellRef().getCount() || !target.getRefData().isEnabled())
39+
if (target.isEmpty() || !target.getCellRef().getCount() || !target.getRefData().isEnabled()
40+
|| !target.getRefData().getBaseNode())
4241
return true;
4342

44-
// This is equivalent to checking if the actor is registered with the mechanics manager since every actor has a
45-
// script
46-
if (const MWLua::LocalScripts* scripts = target.getRefData().getLuaScripts())
47-
{
48-
if (!scripts->isActive())
49-
return true;
50-
}
51-
5243
if (isTargetMagicallyHidden(target)
5344
&& !MWBase::Environment::get().getMechanicsManager()->awarenessCheck(target, actor, false))
5445
return false;

0 commit comments

Comments
 (0)