Make GetTarget return 1 during actor greeting (bug #5255)

pull/2668/head
Capostrophic 4 years ago
parent 8bfca9830f
commit a2c674bb2e

@ -194,6 +194,7 @@
Bug #5242: ExplodeSpell behavior differs from Cast behavior
Bug #5249: Wandering NPCs start walking too soon after they hello
Bug #5250: Creatures display shield ground mesh instead of shield body part
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls

@ -25,6 +25,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "interpretercontext.hpp"
#include "ref.hpp"
@ -435,6 +436,14 @@ namespace MWScript
if (!targetPtr.isEmpty() && targetPtr.getCellRef().getRefId() == testedTargetId)
targetsAreEqual = true;
}
else
{
bool turningToPlayer = creatureStats.isTurningToPlayer();
bool greeting = creatureStats.getGreetingState() == MWMechanics::Greet_InProgress;
bool sayActive = MWBase::Environment::get().getSoundManager()->sayActive(actor);
if (turningToPlayer || (greeting && sayActive))
targetsAreEqual = (testedTargetId == "player"); // Currently the player ID is hardcoded
}
runtime.push(int(targetsAreEqual));
}
};

Loading…
Cancel
Save