Don't stack cast packages

pull/3097/head
Evil Eye 3 years ago
parent b770373491
commit 29921bf9fa

@ -31,6 +31,7 @@
Bug #6165: Paralyzed player character can pickup items when the inventory is open
Bug #6174: Spellmaking and Enchanting sliders differences from vanilla
Bug #6184: Command and Calm and Demoralize and Frenzy and Rally magic effects inconsistencies with vanilla
Bug #6197: Infinite Casting Loop
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
Feature #3616: Allow Zoom levels on the World Map

@ -361,11 +361,12 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor, boo
// insert new package in correct place depending on priority
for (auto it = mPackages.begin(); it != mPackages.end(); ++it)
{
// We should keep current AiCast package, if we try to add a new one.
// We should override current AiCast package, if we try to add a new one.
if ((*it)->getTypeId() == MWMechanics::AiPackageTypeId::Cast &&
package.getTypeId() == MWMechanics::AiPackageTypeId::Cast)
{
continue;
*it = package.clone();
return;
}
if((*it)->getPriority() <= package.getPriority())

@ -25,6 +25,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/scriptmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/world.hpp"
@ -1233,8 +1234,11 @@ namespace MWScript
if (ptr.getClass().isActor())
{
MWMechanics::AiCast castPackage(targetId, spellId, true);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(castPackage, ptr);
if (!MWBase::Environment::get().getMechanicsManager()->isCastingSpell(ptr))
{
MWMechanics::AiCast castPackage(targetId, spellId, true);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(castPackage, ptr);
}
return;
}
@ -1276,8 +1280,11 @@ namespace MWScript
if (ptr.getClass().isActor())
{
MWMechanics::AiCast castPackage(ptr.getCellRef().getRefId(), spellId, true);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(castPackage, ptr);
if (!MWBase::Environment::get().getMechanicsManager()->isCastingSpell(ptr))
{
MWMechanics::AiCast castPackage(ptr.getCellRef().getRefId(), spellId, true);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(castPackage, ptr);
}
return;
}

Loading…
Cancel
Save