1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 21:09:41 +00:00

Merge branch 'actionshaveeffects' into 'master'

Turn ActorActiveEffects:remove into a delayed action

Closes #8317, #8350, and #8366

See merge request OpenMW/openmw!4553
This commit is contained in:
Alexei Kotov 2025-02-24 22:49:52 +00:00
commit a6676fd6f3
2 changed files with 9 additions and 7 deletions

View file

@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...")
set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 49)
set(OPENMW_VERSION_RELEASE 0)
set(OPENMW_LUA_API_REVISION 70)
set(OPENMW_LUA_API_REVISION 71)
set(OPENMW_POSTPROCESSING_API_REVISION 2)
set(OPENMW_VERSION_COMMITHASH "")

View file

@ -1061,7 +1061,7 @@ namespace MWLua
};
// types.Actor.activeEffects(o):removeEffect(id, ?arg)
activeEffectsT["remove"] = [getEffectKey](const ActorActiveEffects& effects, std::string_view idStr,
activeEffectsT["remove"] = [getEffectKey, context](const ActorActiveEffects& effects, std::string_view idStr,
sol::optional<std::string_view> argStr) {
if (!effects.isActor())
return;
@ -1071,12 +1071,14 @@ namespace MWLua
MWMechanics::EffectKey key = getEffectKey(idStr, argStr);
// Note that, although this is member method of ActorActiveEffects and we are removing an effect (not a
// spell), we still need to use the active spells store to purge this effect from active spells.
const auto& ptr = effects.mActor.ptr();
context.mLuaManager->addAction([key, effects]() {
// Note that, although this is member method of ActorActiveEffects and we are removing an effect (not a
// spell), we still need to use the active spells store to purge this effect from active spells.
const auto& ptr = effects.mActor.ptr();
auto& activeSpells = ptr.getClass().getCreatureStats(ptr).getActiveSpells();
activeSpells.purgeEffect(ptr, key.mId, key.mArg);
auto& activeSpells = ptr.getClass().getCreatureStats(ptr).getActiveSpells();
activeSpells.purgeEffect(ptr, key.mId, key.mArg);
});
};
// types.Actor.activeEffects(o):set(value, id, ?arg)