1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Merge pull request #1260 from akortunov/levitationfix

Purge existing levitation effects when levitation is disabled (fixes #3766)
This commit is contained in:
scrawl 2017-04-21 00:25:09 +02:00 committed by GitHub
commit bfdde0262f

View File

@ -596,6 +596,21 @@ namespace MWMechanics
}
}
// purge levitate effect if levitation is disabled
// check only modifier, because base value can be setted from SetFlying console command.
if (MWBase::Environment::get().getWorld()->isLevitationEnabled() == false && effects.get(ESM::MagicEffect::Levitate).getModifier() > 0)
{
creatureStats.getSpells().purgeEffect(ESM::MagicEffect::Levitate);
creatureStats.getActiveSpells().purgeEffect(ESM::MagicEffect::Levitate);
if (ptr.getClass().hasInventoryStore(ptr))
ptr.getClass().getInventoryStore(ptr).purgeEffect(ESM::MagicEffect::Levitate);
if (ptr == getPlayer())
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sLevitateDisabled}");
}
}
// attributes
for(int i = 0;i < ESM::Attribute::Length;++i)
{