1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-08 05:32:24 +00:00

Immobile creatures should enter combat, but not act

This commit is contained in:
Aussiemon 2025-04-15 17:25:58 -06:00 committed by Aussiemon
parent 266702e729
commit a77a8904e5
2 changed files with 9 additions and 3 deletions

View file

@ -104,10 +104,10 @@ namespace MWMechanics
bool AiCombat::execute(
const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{
// get or create temporary storage
// Get or create temporary storage
AiCombatStorage& storage = state.get<AiCombatStorage>();
// General description
// No combat for dead creatures
if (actor.getClass().getCreatureStats(actor).isDead())
return true;
@ -245,7 +245,9 @@ namespace MWMechanics
float distToTarget = getDistanceToBounds(actor, target);
storage.mReadyToAttack = (currentAction->isAttackingOrSpell() && distToTarget <= rangeAttack && storage.mLOS);
// Must be attacking, within range, have line of sight, and not be immobile
storage.mReadyToAttack = (currentAction->isAttackingOrSpell() && distToTarget <= rangeAttack && storage.mLOS
&& actor.getClass().isMobile(actor));
if (isRangedCombat)
{

View file

@ -135,6 +135,10 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
MWWorld::MovementDirectionFlags supportedMovementDirections, float destTolerance, float endTolerance,
PathType pathType)
{
// No pathing for totally static creatures
if (!actor.getClass().isMobile(actor))
return false;
const Misc::TimerStatus timerStatus = mReaction.update(duration);
const osg::Vec3f position = actor.getRefData().getPosition().asVec3(); // position of the actor