Rebuild actor animations on resurrection (Fixes #3124)

A new animation is necessary to set up the correct InventoryStore listener, to get notified of changes like the actor no longer being a werewolf, etc.
drop
scrawl 9 years ago
parent daa94cc50e
commit e6619c5306

@ -1125,10 +1125,16 @@ namespace MWScript
ptr.getClass().getCreatureStats(ptr).resurrect(); ptr.getClass().getCreatureStats(ptr).resurrect();
else if (ptr.getClass().getCreatureStats(ptr).isDead()) else if (ptr.getClass().getCreatureStats(ptr).isDead())
{ {
bool wasEnabled = ptr.getRefData().isEnabled();
MWBase::Environment::get().getWorld()->undeleteObject(ptr); MWBase::Environment::get().getWorld()->undeleteObject(ptr);
// resets runtime state such as inventory, stats and AI. does not reset position in the world
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
// HACK: disable/enable object to re-add it to the scene properly (need a new Animation).
MWBase::Environment::get().getWorld()->disable(ptr);
// resets runtime state such as inventory, stats and AI. does not reset position in the world
ptr.getRefData().setCustomData(NULL); ptr.getRefData().setCustomData(NULL);
if (wasEnabled)
MWBase::Environment::get().getWorld()->enable(ptr);
} }
} }
}; };

Loading…
Cancel
Save