1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Fix 7448 (onConsume don't work after loading a save if inventory wasn't accessed from Lua)

This commit is contained in:
Petr Mikheev 2023-07-03 02:13:41 +02:00
parent 6601b0cb15
commit e3fa3a3712

View File

@ -50,6 +50,7 @@
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/localscripts.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/worldmodel.hpp"
#include "../mwrender/npcanimation.hpp"
#include "../mwrender/objects.hpp"
@ -1144,6 +1145,7 @@ namespace MWClass
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
MWMechanics::CastSpell cast(actor, actor);
const ESM::RefId& recordId = consumable.getCellRef().getRefId();
MWBase::Environment::get().getWorldModel()->registerPtr(consumable);
MWBase::Environment::get().getLuaManager()->itemConsumed(consumable, actor);
actor.getClass().getContainerStore(actor).remove(consumable, 1);
return cast.cast(recordId);