1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 23:15:43 +00:00

Merge branch 'welcome_to_the_scripted_casts' into 'master'

Don't stack cast packages

Closes #6197

See merge request OpenMW/openmw!1096
This commit is contained in:
psi29a 2021-08-07 19:43:33 +00:00
commit 1ccf377638
3 changed files with 15 additions and 6 deletions

View file

@ -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

View file

@ -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())

View file

@ -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;
}