mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Clean up magic bolts of actors that are gone (#5451)
This commit is contained in:
parent
05884e690f
commit
456f0f9f44
@ -26,6 +26,7 @@
|
||||
Bug #5427: GetDistance unknown ID error is misleading
|
||||
Bug #5435: Enemies can't hurt the player when collision is off
|
||||
Bug #5441: Enemies can't push a player character when in critical strike stance
|
||||
Bug #5451: Magic projectiles don't disappear with the caster
|
||||
Feature #5362: Show the soul gems' trapped soul in count dialog
|
||||
Feature #5445: Handle NiLines
|
||||
|
||||
|
@ -387,6 +387,18 @@ namespace MWWorld
|
||||
{
|
||||
for (std::vector<MagicBoltState>::iterator it = mMagicBolts.begin(); it != mMagicBolts.end();)
|
||||
{
|
||||
// If the actor caster is gone, the magic bolt needs to be removed from the scene during the next frame.
|
||||
MWWorld::Ptr caster = it->getCaster();
|
||||
if (!caster.isEmpty() && caster.getClass().isActor())
|
||||
{
|
||||
if (caster.getRefData().getCount() <= 0 || caster.getClass().getCreatureStats(caster).isDead())
|
||||
{
|
||||
cleanupMagicBolt(*it);
|
||||
it = mMagicBolts.erase(it);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
osg::Quat orient = it->mNode->getAttitude();
|
||||
static float fTargetSpellMaxSpeed = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
.find("fTargetSpellMaxSpeed")->mValue.getFloat();
|
||||
@ -405,8 +417,6 @@ namespace MWWorld
|
||||
|
||||
update(*it, duration);
|
||||
|
||||
MWWorld::Ptr caster = it->getCaster();
|
||||
|
||||
// For AI actors, get combat targets to use in the ray cast. Only those targets will return a positive hit result.
|
||||
std::vector<MWWorld::Ptr> targetActors;
|
||||
if (!caster.isEmpty() && caster.getClass().isActor() && caster != MWMechanics::getPlayer())
|
||||
|
Loading…
x
Reference in New Issue
Block a user