Turn ActorActiveEffects:remove into a delayed action

This commit is contained in:
Evil Eye 2025-02-24 17:07:32 +01:00
parent 07cc2a72bb
commit f891a7c3b3
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_MAJOR 0)
set(OPENMW_VERSION_MINOR 49) set(OPENMW_VERSION_MINOR 49)
set(OPENMW_VERSION_RELEASE 0) 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_POSTPROCESSING_API_REVISION 2)
set(OPENMW_VERSION_COMMITHASH "") set(OPENMW_VERSION_COMMITHASH "")

View File

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