From 04eb4ea6b62632bb0121cb4c1bd991c09ccd918d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 19 Apr 2017 18:38:25 +0400 Subject: [PATCH] Check for disabled levitation (fixes #3766) --- apps/openmw/mwmechanics/actors.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 1ae0e36a9..2b475e475 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -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) {