1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 22:09:42 +00:00

Make GetCurrentAIPackage return -1 for non-actors and dead actors

This commit is contained in:
Evil Eye 2021-09-16 16:56:13 +02:00
parent 2f4df12b2e
commit 34cf66139a
2 changed files with 10 additions and 1 deletions

View file

@ -37,6 +37,7 @@
Bug #6184: Command and Calm and Demoralize and Frenzy and Rally magic effects inconsistencies with vanilla
Bug #6197: Infinite Casting Loop
Bug #6273: Respawning NPCs rotation is inconsistent
Bug #6283: Avis Dorsey follows you after her death
Bug #6289: Keyword search in dialogues expected the text to be all ASCII characters
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
Feature #2780: A way to see current OpenMW version in the console

View file

@ -362,7 +362,15 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
const auto value = static_cast<Interpreter::Type_Integer>(ptr.getClass().getCreatureStats (ptr).getAiSequence().getLastRunTypeId());
Interpreter::Type_Integer value = -1;
if(ptr.getClass().isActor())
{
const auto& stats = ptr.getClass().getCreatureStats(ptr);
if(!stats.isDead() || !stats.isDeathAnimationFinished())
{
value = static_cast<Interpreter::Type_Integer>(stats.getAiSequence().getLastRunTypeId());
}
}
runtime.push (value);
}