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

pull/3130/head
Evil Eye 3 years ago
parent 2f4df12b2e
commit 34cf66139a

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

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

Loading…
Cancel
Save